@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
80 | 80 | */ |
81 | - public $fields=array( |
|
81 | + public $fields = array( |
|
82 | 82 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
83 | 83 | 'fk_product_attribute' => array('type'=>'integer:ProductAttribute:variants/class/ProductAttribute.class.php', 'label'=>'ProductAttribute', 'enabled'=>1, 'visible'=>0, 'position'=>10, 'notnull'=>1, 'index'=>1,), |
84 | 84 | 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), |
@@ -160,32 +160,32 @@ discard block |
||
160 | 160 | $error++; |
161 | 161 | } |
162 | 162 | if ($error) { |
163 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
163 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
164 | 164 | return -1; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $this->db->begin(); |
168 | 168 | |
169 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; |
|
169 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; |
|
170 | 170 | $sql .= " fk_product_attribute, ref, value, entity, position"; |
171 | 171 | $sql .= ")"; |
172 | 172 | $sql .= " VALUES ("; |
173 | - $sql .= " " . ((int) $this->fk_product_attribute); |
|
174 | - $sql .= ", '" . $this->db->escape($this->ref) . "'"; |
|
175 | - $sql .= ", '" . $this->db->escape($this->value) . "'"; |
|
176 | - $sql .= ", " . ((int) $this->entity); |
|
177 | - $sql .= ", " . ((int) $this->position); |
|
173 | + $sql .= " ".((int) $this->fk_product_attribute); |
|
174 | + $sql .= ", '".$this->db->escape($this->ref)."'"; |
|
175 | + $sql .= ", '".$this->db->escape($this->value)."'"; |
|
176 | + $sql .= ", ".((int) $this->entity); |
|
177 | + $sql .= ", ".((int) $this->position); |
|
178 | 178 | $sql .= ")"; |
179 | 179 | |
180 | 180 | dol_syslog(__METHOD__, LOG_DEBUG); |
181 | 181 | $resql = $this->db->query($sql); |
182 | 182 | if (!$resql) { |
183 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
183 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
184 | 184 | $error++; |
185 | 185 | } |
186 | 186 | |
187 | 187 | if (!$error) { |
188 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
|
188 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if (!$error && !$notrigger) { |
@@ -226,20 +226,20 @@ discard block |
||
226 | 226 | $error++; |
227 | 227 | } |
228 | 228 | if ($error) { |
229 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
229 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
230 | 230 | return -1; |
231 | 231 | } |
232 | 232 | |
233 | 233 | $sql = "SELECT rowid, fk_product_attribute, ref, value"; |
234 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
235 | - $sql .= " WHERE rowid = " . ((int) $id); |
|
236 | - $sql .= " AND entity IN (" . getEntity('product') . ")"; |
|
234 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
235 | + $sql .= " WHERE rowid = ".((int) $id); |
|
236 | + $sql .= " AND entity IN (".getEntity('product').")"; |
|
237 | 237 | |
238 | 238 | dol_syslog(__METHOD__, LOG_DEBUG); |
239 | 239 | $resql = $this->db->query($sql); |
240 | 240 | if (!$resql) { |
241 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
242 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
241 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
242 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
243 | 243 | return -1; |
244 | 244 | } |
245 | 245 | |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | $sql .= "DISTINCT "; |
275 | 275 | } |
276 | 276 | |
277 | - $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM " . MAIN_DB_PREFIX . "product_attribute_value v "; |
|
277 | + $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM ".MAIN_DB_PREFIX."product_attribute_value v "; |
|
278 | 278 | |
279 | 279 | if ($only_used) { |
280 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
281 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
282 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = c.fk_product_child "; |
|
280 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
281 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
282 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = c.fk_product_child "; |
|
283 | 283 | } |
284 | 284 | |
285 | - $sql .= "WHERE v.fk_product_attribute = " . ((int) $prodattr_id); |
|
285 | + $sql .= "WHERE v.fk_product_attribute = ".((int) $prodattr_id); |
|
286 | 286 | |
287 | 287 | if ($only_used) { |
288 | 288 | $sql .= " AND c2v.rowid IS NOT NULL AND p.tosell = 1"; |
@@ -334,25 +334,25 @@ discard block |
||
334 | 334 | $error++; |
335 | 335 | } |
336 | 336 | if ($error) { |
337 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
337 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
338 | 338 | return -1; |
339 | 339 | } |
340 | 340 | |
341 | 341 | $this->db->begin(); |
342 | 342 | |
343 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
|
343 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; |
|
344 | 344 | |
345 | - $sql .= " fk_product_attribute = " . ((int) $this->fk_product_attribute); |
|
346 | - $sql .= ", ref = '" . $this->db->escape($this->ref) . "'"; |
|
347 | - $sql .= ", value = '" . $this->db->escape($this->value) . "'"; |
|
348 | - $sql .= ", position = " . ((int) $this->position); |
|
345 | + $sql .= " fk_product_attribute = ".((int) $this->fk_product_attribute); |
|
346 | + $sql .= ", ref = '".$this->db->escape($this->ref)."'"; |
|
347 | + $sql .= ", value = '".$this->db->escape($this->value)."'"; |
|
348 | + $sql .= ", position = ".((int) $this->position); |
|
349 | 349 | |
350 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
350 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
351 | 351 | |
352 | 352 | dol_syslog(__METHOD__, LOG_DEBUG); |
353 | 353 | $resql = $this->db->query($sql); |
354 | 354 | if (!$resql) { |
355 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
355 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
356 | 356 | $error++; |
357 | 357 | } |
358 | 358 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $error++; |
396 | 396 | } |
397 | 397 | if ($error) { |
398 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
398 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
399 | 399 | return -1; |
400 | 400 | } |
401 | 401 | |
@@ -419,12 +419,12 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | if (!$error) { |
422 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int) $this->id); |
|
422 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".((int) $this->id); |
|
423 | 423 | |
424 | 424 | dol_syslog(__METHOD__, LOG_DEBUG); |
425 | 425 | $resql = $this->db->query($sql); |
426 | 426 | if (!$resql) { |
427 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
427 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
428 | 428 | $error++; |
429 | 429 | } |
430 | 430 | } |
@@ -457,16 +457,16 @@ discard block |
||
457 | 457 | $error++; |
458 | 458 | } |
459 | 459 | if ($error) { |
460 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
460 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
461 | 461 | return -1; |
462 | 462 | } |
463 | 463 | |
464 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr_val = " . ((int) $this->id); |
|
464 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr_val = ".((int) $this->id); |
|
465 | 465 | |
466 | 466 | dol_syslog(__METHOD__, LOG_DEBUG); |
467 | 467 | $resql = $this->db->query($sql); |
468 | 468 | if (!$resql) { |
469 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
469 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
470 | 470 | return -1; |
471 | 471 | } |
472 | 472 |
@@ -57,7 +57,9 @@ |
||
57 | 57 | |
58 | 58 | // Category |
59 | 59 | $selected_cat = (int) GETPOST('search_categ', 'int'); |
60 | -if ($selected_cat == -1) $selected_cat = ''; |
|
60 | +if ($selected_cat == -1) { |
|
61 | + $selected_cat = ''; |
|
62 | +} |
|
61 | 63 | $subcat = false; |
62 | 64 | if (GETPOST('subcat', 'alpha') === 'yes') { |
63 | 65 | $subcat = true; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | $month_current = dol_print_date(dol_now(), '%m'); |
100 | 100 | $year_start = $year; |
101 | 101 | } |
102 | -$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
103 | -$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
102 | +$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
103 | +$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"), 'tzserver'); // We use timezone of server so report is same from everywhere |
|
104 | 104 | // Quarter |
105 | 105 | if (empty($date_start) || empty($date_end)) { // We define date_start and date_end |
106 | 106 | $q = GETPOST("q", "int") ?GETPOST("q", "int") : 0; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $headerparams = array_merge($commonparams, $headerparams); |
180 | 180 | $tableparams = array_merge($commonparams, $tableparams); |
181 | 181 | |
182 | -$paramslink=""; |
|
182 | +$paramslink = ""; |
|
183 | 183 | foreach ($allparams as $key => $value) { |
184 | 184 | $paramslink .= '&'.$key.'='.$value; |
185 | 185 | } |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $modecompta = "RECETTES-DEPENSES"; |
204 | 204 | } |
205 | 205 | |
206 | -$exportlink=""; |
|
207 | -$namelink=""; |
|
206 | +$exportlink = ""; |
|
207 | +$namelink = ""; |
|
208 | 208 | |
209 | 209 | // Show report header |
210 | 210 | if ($modecompta == "CREANCES-DETTES") { |
@@ -289,7 +289,7 @@ |
||
289 | 289 | // phpcs:enable |
290 | 290 | $this->_Metric = $format['metric']; |
291 | 291 | $this->_Avery_Name = $format['name']; |
292 | - $this->_Avery_Code = empty($format['code'])?'':$format['code']; |
|
292 | + $this->_Avery_Code = empty($format['code']) ? '' : $format['code']; |
|
293 | 293 | $this->_Margin_Left = $this->convertMetric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc); |
294 | 294 | $this->_Margin_Top = $this->convertMetric($format['marginTop'], $this->_Metric, $this->_Metric_Doc); |
295 | 295 | $this->_X_Space = $this->convertMetric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc); |
@@ -813,7 +813,9 @@ |
||
813 | 813 | |
814 | 814 | // Complete vat rate with code |
815 | 815 | $vatrate = $newinvoiceline->tva_tx; |
816 | - if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')'; |
|
816 | + if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) { |
|
817 | + $vatrate.=' ('.$newinvoiceline->vat_src_code.')'; |
|
818 | + } |
|
817 | 819 | |
818 | 820 | $newinvoiceline->fk_parent_line = $fk_parent_line; |
819 | 821 |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $this->mode_reglement_id = 0; |
462 | 462 | } |
463 | 463 | $this->status = self::STATUS_DRAFT; |
464 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
464 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
465 | 465 | |
466 | 466 | if (!empty($this->multicurrency_code)) { |
467 | 467 | // Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate) |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | $this->mode_reglement_id = 0; |
563 | 563 | } |
564 | 564 | $this->status = self::STATUS_DRAFT; |
565 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
565 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
566 | 566 | |
567 | 567 | $this->linked_objects = $_facrec->linkedObjectsIds; |
568 | 568 | // We do not add link to template invoice or next invoice will be linked to all generated invoices |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | |
808 | 808 | // Complete vat rate with code |
809 | 809 | $vatrate = $newinvoiceline->tva_tx; |
810 | - if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')'; |
|
810 | + if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$newinvoiceline->vat_src_code.')'; |
|
811 | 811 | |
812 | 812 | $newinvoiceline->fk_parent_line = $fk_parent_line; |
813 | 813 | |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $buyprice, |
1038 | 1038 | $_facrec->lines[$i]->label, |
1039 | 1039 | empty($_facrec->lines[$i]->array_options) ?null:$_facrec->lines[$i]->array_options, |
1040 | - 100, // situation percent is undefined on recurring invoice lines |
|
1040 | + 100, // situation percent is undefined on recurring invoice lines |
|
1041 | 1041 | '', |
1042 | 1042 | $_facrec->lines[$i]->fk_unit, |
1043 | 1043 | $_facrec->lines[$i]->multicurrency_subprice, |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | |
1134 | 1134 | $facture->fk_facture_source = $this->fk_facture_source; |
1135 | 1135 | $facture->type = $this->type; |
1136 | - $facture->subtype = $this->subtype; |
|
1136 | + $facture->subtype = $this->subtype; |
|
1137 | 1137 | $facture->socid = $this->socid; |
1138 | 1138 | $facture->date = $this->date; |
1139 | 1139 | $facture->date_pointoftax = $this->date_pointoftax; |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | |
1150 | 1150 | $facture->origin = $this->origin; |
1151 | 1151 | $facture->origin_id = $this->origin_id; |
1152 | - $facture->fk_account = $this->fk_account; |
|
1152 | + $facture->fk_account = $this->fk_account; |
|
1153 | 1153 | |
1154 | 1154 | $facture->lines = $this->lines; // Array of lines of invoice |
1155 | 1155 | $facture->situation_counter = $this->situation_counter; |
@@ -1620,7 +1620,7 @@ discard block |
||
1620 | 1620 | { |
1621 | 1621 | global $conf, $langs, $hookmanager, $action; |
1622 | 1622 | |
1623 | - if (! in_array($origin->element, array('propal', 'commande'))) { |
|
1623 | + if (!in_array($origin->element, array('propal', 'commande'))) { |
|
1624 | 1624 | $origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder'; |
1625 | 1625 | return null; |
1626 | 1626 | } |
@@ -1630,7 +1630,7 @@ discard block |
||
1630 | 1630 | return null; |
1631 | 1631 | } |
1632 | 1632 | |
1633 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
1633 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
1634 | 1634 | |
1635 | 1635 | if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { |
1636 | 1636 | $origin->error = 'ErrorDateIsInFuture'; |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | $deposit->pos_source = $origin->pos_source; |
1675 | 1675 | $deposit->model_pdf = 'crabe'; |
1676 | 1676 | |
1677 | - $modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type; |
|
1677 | + $modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type; |
|
1678 | 1678 | |
1679 | 1679 | if (!empty($conf->global->$modelByTypeConfName)) { |
1680 | 1680 | $deposit->model_pdf = $conf->global->$modelByTypeConfName; |
@@ -1729,10 +1729,10 @@ discard block |
||
1729 | 1729 | continue; |
1730 | 1730 | } |
1731 | 1731 | $TTotalByTva[$line->tva_tx] += $line->total_ttc; |
1732 | - $descriptions[$line->tva_tx] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : ''); |
|
1733 | - $descriptions[$line->tva_tx] .= (!empty($line->product_label) ? $line->product_label . ' - ' : ''); |
|
1734 | - $descriptions[$line->tva_tx] .= $langs->trans('Qty') . ' : ' . $line->qty; |
|
1735 | - $descriptions[$line->tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>'; |
|
1732 | + $descriptions[$line->tva_tx] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : ''); |
|
1733 | + $descriptions[$line->tva_tx] .= (!empty($line->product_label) ? $line->product_label.' - ' : ''); |
|
1734 | + $descriptions[$line->tva_tx] .= $langs->trans('Qty').' : '.$line->qty; |
|
1735 | + $descriptions[$line->tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>'; |
|
1736 | 1736 | } |
1737 | 1737 | |
1738 | 1738 | foreach ($TTotalByTva as $tva => &$total) { |
@@ -1756,10 +1756,10 @@ discard block |
||
1756 | 1756 | $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? |
1757 | 1757 | $tva_tx = $lines[$i]->tva_tx; |
1758 | 1758 | $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $origin->deposit_percent) / 100; |
1759 | - $descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : ''); |
|
1760 | - $descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : ''); |
|
1761 | - $descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty; |
|
1762 | - $descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>'; |
|
1759 | + $descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : ''); |
|
1760 | + $descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : ''); |
|
1761 | + $descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty; |
|
1762 | + $descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>'; |
|
1763 | 1763 | } |
1764 | 1764 | |
1765 | 1765 | if ($totalamount == 0) { |
@@ -1774,11 +1774,11 @@ discard block |
||
1774 | 1774 | continue; |
1775 | 1775 | } |
1776 | 1776 | |
1777 | - $descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref; |
|
1777 | + $descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref; |
|
1778 | 1778 | |
1779 | 1779 | // Hidden conf |
1780 | 1780 | if (!empty($conf->global->INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION) && !empty($descriptions[$tva])) { |
1781 | - $descline .= '<ul>' . $descriptions[$tva] . '</ul>'; |
|
1781 | + $descline .= '<ul>'.$descriptions[$tva].'</ul>'; |
|
1782 | 1782 | } |
1783 | 1783 | |
1784 | 1784 | $addlineResult = $deposit->addline( |
@@ -2040,7 +2040,7 @@ discard block |
||
2040 | 2040 | $label = $langs->trans("Invoice"); |
2041 | 2041 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
2042 | 2042 | } |
2043 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2043 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2044 | 2044 | $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; |
2045 | 2045 | } |
2046 | 2046 | |
@@ -2151,9 +2151,9 @@ discard block |
||
2151 | 2151 | $this->id = $obj->rowid; |
2152 | 2152 | $this->entity = $obj->entity; |
2153 | 2153 | |
2154 | - $this->ref = $obj->ref; |
|
2155 | - $this->ref_client = $obj->ref_client; |
|
2156 | - $this->ref_customer = $obj->ref_client; |
|
2154 | + $this->ref = $obj->ref; |
|
2155 | + $this->ref_client = $obj->ref_client; |
|
2156 | + $this->ref_customer = $obj->ref_client; |
|
2157 | 2157 | $this->ref_ext = $obj->ref_ext; |
2158 | 2158 | $this->type = $obj->type; |
2159 | 2159 | $this->subtype = $obj->subtype; |
@@ -2179,7 +2179,7 @@ discard block |
||
2179 | 2179 | $this->fk_project = $obj->fk_project; |
2180 | 2180 | $this->project = null; // Clear if another value was already set by fetch_projet |
2181 | 2181 | |
2182 | - $this->statut = $obj->status; // deprecated |
|
2182 | + $this->statut = $obj->status; // deprecated |
|
2183 | 2183 | $this->status = $obj->status; |
2184 | 2184 | |
2185 | 2185 | $this->date_lim_reglement = $this->db->jdate($obj->dlr); |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | $this->fk_fac_rec_source = $obj->fk_fac_rec_source; |
2196 | 2196 | $this->note = $obj->note_private; // deprecated |
2197 | 2197 | $this->note_private = $obj->note_private; |
2198 | - $this->note_public = $obj->note_public; |
|
2198 | + $this->note_public = $obj->note_public; |
|
2199 | 2199 | $this->user_creation_id = $obj->fk_user_author; |
2200 | 2200 | $this->user_validation_id = $obj->fk_user_valid; |
2201 | 2201 | $this->user_modification_id = $obj->fk_user_modif; |
@@ -2311,7 +2311,7 @@ discard block |
||
2311 | 2311 | $line->ref = $objp->product_ref; // Ref product |
2312 | 2312 | $line->product_ref = $objp->product_ref; // Ref product |
2313 | 2313 | $line->libelle = $objp->product_label; // deprecated |
2314 | - $line->product_label = $objp->product_label; // Label product |
|
2314 | + $line->product_label = $objp->product_label; // Label product |
|
2315 | 2315 | $line->product_barcode = $objp->product_barcode; // Barcode number product |
2316 | 2316 | $line->product_desc = $objp->product_desc; // Description product |
2317 | 2317 | $line->fk_product_type = $objp->fk_product_type; // Type of product |
@@ -2607,7 +2607,7 @@ discard block |
||
2607 | 2607 | $facligne->rang = 1; |
2608 | 2608 | $linecount = count($this->lines); |
2609 | 2609 | for ($ii = 1; $ii <= $linecount; $ii++) { |
2610 | - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii+1); |
|
2610 | + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); |
|
2611 | 2611 | } |
2612 | 2612 | } |
2613 | 2613 | |
@@ -3183,7 +3183,7 @@ discard block |
||
3183 | 3183 | if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('facture', 'creer')) |
3184 | 3184 | || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('facture', 'invoice_advance', 'validate'))) { |
3185 | 3185 | $this->error = 'Permission denied'; |
3186 | - dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR); |
|
3186 | + dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR); |
|
3187 | 3187 | return -1; |
3188 | 3188 | } |
3189 | 3189 | if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) { |
@@ -3527,7 +3527,7 @@ discard block |
||
3527 | 3527 | // Set new ref and define current status |
3528 | 3528 | if (!$error) { |
3529 | 3529 | $this->ref = $num; |
3530 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
3530 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
3531 | 3531 | $this->status = self::STATUS_VALIDATED; |
3532 | 3532 | $this->date_validation = $now; |
3533 | 3533 | $i = 0; |
@@ -3672,7 +3672,7 @@ discard block |
||
3672 | 3672 | |
3673 | 3673 | if ($error == 0) { |
3674 | 3674 | $old_statut = $this->status; |
3675 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
3675 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
3676 | 3676 | $this->status = self::STATUS_DRAFT; |
3677 | 3677 | |
3678 | 3678 | // Call trigger |
@@ -4003,7 +4003,7 @@ discard block |
||
4003 | 4003 | return -2; |
4004 | 4004 | } |
4005 | 4005 | } else { |
4006 | - $this->errors[]='status of invoice must be Draft to allow use of ->addline()'; |
|
4006 | + $this->errors[] = 'status of invoice must be Draft to allow use of ->addline()'; |
|
4007 | 4007 | dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR); |
4008 | 4008 | return -3; |
4009 | 4009 | } |
@@ -4569,7 +4569,7 @@ discard block |
||
4569 | 4569 | } |
4570 | 4570 | |
4571 | 4571 | if (!empty($addon)) { |
4572 | - dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG); |
|
4572 | + dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG); |
|
4573 | 4573 | |
4574 | 4574 | $mybool = false; |
4575 | 4575 | |
@@ -5639,14 +5639,14 @@ discard block |
||
5639 | 5639 | if (!empty($paymentmode) && $paymentmode != 'all') { |
5640 | 5640 | $sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp"; |
5641 | 5641 | } |
5642 | - $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
5643 | - $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status |
|
5642 | + $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
5643 | + $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status |
|
5644 | 5644 | if ($datetouse == 'invoicedate') { |
5645 | 5645 | $sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'"; |
5646 | 5646 | } else { |
5647 | 5647 | $sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'"; |
5648 | 5648 | } |
5649 | - $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing) |
|
5649 | + $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing) |
|
5650 | 5650 | if (!empty($paymentmode) && $paymentmode != 'all') { |
5651 | 5651 | $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'"; |
5652 | 5652 | } |
@@ -5854,7 +5854,7 @@ discard block |
||
5854 | 5854 | $actioncomm->create($user); |
5855 | 5855 | } |
5856 | 5856 | |
5857 | - $this->db->commit(); // We always commit |
|
5857 | + $this->db->commit(); // We always commit |
|
5858 | 5858 | } |
5859 | 5859 | |
5860 | 5860 | if ($errormesg) { |
@@ -5890,7 +5890,7 @@ discard block |
||
5890 | 5890 | // get date of last validated invoices of same type |
5891 | 5891 | $sql = "SELECT datef"; |
5892 | 5892 | $sql .= " FROM ".MAIN_DB_PREFIX."facture"; |
5893 | - $sql .= " WHERE type = " . (int) $this->type ; |
|
5893 | + $sql .= " WHERE type = ".(int) $this->type; |
|
5894 | 5894 | $sql .= " AND date_valid IS NOT NULL"; |
5895 | 5895 | $sql .= " AND entity IN (".getEntity('invoice').")"; |
5896 | 5896 | $sql .= " ORDER BY datef DESC LIMIT 1"; |
@@ -6080,7 +6080,7 @@ discard block |
||
6080 | 6080 | $objp = $this->db->fetch_object($result); |
6081 | 6081 | |
6082 | 6082 | if (!$objp) { |
6083 | - $this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql; |
|
6083 | + $this->error = 'InvoiceLine with id '.$rowid.' not found sql='.$sql; |
|
6084 | 6084 | return 0; |
6085 | 6085 | } |
6086 | 6086 |
@@ -96,8 +96,14 @@ |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | $daytoparsegmt = dol_now('gmt'); |
99 | -if ($yearofday && $monthofday && $dayofday) $daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt'); // xxxofday is value of day after submit action 'addtime' |
|
100 | -elseif ($year && $month && $day) $daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt'); // this are value submited after submit of action 'submitdateselect' |
|
99 | +if ($yearofday && $monthofday && $dayofday) { |
|
100 | + $daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt'); |
|
101 | +} |
|
102 | +// xxxofday is value of day after submit action 'addtime' |
|
103 | +elseif ($year && $month && $day) { |
|
104 | + $daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt'); |
|
105 | +} |
|
106 | +// this are value submited after submit of action 'submitdateselect' |
|
101 | 107 | |
102 | 108 | if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) { |
103 | 109 | $usertoprocess = $user; |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | // Security check |
54 | 54 | if ($user->socid) $socid = $user->socid; |
55 | 55 | |
56 | -$search_ref = GETPOST('search_ref', 'alpha'); |
|
57 | -$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
58 | -$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); |
|
59 | -$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
56 | +$search_ref = GETPOST('search_ref', 'alpha'); |
|
57 | +$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
58 | +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); |
|
59 | +$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
60 | 60 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
61 | -$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
|
61 | +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
|
62 | 62 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
63 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
64 | -$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
|
65 | -$search_user = GETPOST('search_user', 'alpha'); |
|
63 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
64 | +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
|
65 | +$search_user = GETPOST('search_user', 'alpha'); |
|
66 | 66 | $search_payment_type = GETPOST('search_payment_type'); |
67 | -$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); |
|
67 | +$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); |
|
68 | 68 | $search_bank_account = GETPOST('search_bank_account', 'int'); |
69 | -$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' |
|
69 | +$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' |
|
70 | 70 | |
71 | 71 | $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; |
72 | 72 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | $sql .= natural_search('pndf.rowid', $search_ref); |
199 | 199 | } |
200 | 200 | if ($search_date_start) { |
201 | - $sql .= " AND pndf.datep >= '" . $db->idate($search_date_start) . "'"; |
|
201 | + $sql .= " AND pndf.datep >= '".$db->idate($search_date_start)."'"; |
|
202 | 202 | } |
203 | 203 | if ($search_date_end) { |
204 | - $sql .=" AND pndf.datep <= '" . $db->idate($search_date_end) . "'"; |
|
204 | + $sql .= " AND pndf.datep <= '".$db->idate($search_date_end)."'"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | if ($search_user) { |
@@ -49,7 +49,9 @@ |
||
49 | 49 | $socid = GETPOST('socid', 'int'); |
50 | 50 | |
51 | 51 | // Security check |
52 | -if ($user->socid) $socid = $user->socid; |
|
52 | +if ($user->socid) { |
|
53 | + $socid = $user->socid; |
|
54 | +} |
|
53 | 55 | |
54 | 56 | $search_ref = GETPOST('search_ref', 'alpha'); |
55 | 57 | $search_date_startday = GETPOST('search_date_startday', 'int'); |
@@ -303,7 +303,7 @@ |
||
303 | 303 | $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; |
304 | 304 | } |
305 | 305 | if (preg_match('/_dtend$/', $key)) { |
306 | - $sql .= " AND t.".$db->escape($columnName)." <= '" . $db->idate($search[$key])."'"; |
|
306 | + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | { |
74 | 74 | global $conf; |
75 | 75 | |
76 | - $uselogfile = getDolGlobalInt('DEBUGBAR_USE_LOG_FILE'); |
|
76 | + $uselogfile = getDolGlobalInt('DEBUGBAR_USE_LOG_FILE'); |
|
77 | 77 | |
78 | 78 | if ($uselogfile) { |
79 | 79 | $this->getStorageLogs($this->path); |
@@ -507,7 +507,7 @@ |
||
507 | 507 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
508 | 508 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
509 | 509 | } |
510 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
510 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
511 | 511 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
512 | 512 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; |
513 | 513 | $totalarray['nbfield']++; |