Commit adaae0f4ff2bec254f23ffb3c9fc061d9a3e3de7

Authored by Florian HENRY
1 parent c0d7b501
Exists in 3.5 and in 1 other branch 3.6

add function list

accountingex/class/html.formventilation.class.php
... ... @@ -89,6 +89,7 @@ class FormVentilation extends Form {
89 89 * @param string $selectedid pcg_type
90 90 * @param string $htmlname of combo list
91 91 * @param int $showempty en empty line
  92 + * @param array $event
92 93 *
93 94 * @return string with HTML select
94 95 */
... ... @@ -121,7 +122,7 @@ class FormVentilation extends Form {
121 122 $label = $obj->account_number . ' - ' . $obj->label;
122 123  
123 124 // Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
124   - // Bacause same account_number can be share between different accounting_system and do have the same meaning
  125 + // Because same account_number can be share between different accounting_system and do have the same meaning
125 126 if (($selectid != '') && $selectid == $obj->rowid) {
126 127 // $out .= '<option value="' . $obj->account_number . '" selected="selected">' . $label . '</option>';
127 128 $out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';
... ...
accountingex/customer/liste.php
... ... @@ -60,6 +60,23 @@ $formventilation = new FormVentilation($db);
60 60  
61 61 llxHeader('', $langs->trans("Ventilation"));
62 62  
  63 +print '<script type="text/javascript">
  64 + $(function () {
  65 + $(\'#select-all\').click(function(event) {
  66 + // Iterate each checkbox
  67 + $(\':checkbox\').each(function() {
  68 + this.checked = true;
  69 + });
  70 + });
  71 + $(\'#unselect-all\').click(function(event) {
  72 + // Iterate each checkbox
  73 + $(\':checkbox\').each(function() {
  74 + this.checked = false;
  75 + });
  76 + });
  77 + });
  78 + </script>';
  79 +
63 80 /*
64 81 * Action
65 82 */
... ... @@ -102,30 +119,26 @@ if ($action == &#39;ventil&#39;) {
102 119  
103 120 $sqlCompte = "SELECT a.rowid, a.account_number, a.label, a.fk_pcg_version";
104 121 $sqlCompte .= " , s.rowid, s.pcg_version";
105   -$sqlCompte .= " FROM ".MAIN_DB_PREFIX."accountingaccount as a, ".MAIN_DB_PREFIX."accounting_system as s";
106   -$sqlCompte .= " WHERE a.fk_pcg_version = s.pcg_version AND s.rowid=".$conf->global->CHARTOFACCOUNTS;
  122 +$sqlCompte .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as a, " . MAIN_DB_PREFIX . "accounting_system as s";
  123 +$sqlCompte .= " WHERE a.fk_pcg_version = s.pcg_version AND s.rowid=" . $conf->global->CHARTOFACCOUNTS;
107 124 $sqlCompte .= " AND a.active = '1'";
108 125 $sqlCompte .= " ORDER BY a.account_number ASC";
109 126  
110 127 $resultCompte = $db->query($sqlCompte);
111   -$cgs = array();
112   -$cgn = array();
113   -if ($resultCompte)
114   -{
  128 +$cgs = array ();
  129 +$cgn = array ();
  130 +if ($resultCompte) {
115 131 $numCompte = $db->num_rows($resultCompte);
116   - $iCompte = 0;
117   -
118   - while ($iCompte < $numCompte)
119   - {
  132 + $iCompte = 0;
  133 +
  134 + while ( $iCompte < $numCompte ) {
120 135 $rowCompte = $db->fetch_row($resultCompte);
121 136 $cgs[$rowCompte[0]] = $rowCompte[1] . ' ' . $rowCompte[2];
122 137 $cgn[$rowCompte[1]] = $rowCompte[0];
123   - $iCompte++;
  138 + $iCompte ++;
124 139 }
125 140 }
126 141  
127   -
128   -
129 142 /*
130 143 * Customer Invoice lines
131 144 */
... ... @@ -152,7 +165,7 @@ $sql .= &quot; LEFT JOIN &quot; . MAIN_DB_PREFIX . &quot;product as p ON p.rowid = l.fk_product
152 165 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number";
153 166 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
154 167 $sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
155   -$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
  168 +$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
156 169 if (! empty($conf->multicompany->enabled)) {
157 170 $sql .= " AND f.entity = '" . $conf->entity . "'";
158 171 }
... ... @@ -185,7 +198,7 @@ if ($result) {
185 198 print '<td align="right">' . $langs->trans("Amount") . '</td>';
186 199 print '<td align="right">' . $langs->trans("AccountAccounting") . '</td>';
187 200 print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
188   - print '<td align="center">' . $langs->trans("Ventilate") . '</td>';
  201 + print '<td align="center">'.$langs->trans("Ventilate").'<BR><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
189 202 print '</tr>';
190 203  
191 204 $facture_static = new Facture($db);
... ... @@ -204,29 +217,20 @@ if ($result) {
204 217  
205 218 if (empty($objp->code_sell)) {
206 219 $code_sell_notset = 'color:red';
207   -
208   - }else {
209   - $code_sell_notset = 'color:blue';
210   -
211   - }
212   -
213   -
214   - if ($objp->type == 1) {
215   - $objp->code_sell2 = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
216   -
217   - } else {
218   -$objp->code_sell2 = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
219   - }
220   -
221   -
222   - if ($objp->type == 1) {
223   - $objp->code_sell2 = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
224   -
225   - } else {
226   - $objp->code_sell2 = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
227   -
228   -
229   -
  220 + } else {
  221 + $code_sell_notset = 'color:blue';
  222 + }
  223 +
  224 + if ($objp->type == 1) {
  225 + $objp->code_sell2 = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
  226 + } else {
  227 + $objp->code_sell2 = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
  228 + }
  229 +
  230 + if ($objp->type == 1) {
  231 + $objp->code_sell2 = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
  232 + } else {
  233 + $objp->code_sell2 = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
230 234 }
231 235  
232 236 print "<tr $bc[$var]>";
... ... @@ -254,15 +258,14 @@ $objp-&gt;code_sell2 = (! empty($conf-&gt;global-&gt;COMPTA_PRODUCT_SOLD_ACCOUNT) ? $conf
254 258 print price($objp->total_ht);
255 259 print '</td>';
256 260  
257   -
258 261 print '<td align="center" style="' . $code_sell_notset . '">';
259 262 print $objp->code_sell2;
260 263 print '</td>';
261 264  
262 265 // Colonne choix du compte
263 266 print '<td align="center">';
264   - //print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
265   - print $form->selectarray("codeventil[]",$cgs, $cgn[$objp->code_sell2]);
  267 + //print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1,array(),$objp->code_sell2);
  268 + print $form->selectarray("codeventil[]", $cgs, $cgn[$objp->code_sell2]);
266 269 print '</td>';
267 270  
268 271 // Colonne choix ligne a ventiler
... ...