@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | $sortfield = "cf.date_commande"; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -$search_month = GETPOST('search_month'); // Can be '' |
|
| 86 | -$search_year = GETPOST('search_year'); // Can be ''' |
|
| 85 | +$search_month = GETPOST('search_month'); // Can be '' |
|
| 86 | +$search_year = GETPOST('search_year'); // Can be ''' |
|
| 87 | 87 | |
| 88 | 88 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
| 89 | 89 | $search_month = ''; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | $sql .= " WHERE cf.entity IN (".getEntity('product').")"; |
| 243 | 243 | $sql .= " AND cfdi.batch = '".($db->escape($object->batch))."'"; |
| 244 | - $sql .= " AND cfdi.fk_product = " . (int) $object->fk_product; |
|
| 244 | + $sql .= " AND cfdi.fk_product = ".(int) $object->fk_product; |
|
| 245 | 245 | if (!empty($search_month)) { |
| 246 | 246 | $sql .= ' AND MONTH(cf.date_commande) IN ('.$db->sanitize((string) $search_month).')'; |
| 247 | 247 | } |
@@ -82,8 +82,8 @@ |
||
| 82 | 82 | $sortfield = "recep.date_creation"; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -$search_month = GETPOST('search_month'); // Can be '' |
|
| 86 | -$search_year = GETPOST('search_year'); // Can be ''' |
|
| 85 | +$search_month = GETPOST('search_month'); // Can be '' |
|
| 86 | +$search_year = GETPOST('search_year'); // Can be ''' |
|
| 87 | 87 | |
| 88 | 88 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
| 89 | 89 | $search_month = ''; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $id = GETPOSTINT('id'); |
| 50 | 50 | $ref = GETPOST('ref', 'alpha'); |
| 51 | 51 | $batch = GETPOST('batch', 'alpha'); |
| 52 | -$objectid = GETPOSTINT('productid'); |
|
| 52 | +$objectid = GETPOSTINT('productid'); |
|
| 53 | 53 | |
| 54 | 54 | // Security check |
| 55 | 55 | $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | $sortfield = "exp.date_creation"; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -$search_month = GETPOST('search_month'); // Can be '' |
|
| 86 | -$search_year = GETPOST('search_year'); // Can be ''' |
|
| 85 | +$search_month = GETPOST('search_month'); // Can be '' |
|
| 86 | +$search_year = GETPOST('search_year'); // Can be ''' |
|
| 87 | 87 | |
| 88 | 88 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
| 89 | 89 | $search_month = ''; |
@@ -76,8 +76,8 @@ |
||
| 76 | 76 | $sortfield = "c.date_valid"; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -$search_month = GETPOST('search_month'); // Can be '' |
|
| 80 | -$search_year = GETPOST('search_year'); // Can be ''' |
|
| 79 | +$search_month = GETPOST('search_month'); // Can be '' |
|
| 80 | +$search_year = GETPOST('search_year'); // Can be ''' |
|
| 81 | 81 | |
| 82 | 82 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
| 83 | 83 | $search_month = ''; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $hookmanager->initHooks(array('warehousecard', 'stocklist', 'globalcard')); |
| 86 | 86 | |
| 87 | 87 | // Security check |
| 88 | -$result=restrictedArea($user, 'stock', $id, 'entrepot&stock'); |
|
| 88 | +$result = restrictedArea($user, 'stock', $id, 'entrepot&stock'); |
|
| 89 | 89 | |
| 90 | 90 | $object = new Entrepot($db); |
| 91 | 91 | $extrafields = new ExtraFields($db); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | setEventMessages($object->error, $object->errors, 'errors'); |
| 254 | 254 | } |
| 255 | 255 | } elseif ($action == 'update_extras' && $permissiontoeditextra) { |
| 256 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 256 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 257 | 257 | |
| 258 | 258 | $attribute_name = GETPOST('attribute', 'aZ09'); |
| 259 | 259 | |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public $picto = 'inventory'; |
| 55 | 55 | |
| 56 | - const STATUS_DRAFT = 0; // Draft |
|
| 57 | - const STATUS_VALIDATED = 1; // Inventory is in process |
|
| 58 | - const STATUS_RECORDED = 2; // Inventory is finisged. Stock movement has been recorded. |
|
| 59 | - const STATUS_CANCELED = 9; // Canceled |
|
| 56 | + const STATUS_DRAFT = 0; // Draft |
|
| 57 | + const STATUS_VALIDATED = 1; // Inventory is in process |
|
| 58 | + const STATUS_RECORDED = 2; // Inventory is finisged. Stock movement has been recorded. |
|
| 59 | + const STATUS_CANCELED = 9; // Canceled |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'fk_warehouse' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php', 'label' => 'Warehouse', 'visible' => 1, 'enabled' => 1, 'position' => 30, 'index' => 1, 'help' => 'InventoryForASpecificWarehouse', 'picto' => 'stock', 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist' => 'tdoverflowmax150'), |
| 97 | 97 | 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php', 'label' => 'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible' => 1, 'enabled' => 1, 'position' => 32, 'index' => 1, 'help' => 'InventoryForASpecificProduct', 'picto' => 'product', 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist' => 'tdoverflowmax150'), |
| 98 | 98 | 'categories_product' => array('type' => 'chkbxlst:categorie:label:rowid::type=0:0:', 'label' => 'OrProductsWithCategories', 'visible' => 3, 'enabled' => 1, 'position' => 33, 'help' => '', 'picto' => 'category', 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx'), |
| 99 | - 'date_inventory' => array('type' => 'date', 'label' => 'DateValue', 'visible' => 1, 'enabled' => 'getDolGlobalInt("STOCK_INVENTORY_ADD_A_VALUE_DATE")', 'position' => 35, 'csslist' => 'nowraponall'), // This date is not used so disabled by default. |
|
| 99 | + 'date_inventory' => array('type' => 'date', 'label' => 'DateValue', 'visible' => 1, 'enabled' => 'getDolGlobalInt("STOCK_INVENTORY_ADD_A_VALUE_DATE")', 'position' => 35, 'csslist' => 'nowraponall'), // This date is not used so disabled by default. |
|
| 100 | 100 | 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 500, 'csslist' => 'nowraponall'), |
| 101 | 101 | 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 501, 'csslist' => 'nowraponall'), |
| 102 | 102 | 'date_validation' => array('type' => 'datetime', 'label' => 'DateValidation', 'visible' => -2, 'enabled' => 1, 'position' => 502, 'csslist' => 'nowraponall'), |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $TChildWarehouses = array(); |
| 288 | 288 | $this->getChildWarehouse($this->fk_warehouse, $TChildWarehouses); |
| 289 | 289 | if (!empty($TChildWarehouses)) { |
| 290 | - $sql .= " OR ps.fk_entrepot IN (" . $this->db->sanitize(implode(',', $TChildWarehouses)) . ")"; |
|
| 290 | + $sql .= " OR ps.fk_entrepot IN (".$this->db->sanitize(implode(',', $TChildWarehouses)).")"; |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | $sql .= ')'; |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $now = dol_now(); |
| 350 | 350 | |
| 351 | 351 | // Clean parameters |
| 352 | - $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated |
|
| 352 | + $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated |
|
| 353 | 353 | $this->title = empty($this->title) ? '' : $this->title; |
| 354 | 354 | $keyforref = $this->table_ref_field; |
| 355 | 355 | $this->ref = $this->$keyforref; |
@@ -415,32 +415,32 @@ discard block |
||
| 415 | 415 | $sql .= ", '".$this->db->idate($now)."'"; |
| 416 | 416 | $sql .= ", ".((int) $this->suspended); |
| 417 | 417 | $sql .= ", '".$this->db->escape($this->libelle)."'"; |
| 418 | - $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
| 419 | - $sql .= ", " .((int) $user->id); |
|
| 420 | - $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
| 421 | - $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
| 422 | - $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
| 423 | - $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
| 424 | - $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
| 425 | - $sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
| 426 | - $sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
| 427 | - $sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
| 428 | - $sql .= ", " . (int) $facfourn_src->fk_multicurrency; |
|
| 418 | + $sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
| 419 | + $sql .= ", ".((int) $user->id); |
|
| 420 | + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
| 421 | + $sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
| 422 | + $sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
| 423 | + $sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
| 424 | + $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
| 425 | + $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
| 426 | + $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
| 427 | + $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
| 428 | + $sql .= ", ".(int) $facfourn_src->fk_multicurrency; |
|
| 429 | 429 | $sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'"; |
| 430 | - $sql .= ", " . (float) $facfourn_src->multicurrency_tx; |
|
| 431 | - $sql .= ", " . (int) $this->usenewprice; |
|
| 432 | - $sql .= ", " . (int) $this->frequency; |
|
| 430 | + $sql .= ", ".(float) $facfourn_src->multicurrency_tx; |
|
| 431 | + $sql .= ", ".(int) $this->usenewprice; |
|
| 432 | + $sql .= ", ".(int) $this->frequency; |
|
| 433 | 433 | $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; |
| 434 | - $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
| 435 | - $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
| 436 | - $sql .= ", " . (int) $this->nb_gen_done; |
|
| 437 | - $sql .= ", " . (int) $this->nb_gen_max; |
|
| 438 | - $sql .= ", " . (int) $this->auto_validate; |
|
| 439 | - $sql .= ", " . (int) $this->generate_pdf; |
|
| 434 | + $sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
| 435 | + $sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
| 436 | + $sql .= ", ".(int) $this->nb_gen_done; |
|
| 437 | + $sql .= ", ".(int) $this->nb_gen_max; |
|
| 438 | + $sql .= ", ".(int) $this->auto_validate; |
|
| 439 | + $sql .= ", ".(int) $this->generate_pdf; |
|
| 440 | 440 | $sql .= ')'; |
| 441 | 441 | |
| 442 | 442 | if ($this->db->query($sql)) { |
| 443 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec'); |
|
| 443 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec'); |
|
| 444 | 444 | |
| 445 | 445 | // Fields used into addline later |
| 446 | 446 | $this->fk_multicurrency = $facfourn_src->fk_multicurrency; |
@@ -582,47 +582,47 @@ discard block |
||
| 582 | 582 | $error = 0; |
| 583 | 583 | |
| 584 | 584 | $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET"; |
| 585 | - $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ; |
|
| 585 | + $sql .= " titre = '".(!empty($this->title) ? $this->db->escape($this->title) : "")."',"; |
|
| 586 | 586 | $sql .= " subtype=".(isset($this->subtype) ? (int) $this->subtype : "NULL").","; |
| 587 | - $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
| 588 | - $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
|
| 587 | + $sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
| 588 | + $sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).','; |
|
| 589 | 589 | if (!empty($this->socid) && $this->socid > 0) { |
| 590 | - $sql .= " fk_soc = ". ((int) $this->socid). ','; |
|
| 590 | + $sql .= " fk_soc = ".((int) $this->socid).','; |
|
| 591 | 591 | } elseif (!empty($this->fk_soc) && $this->fk_soc > 0) { // For backward compatibility |
| 592 | - $sql .= " fk_soc = ". ((int) $this->fk_soc). ','; |
|
| 592 | + $sql .= " fk_soc = ".((int) $this->fk_soc).','; |
|
| 593 | 593 | } |
| 594 | - $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
|
| 595 | - $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
|
| 596 | - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
|
| 597 | - $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; |
|
| 598 | - $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; |
|
| 599 | - $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ','; |
|
| 600 | - $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ','; |
|
| 601 | - $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ','; |
|
| 602 | - $sql .= " fk_user_modif = ". ((int) $user->id) . ','; |
|
| 603 | - $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ','; |
|
| 604 | - $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ','; |
|
| 605 | - $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ','; |
|
| 606 | - $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ','; |
|
| 607 | - $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ','; |
|
| 608 | - $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',"; |
|
| 609 | - $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',"; |
|
| 610 | - $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ","; |
|
| 611 | - $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ','; |
|
| 612 | - $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ","; |
|
| 613 | - $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ','; |
|
| 614 | - $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ','; |
|
| 615 | - $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ','; |
|
| 616 | - $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ','; |
|
| 617 | - $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ','; |
|
| 618 | - $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ','; |
|
| 619 | - $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',"; |
|
| 620 | - $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ','; |
|
| 621 | - $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ','; |
|
| 622 | - $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ','; |
|
| 623 | - $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ','; |
|
| 624 | - $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
| 625 | - $sql .= " WHERE rowid = ". (int) $this->id; |
|
| 594 | + $sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).','; |
|
| 595 | + $sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').","; |
|
| 596 | + $sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').','; |
|
| 597 | + $sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).','; |
|
| 598 | + $sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).','; |
|
| 599 | + $sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).','; |
|
| 600 | + $sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).','; |
|
| 601 | + $sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).','; |
|
| 602 | + $sql .= " fk_user_modif = ".((int) $user->id).','; |
|
| 603 | + $sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').','; |
|
| 604 | + $sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').','; |
|
| 605 | + $sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').','; |
|
| 606 | + $sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').','; |
|
| 607 | + $sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').','; |
|
| 608 | + $sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',"; |
|
| 609 | + $sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',"; |
|
| 610 | + $sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').","; |
|
| 611 | + $sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').','; |
|
| 612 | + $sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').","; |
|
| 613 | + $sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).','; |
|
| 614 | + $sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).','; |
|
| 615 | + $sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).','; |
|
| 616 | + $sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).','; |
|
| 617 | + $sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).','; |
|
| 618 | + $sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).','; |
|
| 619 | + $sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',"; |
|
| 620 | + $sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').','; |
|
| 621 | + $sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').','; |
|
| 622 | + $sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).','; |
|
| 623 | + $sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).','; |
|
| 624 | + $sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
| 625 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 626 | 626 | |
| 627 | 627 | $this->db->begin(); |
| 628 | 628 | |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; |
| 684 | 684 | $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; |
| 685 | 685 | if ($rowid) { |
| 686 | - $sql .= ' AND f.rowid='. (int) $rowid; |
|
| 686 | + $sql .= ' AND f.rowid='.(int) $rowid; |
|
| 687 | 687 | } elseif ($ref) { |
| 688 | 688 | $sql .= " AND f.titre='".$this->db->escape($ref)."'"; |
| 689 | 689 | } else { |
@@ -700,14 +700,14 @@ discard block |
||
| 700 | 700 | $this->id = $obj->rowid; |
| 701 | 701 | $this->titre = $obj->title; |
| 702 | 702 | $this->title = $obj->title; |
| 703 | - $this->subtype = $obj->subtype; |
|
| 703 | + $this->subtype = $obj->subtype; |
|
| 704 | 704 | $this->ref = $obj->title; |
| 705 | 705 | $this->ref_supplier = $obj->ref_supplier; |
| 706 | 706 | $this->entity = $obj->entity; |
| 707 | 707 | $this->socid = $obj->fk_soc; |
| 708 | 708 | $this->date_creation = $obj->datec; |
| 709 | 709 | $this->date_modification = $obj->tms; |
| 710 | - $this->status = $obj->suspended; |
|
| 710 | + $this->status = $obj->suspended; |
|
| 711 | 711 | $this->suspended = $obj->suspended; |
| 712 | 712 | $this->libelle = $obj->label; |
| 713 | 713 | $this->label = $obj->label; |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
| 819 | 819 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
| 820 | 820 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
| 821 | - $sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id; |
|
| 821 | + $sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id; |
|
| 822 | 822 | $sql .= ' ORDER BY l.rang'; |
| 823 | 823 | |
| 824 | 824 | dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG); |
@@ -840,9 +840,9 @@ discard block |
||
| 840 | 840 | $line->label = $objp->label; |
| 841 | 841 | $line->description = $objp->line_desc; |
| 842 | 842 | $line->desc = $objp->line_desc; |
| 843 | - $line->pu_ht = $objp->pu_ht; // deprecated |
|
| 843 | + $line->pu_ht = $objp->pu_ht; // deprecated |
|
| 844 | 844 | $line->subprice = $objp->pu_ht; |
| 845 | - $line->pu_ttc = $objp->pu_ttc; // deprecated |
|
| 845 | + $line->pu_ttc = $objp->pu_ttc; // deprecated |
|
| 846 | 846 | $line->subprice_ttc = $objp->pu_ttc; |
| 847 | 847 | $line->qty = $objp->qty; |
| 848 | 848 | $line->remise_percent = $objp->remise_percent; |
@@ -861,14 +861,14 @@ discard block |
||
| 861 | 861 | $line->product_type = $objp->product_type; |
| 862 | 862 | $line->date_start = $this->db->jdate($objp->date_start); |
| 863 | 863 | $line->date_end = $this->db->jdate($objp->date_end); |
| 864 | - $line->info_bits = $objp->info_bits ; |
|
| 864 | + $line->info_bits = $objp->info_bits; |
|
| 865 | 865 | $line->special_code = $objp->special_code; |
| 866 | 866 | $line->rang = $objp->rang; |
| 867 | 867 | $line->fk_unit = $objp->fk_unit; |
| 868 | 868 | $line->import_key = $objp->import_key; |
| 869 | 869 | $line->fk_user_author = $objp->fk_user_author; |
| 870 | 870 | $line->fk_user_modif = $objp->fk_user_modif; |
| 871 | - $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
| 871 | + $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
| 872 | 872 | $line->fk_multicurrency = $objp->fk_multicurrency; |
| 873 | 873 | $line->multicurrency_code = $objp->multicurrency_code; |
| 874 | 874 | $line->multicurrency_subprice = $objp->multicurrency_subprice; |
@@ -912,11 +912,11 @@ discard block |
||
| 912 | 912 | $main = MAIN_DB_PREFIX.'facture_fourn_det_rec'; |
| 913 | 913 | $ef = $main."_extrafields"; |
| 914 | 914 | |
| 915 | - $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")"; |
|
| 916 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid; |
|
| 915 | + $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")"; |
|
| 916 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid; |
|
| 917 | 917 | |
| 918 | 918 | if ($this->db->query($sqlef) && $this->db->query($sql)) { |
| 919 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid; |
|
| 919 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid; |
|
| 920 | 920 | dol_syslog($sql); |
| 921 | 921 | if ($this->db->query($sql)) { |
| 922 | 922 | // Delete linked object |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | } |
| 946 | 946 | // End call triggers |
| 947 | 947 | } |
| 948 | - if (! $error) { |
|
| 948 | + if (!$error) { |
|
| 949 | 949 | $this->db->commit(); |
| 950 | 950 | return 1; |
| 951 | 951 | } else { |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | } |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | - $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec ('; |
|
| 1060 | + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec ('; |
|
| 1061 | 1061 | $sql .= 'fk_facture_fourn'; |
| 1062 | 1062 | $sql .= ', fk_product'; |
| 1063 | 1063 | $sql .= ', ref'; |
@@ -1089,46 +1089,46 @@ discard block |
||
| 1089 | 1089 | $sql .= ', fk_user_author'; |
| 1090 | 1090 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
| 1091 | 1091 | $sql .= ') VALUES ('; |
| 1092 | - $sql .= ' ' . (int) $facid; // source supplier invoice id |
|
| 1093 | - $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape((string) $fk_product) . "'" : 'null'); |
|
| 1094 | - $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); |
|
| 1095 | - $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); |
|
| 1096 | - $sql .= ", '" . $this->db->escape($desc) . "'"; |
|
| 1097 | - $sql .= ', ' . price2num($pu_ht); |
|
| 1098 | - $sql .= ', ' . price2num($pu_ttc); |
|
| 1099 | - $sql .= ', ' . price2num($qty); |
|
| 1100 | - $sql .= ', ' . price2num($remise_percent); |
|
| 1092 | + $sql .= ' '.(int) $facid; // source supplier invoice id |
|
| 1093 | + $sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape((string) $fk_product)."'" : 'null'); |
|
| 1094 | + $sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null'); |
|
| 1095 | + $sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null'); |
|
| 1096 | + $sql .= ", '".$this->db->escape($desc)."'"; |
|
| 1097 | + $sql .= ', '.price2num($pu_ht); |
|
| 1098 | + $sql .= ', '.price2num($pu_ttc); |
|
| 1099 | + $sql .= ', '.price2num($qty); |
|
| 1100 | + $sql .= ', '.price2num($remise_percent); |
|
| 1101 | 1101 | $sql .= ', null'; |
| 1102 | - $sql .= ", '" . $this->db->escape($vat_src_code) . "'"; |
|
| 1103 | - $sql .= ', ' . price2num($txtva); |
|
| 1104 | - $sql .= ', ' . price2num($txlocaltax1); |
|
| 1105 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'"; |
|
| 1106 | - $sql .= ', ' . price2num($txlocaltax2); |
|
| 1107 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'"; |
|
| 1108 | - $sql .= ', ' . price2num($total_ht); |
|
| 1109 | - $sql .= ', ' . price2num($total_tva); |
|
| 1110 | - $sql .= ', ' . price2num($total_localtax1); |
|
| 1111 | - $sql .= ', ' . price2num($total_localtax2); |
|
| 1112 | - $sql .= ', ' . price2num($total_ttc); |
|
| 1113 | - $sql .= ', ' . (int) $product_type; |
|
| 1114 | - $sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL'); |
|
| 1115 | - $sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL'); |
|
| 1116 | - $sql .= ', ' . (int) $info_bits; |
|
| 1117 | - $sql .= ', ' . (int) $special_code; |
|
| 1118 | - $sql .= ', ' . (int) $rang; |
|
| 1119 | - $sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL'); |
|
| 1120 | - $sql .= ', ' . (int) $user->id; |
|
| 1121 | - $sql .= ', ' . (int) $this->fk_multicurrency; |
|
| 1122 | - $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
|
| 1123 | - $sql .= ', ' . price2num($pu_ht_devise, 'CU'); |
|
| 1124 | - $sql .= ', ' . price2num($multicurrency_total_ht, 'CT'); |
|
| 1125 | - $sql .= ', ' . price2num($multicurrency_total_tva, 'CT'); |
|
| 1126 | - $sql .= ', ' . price2num($multicurrency_total_ttc, 'CT'); |
|
| 1102 | + $sql .= ", '".$this->db->escape($vat_src_code)."'"; |
|
| 1103 | + $sql .= ', '.price2num($txtva); |
|
| 1104 | + $sql .= ', '.price2num($txlocaltax1); |
|
| 1105 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'"; |
|
| 1106 | + $sql .= ', '.price2num($txlocaltax2); |
|
| 1107 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'"; |
|
| 1108 | + $sql .= ', '.price2num($total_ht); |
|
| 1109 | + $sql .= ', '.price2num($total_tva); |
|
| 1110 | + $sql .= ', '.price2num($total_localtax1); |
|
| 1111 | + $sql .= ', '.price2num($total_localtax2); |
|
| 1112 | + $sql .= ', '.price2num($total_ttc); |
|
| 1113 | + $sql .= ', '.(int) $product_type; |
|
| 1114 | + $sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL'); |
|
| 1115 | + $sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL'); |
|
| 1116 | + $sql .= ', '.(int) $info_bits; |
|
| 1117 | + $sql .= ', '.(int) $special_code; |
|
| 1118 | + $sql .= ', '.(int) $rang; |
|
| 1119 | + $sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL'); |
|
| 1120 | + $sql .= ', '.(int) $user->id; |
|
| 1121 | + $sql .= ', '.(int) $this->fk_multicurrency; |
|
| 1122 | + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; |
|
| 1123 | + $sql .= ', '.price2num($pu_ht_devise, 'CU'); |
|
| 1124 | + $sql .= ', '.price2num($multicurrency_total_ht, 'CT'); |
|
| 1125 | + $sql .= ', '.price2num($multicurrency_total_tva, 'CT'); |
|
| 1126 | + $sql .= ', '.price2num($multicurrency_total_ttc, 'CT'); |
|
| 1127 | 1127 | $sql .= ')'; |
| 1128 | 1128 | |
| 1129 | - dol_syslog(get_class($this). '::addline', LOG_DEBUG); |
|
| 1129 | + dol_syslog(get_class($this).'::addline', LOG_DEBUG); |
|
| 1130 | 1130 | if ($this->db->query($sql)) { |
| 1131 | - $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec'); |
|
| 1131 | + $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec'); |
|
| 1132 | 1132 | $this->update_price(); |
| 1133 | 1133 | $this->id = $facid; |
| 1134 | 1134 | $this->db->commit(); |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | |
| 1180 | 1180 | $facid = $this->id; |
| 1181 | 1181 | |
| 1182 | - dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
| 1182 | + dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
| 1183 | 1183 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
| 1184 | 1184 | |
| 1185 | 1185 | // Check parameters |
@@ -1249,41 +1249,41 @@ discard block |
||
| 1249 | 1249 | $product_type = $product->type; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
| 1253 | - $sql .= ' fk_facture_fourn = ' . ((int) $facid); |
|
| 1254 | - $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
| 1255 | - $sql .= ", ref = '" . $this->db->escape($ref) . "'"; |
|
| 1256 | - $sql .= ", label = '" . $this->db->escape($label) . "'"; |
|
| 1257 | - $sql .= ", description = '" . $this->db->escape($desc) . "'"; |
|
| 1258 | - $sql .= ', pu_ht = ' . price2num($pu_ht); |
|
| 1259 | - $sql .= ', qty = ' . price2num($qty); |
|
| 1260 | - $sql .= ", remise_percent = '" . price2num($remise_percent) . "'"; |
|
| 1261 | - $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'"; |
|
| 1262 | - $sql .= ', tva_tx = ' . price2num($txtva); |
|
| 1263 | - $sql .= ', localtax1_tx = ' . (float) $txlocaltax1; |
|
| 1264 | - $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'"; |
|
| 1265 | - $sql .= ', localtax2_tx = ' . (float) $txlocaltax2; |
|
| 1266 | - $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'"; |
|
| 1267 | - $sql .= ", total_ht = '" . price2num($total_ht) . "'"; |
|
| 1268 | - $sql .= ", total_tva = '" . price2num($total_tva) . "'"; |
|
| 1269 | - $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'"; |
|
| 1270 | - $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'"; |
|
| 1271 | - $sql .= ", total_ttc = '" . price2num($total_ttc) . "'"; |
|
| 1272 | - $sql .= ', product_type = ' . (int) $product_type; |
|
| 1273 | - $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start); |
|
| 1274 | - $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end); |
|
| 1275 | - $sql .= ', info_bits = ' . (int) $info_bits; |
|
| 1276 | - $sql .= ', special_code = ' . (int) $special_code; |
|
| 1277 | - $sql .= ', rang = ' . (int) $rang; |
|
| 1278 | - $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); |
|
| 1279 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
| 1252 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
| 1253 | + $sql .= ' fk_facture_fourn = '.((int) $facid); |
|
| 1254 | + $sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
| 1255 | + $sql .= ", ref = '".$this->db->escape($ref)."'"; |
|
| 1256 | + $sql .= ", label = '".$this->db->escape($label)."'"; |
|
| 1257 | + $sql .= ", description = '".$this->db->escape($desc)."'"; |
|
| 1258 | + $sql .= ', pu_ht = '.price2num($pu_ht); |
|
| 1259 | + $sql .= ', qty = '.price2num($qty); |
|
| 1260 | + $sql .= ", remise_percent = '".price2num($remise_percent)."'"; |
|
| 1261 | + $sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'"; |
|
| 1262 | + $sql .= ', tva_tx = '.price2num($txtva); |
|
| 1263 | + $sql .= ', localtax1_tx = '.(float) $txlocaltax1; |
|
| 1264 | + $sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'"; |
|
| 1265 | + $sql .= ', localtax2_tx = '.(float) $txlocaltax2; |
|
| 1266 | + $sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'"; |
|
| 1267 | + $sql .= ", total_ht = '".price2num($total_ht)."'"; |
|
| 1268 | + $sql .= ", total_tva = '".price2num($total_tva)."'"; |
|
| 1269 | + $sql .= ", total_localtax1 = '".price2num($total_localtax1)."'"; |
|
| 1270 | + $sql .= ", total_localtax2 = '".price2num($total_localtax2)."'"; |
|
| 1271 | + $sql .= ", total_ttc = '".price2num($total_ttc)."'"; |
|
| 1272 | + $sql .= ', product_type = '.(int) $product_type; |
|
| 1273 | + $sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start); |
|
| 1274 | + $sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end); |
|
| 1275 | + $sql .= ', info_bits = '.(int) $info_bits; |
|
| 1276 | + $sql .= ', special_code = '.(int) $special_code; |
|
| 1277 | + $sql .= ', rang = '.(int) $rang; |
|
| 1278 | + $sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null'); |
|
| 1279 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
| 1280 | 1280 | $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise); |
| 1281 | 1281 | $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht); |
| 1282 | 1282 | $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva); |
| 1283 | 1283 | $sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc); |
| 1284 | - $sql .= ' WHERE rowid = ' . (int) $rowid; |
|
| 1284 | + $sql .= ' WHERE rowid = '.(int) $rowid; |
|
| 1285 | 1285 | |
| 1286 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
| 1286 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
| 1287 | 1287 | if ($this->db->query($sql)) { |
| 1288 | 1288 | $this->id = $facid; |
| 1289 | 1289 | $this->update_price(); |
@@ -1373,16 +1373,16 @@ discard block |
||
| 1373 | 1373 | $tmparray = dol_getdate($now); |
| 1374 | 1374 | $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
| 1375 | 1375 | |
| 1376 | - dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation); |
|
| 1376 | + dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation); |
|
| 1377 | 1377 | |
| 1378 | 1378 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec'; |
| 1379 | 1379 | $sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency |
| 1380 | 1380 | $sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')"; |
| 1381 | 1381 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; |
| 1382 | 1382 | $sql .= ' AND suspended = 0'; |
| 1383 | - $sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here |
|
| 1383 | + $sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here |
|
| 1384 | 1384 | if ($restrictioninvoiceid > 0) { |
| 1385 | - $sql .= ' AND rowid = '. (int) $restrictioninvoiceid; |
|
| 1385 | + $sql .= ' AND rowid = '.(int) $restrictioninvoiceid; |
|
| 1386 | 1386 | } |
| 1387 | 1387 | $sql .= $this->db->order('entity', 'ASC'); |
| 1388 | 1388 | if (getDolGlobalInt('NB_REC_FACT_GEN_BY_CALL')) { |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | // Set entity context |
| 1426 | 1426 | $conf->entity = $facturerec->entity; |
| 1427 | 1427 | |
| 1428 | - dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity); |
|
| 1428 | + dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity); |
|
| 1429 | 1429 | |
| 1430 | 1430 | $new_fac_fourn = new FactureFournisseur($this->db); |
| 1431 | 1431 | $new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice |
@@ -1433,7 +1433,7 @@ discard block |
||
| 1433 | 1433 | |
| 1434 | 1434 | $new_fac_fourn->type = self::TYPE_STANDARD; |
| 1435 | 1435 | $new_fac_fourn->subtype = $facturerec->subtype; |
| 1436 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
| 1436 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
| 1437 | 1437 | $new_fac_fourn->status = self::STATUS_DRAFT; |
| 1438 | 1438 | $new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. |
| 1439 | 1439 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1442,7 +1442,7 @@ discard block |
||
| 1442 | 1442 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
| 1443 | 1443 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
| 1444 | 1444 | $new_fac_fourn->label = $facturerec->label; |
| 1445 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
| 1445 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
| 1446 | 1446 | |
| 1447 | 1447 | $invoiceidgenerated = $new_fac_fourn->create($user); |
| 1448 | 1448 | $laststep = "Create invoiceidgenerated $invoiceidgenerated"; |
@@ -1472,9 +1472,9 @@ discard block |
||
| 1472 | 1472 | } |
| 1473 | 1473 | } else { |
| 1474 | 1474 | $error++; |
| 1475 | - $this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n"; |
|
| 1476 | - $this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity; |
|
| 1477 | - dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity); |
|
| 1475 | + $this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n"; |
|
| 1476 | + $this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity; |
|
| 1477 | + dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity); |
|
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | if (!$error && $invoiceidgenerated >= 0) { |
@@ -1483,12 +1483,12 @@ discard block |
||
| 1483 | 1483 | $nextDate = $facturerec->getNextDate(); |
| 1484 | 1484 | $facturerec->date_when = (($nextDate === false) ? null : $nextDate); |
| 1485 | 1485 | $facturerec->update($user); |
| 1486 | - $this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title); |
|
| 1487 | - dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->title. ' is finished with a success generation'); |
|
| 1486 | + $this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title); |
|
| 1487 | + dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->title.' is finished with a success generation'); |
|
| 1488 | 1488 | $nb_create++; |
| 1489 | 1489 | $this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->title)."\n"; |
| 1490 | 1490 | } else { |
| 1491 | - $this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id=' .$facturerec->id. ', title=' .$facturerec->title); |
|
| 1491 | + $this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id='.$facturerec->id.', title='.$facturerec->title); |
|
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | 1494 | $parameters = array( |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | } |
| 1583 | 1583 | $result .= $linkend; |
| 1584 | 1584 | global $action; |
| 1585 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1585 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1586 | 1586 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1587 | 1587 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1588 | 1588 | if ($reshook > 0) { |
@@ -1762,8 +1762,8 @@ discard block |
||
| 1762 | 1762 | $prodids = array(); |
| 1763 | 1763 | |
| 1764 | 1764 | $sql = 'SELECT rowid'; |
| 1765 | - $sql .= ' FROM ' .MAIN_DB_PREFIX. 'product'; |
|
| 1766 | - $sql .= ' WHERE entity IN (' .getEntity('product'). ')'; |
|
| 1765 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'product'; |
|
| 1766 | + $sql .= ' WHERE entity IN ('.getEntity('product').')'; |
|
| 1767 | 1767 | $sql .= $this->db->plimit(100); |
| 1768 | 1768 | |
| 1769 | 1769 | $resql = $this->db->query($sql); |
@@ -1798,11 +1798,11 @@ discard block |
||
| 1798 | 1798 | |
| 1799 | 1799 | if (empty($option) || $option != 'nolines') { |
| 1800 | 1800 | // Lines |
| 1801 | - $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 1801 | + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 1802 | 1802 | $xnbp = 0; |
| 1803 | 1803 | while ($xnbp < $nbp) { |
| 1804 | 1804 | $line = new FactureLigne($this->db); |
| 1805 | - $line->desc = $langs->trans('Description'). ' ' .$xnbp; |
|
| 1805 | + $line->desc = $langs->trans('Description').' '.$xnbp; |
|
| 1806 | 1806 | $line->qty = 1; |
| 1807 | 1807 | $line->subprice = 100; |
| 1808 | 1808 | $line->tva_tx = 19.6; |
@@ -1849,7 +1849,7 @@ discard block |
||
| 1849 | 1849 | |
| 1850 | 1850 | // Add a line "offered" |
| 1851 | 1851 | $line = new FactureLigne($this->db); |
| 1852 | - $line->desc = $langs->trans('Description'). ' (offered line)'; |
|
| 1852 | + $line->desc = $langs->trans('Description').' (offered line)'; |
|
| 1853 | 1853 | $line->qty = 1; |
| 1854 | 1854 | $line->subprice = 100; |
| 1855 | 1855 | $line->tva_tx = 19.6; |
@@ -1898,12 +1898,12 @@ discard block |
||
| 1898 | 1898 | public function setFrequencyAndUnit($frequency, $unit) |
| 1899 | 1899 | { |
| 1900 | 1900 | if (!$this->table_element) { |
| 1901 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR); |
|
| 1901 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR); |
|
| 1902 | 1902 | return -1; |
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 1905 | 1905 | if (!empty($frequency) && empty($unit)) { |
| 1906 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR); |
|
| 1906 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR); |
|
| 1907 | 1907 | return -2; |
| 1908 | 1908 | } |
| 1909 | 1909 | |
@@ -1942,11 +1942,11 @@ discard block |
||
| 1942 | 1942 | return -1; |
| 1943 | 1943 | } |
| 1944 | 1944 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 1945 | - $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
| 1945 | + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
| 1946 | 1946 | if ($increment_nb_gen_done > 0) { |
| 1947 | 1947 | $sql .= ", nb_gen_done = nb_gen_done + 1"; |
| 1948 | 1948 | } |
| 1949 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 1949 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 1950 | 1950 | |
| 1951 | 1951 | dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG); |
| 1952 | 1952 | |
@@ -1980,8 +1980,8 @@ discard block |
||
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | 1982 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 1983 | - $sql .= " SET nb_gen_max = ". (int) $nb; |
|
| 1984 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 1983 | + $sql .= " SET nb_gen_max = ".(int) $nb; |
|
| 1984 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 1985 | 1985 | |
| 1986 | 1986 | dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG); |
| 1987 | 1987 | |
@@ -2009,7 +2009,7 @@ discard block |
||
| 2009 | 2009 | |
| 2010 | 2010 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 2011 | 2011 | $sql .= " SET auto_validate = ".((int) $validate); |
| 2012 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 2012 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 2013 | 2013 | |
| 2014 | 2014 | dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG); |
| 2015 | 2015 | |
@@ -2036,8 +2036,8 @@ discard block |
||
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | 2038 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 2039 | - $sql .= " SET generate_pdf = ". (int) $validate; |
|
| 2040 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 2039 | + $sql .= " SET generate_pdf = ".(int) $validate; |
|
| 2040 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 2041 | 2041 | |
| 2042 | 2042 | dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG); |
| 2043 | 2043 | |
@@ -2065,7 +2065,7 @@ discard block |
||
| 2065 | 2065 | |
| 2066 | 2066 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 2067 | 2067 | $sql .= " SET modelpdf = '".$this->db->escape($model)."'"; |
| 2068 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 2068 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 2069 | 2069 | |
| 2070 | 2070 | dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG); |
| 2071 | 2071 | |
@@ -226,10 +226,10 @@ |
||
| 226 | 226 | $sqlsearchpackage .= ' WHERE entity IN ('.getEntity('productsupplierprice').")"; |
| 227 | 227 | $sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product); |
| 228 | 228 | $sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'"; |
| 229 | - $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified |
|
| 230 | - $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified |
|
| 229 | + $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified |
|
| 230 | + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified |
|
| 231 | 231 | $sqlsearchpackage .= " AND fk_soc = ".((int) $objp->socid); |
| 232 | - $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
| 232 | + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
| 233 | 233 | $sqlsearchpackage .= " LIMIT 1"; |
| 234 | 234 | |
| 235 | 235 | $resqlsearchpackage = $this->db->query($sqlsearchpackage); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $utf8_path = preg_replace('/([\\/]+)$/', '', $utf8_path); |
| 123 | 123 | |
| 124 | 124 | if (preg_match('/\*/', $utf8_path)) { |
| 125 | - $utf8_path_array = glob($utf8_path, GLOB_ONLYDIR); // This scan dir for files. If file does not exists, return empty. |
|
| 125 | + $utf8_path_array = glob($utf8_path, GLOB_ONLYDIR); // This scan dir for files. If file does not exists, return empty. |
|
| 126 | 126 | //$os_path_array = dol_dir_list($utf8_path); |
| 127 | 127 | } else { |
| 128 | 128 | $utf8_path_array = array($utf8_path); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | 'types' => $types, |
| 141 | 141 | 'recursive' => $recursive, |
| 142 | 142 | 'filter' => $filter, |
| 143 | - 'excludefilter' => $exclude_array, // Already converted to array. |
|
| 143 | + 'excludefilter' => $exclude_array, // Already converted to array. |
|
| 144 | 144 | 'sortcriteria' => $sortcriteria, |
| 145 | 145 | 'sortorder' => $sortorder, |
| 146 | 146 | 'loaddate' => $loaddate, |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $utf8_file = $os_file; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - $utf8_fullpathfile = $utf8_path_cursor."/".$utf8_file; // Temp variable for speed |
|
| 176 | + $utf8_fullpathfile = $utf8_path_cursor."/".$utf8_file; // Temp variable for speed |
|
| 177 | 177 | |
| 178 | 178 | // Check if file is qualified |
| 179 | 179 | $qualified = 1; |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | if (is_array($filter)) { |
| 210 | 210 | $chunks = array_chunk($filter, 500); |
| 211 | 211 | foreach ($chunks as $chunk) { |
| 212 | - $testpregmatch = preg_match('/'.implode('|', $chunk).'/i', $utf8_file); // May failed if $filter too large |
|
| 212 | + $testpregmatch = preg_match('/'.implode('|', $chunk).'/i', $utf8_file); // May failed if $filter too large |
|
| 213 | 213 | if ($testpregmatch) { |
| 214 | 214 | break; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | } else { |
| 218 | - $testpregmatch = preg_match('/'.$filter.'/i', $utf8_file); // May failed if $filter too large |
|
| 218 | + $testpregmatch = preg_match('/'.$filter.'/i', $utf8_file); // May failed if $filter too large |
|
| 219 | 219 | } |
| 220 | 220 | if ($testpregmatch) { |
| 221 | 221 | $qualifiedforfilter = 1; |
@@ -264,13 +264,13 @@ discard block |
||
| 264 | 264 | if (is_array($filter)) { |
| 265 | 265 | $chunks = array_chunk($filter, 500); |
| 266 | 266 | foreach ($chunks as $chunk) { |
| 267 | - $testpregmatch = preg_match('/'.implode('|', $chunk).'/i', $utf8_file); // May failed if $filter too large |
|
| 267 | + $testpregmatch = preg_match('/'.implode('|', $chunk).'/i', $utf8_file); // May failed if $filter too large |
|
| 268 | 268 | if ($testpregmatch) { |
| 269 | 269 | break; |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | } else { |
| 273 | - $testpregmatch = preg_match('/'.$filter.'/i', $utf8_file); // May failed if $filter too large |
|
| 273 | + $testpregmatch = preg_match('/'.$filter.'/i', $utf8_file); // May failed if $filter too large |
|
| 274 | 274 | } |
| 275 | 275 | if ($testpregmatch) { |
| 276 | 276 | $qualifiedforfilter = 1; |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | // Recursive function to copy all subdirectories and contents: |
| 1029 | 1029 | if (is_dir($ossrcfile)) { |
| 1030 | 1030 | $dir_handle = opendir($ossrcfile); |
| 1031 | - $tmpresult = 0; // Initialised before loop to keep old behavior, may be needed inside loop |
|
| 1031 | + $tmpresult = 0; // Initialised before loop to keep old behavior, may be needed inside loop |
|
| 1032 | 1032 | while ($file = readdir($dir_handle)) { |
| 1033 | 1033 | if ($file != "." && $file != ".." && !is_link($ossrcfile."/".$file)) { |
| 1034 | 1034 | if (is_dir($ossrcfile."/".$file)) { |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | if (!empty($moreinfo) && !empty($moreinfo['gen_or_uploaded'])) { |
| 1213 | 1213 | $ecmfile->gen_or_uploaded = $moreinfo['gen_or_uploaded']; |
| 1214 | 1214 | } else { |
| 1215 | - $ecmfile->gen_or_uploaded = 'unknown'; // 'generated', 'uploaded', 'api' |
|
| 1215 | + $ecmfile->gen_or_uploaded = 'unknown'; // 'generated', 'uploaded', 'api' |
|
| 1216 | 1216 | } |
| 1217 | 1217 | if (!empty($moreinfo) && !empty($moreinfo['description'])) { |
| 1218 | 1218 | $ecmfile->description = $moreinfo['description']; // indexed content |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | if (!empty($moreinfo) && !empty($moreinfo['cover'])) { |
| 1243 | 1243 | $ecmfile->cover = $moreinfo['cover']; |
| 1244 | 1244 | } |
| 1245 | - if (! empty($entity)) { |
|
| 1245 | + if (!empty($entity)) { |
|
| 1246 | 1246 | $ecmfile->entity = $entity; |
| 1247 | 1247 | } |
| 1248 | 1248 | |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | |
| 1569 | 1569 | if ($return) { |
| 1570 | 1570 | dolChmod($file_name_osencoded); |
| 1571 | - dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=" . getDolGlobalString('MAIN_UMASK'), LOG_DEBUG); |
|
| 1571 | + dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".getDolGlobalString('MAIN_UMASK'), LOG_DEBUG); |
|
| 1572 | 1572 | return $successcode; // Success |
| 1573 | 1573 | } else { |
| 1574 | 1574 | dol_syslog("Files.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR); |
@@ -1634,7 +1634,7 @@ discard block |
||
| 1634 | 1634 | $ok = true; |
| 1635 | 1635 | $globencoded = str_replace('[', '\[', $file_osencoded); |
| 1636 | 1636 | $globencoded = str_replace(']', '\]', $globencoded); |
| 1637 | - $listofdir = glob($globencoded); // This scan dir for files. If file does not exists, return empty. |
|
| 1637 | + $listofdir = glob($globencoded); // This scan dir for files. If file does not exists, return empty. |
|
| 1638 | 1638 | |
| 1639 | 1639 | if (!empty($listofdir) && is_array($listofdir)) { |
| 1640 | 1640 | foreach ($listofdir as $filename) { |
@@ -2116,7 +2116,7 @@ discard block |
||
| 2116 | 2116 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
| 2117 | 2117 | $maxheightmini = $tmparraysize['maxheightmini']; |
| 2118 | 2118 | //$quality = $tmparraysize['quality']; |
| 2119 | - $quality = 50; // For thumbs, we force quality to 50 |
|
| 2119 | + $quality = 50; // For thumbs, we force quality to 50 |
|
| 2120 | 2120 | |
| 2121 | 2121 | // Generate thumbs. |
| 2122 | 2122 | if ($generatethumbs) { |
@@ -2310,7 +2310,7 @@ discard block |
||
| 2310 | 2310 | if (isset($object->table_element)) { |
| 2311 | 2311 | $ecmfile->src_object_type = $object->table_element; |
| 2312 | 2312 | } else { |
| 2313 | - dol_syslog('Error: object ' . get_class($object) . ' has no table_element attribute.'); |
|
| 2313 | + dol_syslog('Error: object '.get_class($object).' has no table_element attribute.'); |
|
| 2314 | 2314 | return -1; |
| 2315 | 2315 | } |
| 2316 | 2316 | if (isset($object->src_object_description)) { |
@@ -2464,9 +2464,9 @@ discard block |
||
| 2464 | 2464 | if (!$error) { |
| 2465 | 2465 | $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'ecm_files'; |
| 2466 | 2466 | if (isset($object->entity)) { |
| 2467 | - $sql .= ' WHERE entity = ' . ((int) $object->entity); |
|
| 2467 | + $sql .= ' WHERE entity = '.((int) $object->entity); |
|
| 2468 | 2468 | } else { |
| 2469 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); |
|
| 2469 | + $sql .= ' WHERE entity = '.((int) $conf->entity); |
|
| 2470 | 2470 | } |
| 2471 | 2471 | $sql .= " AND filepath = '".$db->escape($rel_dir)."'"; |
| 2472 | 2472 | if ($file) { |
@@ -2615,9 +2615,9 @@ discard block |
||
| 2615 | 2615 | // Skip directories (they would be added automatically) |
| 2616 | 2616 | if (!$file->isDir()) { |
| 2617 | 2617 | // Get real and relative path for current file |
| 2618 | - $filePath = $file->getPath(); // the full path with filename using the $inputdir root. |
|
| 2618 | + $filePath = $file->getPath(); // the full path with filename using the $inputdir root. |
|
| 2619 | 2619 | $fileName = $file->getFilename(); |
| 2620 | - $fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory. |
|
| 2620 | + $fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory. |
|
| 2621 | 2621 | |
| 2622 | 2622 | //$relativePath = substr($fileFullRealPath, strlen($rootPath) + 1); |
| 2623 | 2623 | $relativePath = substr(($filePath ? $filePath.'/' : '').$fileName, strlen($rootPath) + 1); |
@@ -2889,9 +2889,9 @@ discard block |
||
| 2889 | 2889 | // Skip directories (they would be added automatically) |
| 2890 | 2890 | if (!$file->isDir()) { |
| 2891 | 2891 | // Get real and relative path for current file |
| 2892 | - $filePath = $file->getPath(); // the full path with filename using the $inputdir root. |
|
| 2892 | + $filePath = $file->getPath(); // the full path with filename using the $inputdir root. |
|
| 2893 | 2893 | $fileName = $file->getFilename(); |
| 2894 | - $fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory. |
|
| 2894 | + $fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory. |
|
| 2895 | 2895 | |
| 2896 | 2896 | //$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($fileFullRealPath, strlen($inputdir) + 1); |
| 2897 | 2897 | $relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr(($filePath ? $filePath.'/' : '').$fileName, strlen($inputdir) + 1); |
@@ -3485,7 +3485,7 @@ discard block |
||
| 3485 | 3485 | if ($fuser->hasRight('fournisseur', 'facture', $lire) || preg_match('/^specimen/i', $original_file)) { |
| 3486 | 3486 | $accessallowed = 1; |
| 3487 | 3487 | } |
| 3488 | - $original_file = preg_replace("/payment\//", "", $original_file); // Because the $conf->fournisseur->payment->dir_output already contains the "payment/" |
|
| 3488 | + $original_file = preg_replace("/payment\//", "", $original_file); // Because the $conf->fournisseur->payment->dir_output already contains the "payment/" |
|
| 3489 | 3489 | $original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file; |
| 3490 | 3490 | $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; |
| 3491 | 3491 | } elseif ($modulepart == 'payment') { |
@@ -3653,17 +3653,17 @@ discard block |
||
| 3653 | 3653 | $email_split = explode('@', $_SESSION['email_customer']); |
| 3654 | 3654 | |
| 3655 | 3655 | $sqlprotectagainstexternals = 'SELECT t.rowid, t.fk_soc FROM '.MAIN_DB_PREFIX.'ticket t'; |
| 3656 | - $sqlprotectagainstexternals.= ' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id = t.rowid'; |
|
| 3657 | - $sqlprotectagainstexternals.= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople c ON c.rowid = ec.fk_socpeople'; |
|
| 3658 | - $sqlprotectagainstexternals.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_contact tc ON tc.element = "ticket" AND tc.rowid = ec.fk_c_type_contact'; |
|
| 3659 | - $sqlprotectagainstexternals.= ' WHERE t.ref LIKE "'.$db->sanitize($refname).'"'; |
|
| 3660 | - $sqlprotectagainstexternals.= ' AND ('; |
|
| 3661 | - $sqlprotectagainstexternals.= ' ('; |
|
| 3662 | - $sqlprotectagainstexternals.= ' tc.rowid IS NOT NULL'; |
|
| 3663 | - $sqlprotectagainstexternals.= ' AND c.email = "'.$db->sanitize($email_split[0]).'@'.$db->sanitize($email_split[1]).'"'; |
|
| 3664 | - $sqlprotectagainstexternals.= ' )'; |
|
| 3665 | - $sqlprotectagainstexternals.= ' OR t.origin_email = "'.$db->sanitize($email_split[0]).'@'.$db->sanitize($email_split[1]).'"'; |
|
| 3666 | - $sqlprotectagainstexternals.= ' )'; |
|
| 3656 | + $sqlprotectagainstexternals .= ' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id = t.rowid'; |
|
| 3657 | + $sqlprotectagainstexternals .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople c ON c.rowid = ec.fk_socpeople'; |
|
| 3658 | + $sqlprotectagainstexternals .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_contact tc ON tc.element = "ticket" AND tc.rowid = ec.fk_c_type_contact'; |
|
| 3659 | + $sqlprotectagainstexternals .= ' WHERE t.ref LIKE "'.$db->sanitize($refname).'"'; |
|
| 3660 | + $sqlprotectagainstexternals .= ' AND ('; |
|
| 3661 | + $sqlprotectagainstexternals .= ' ('; |
|
| 3662 | + $sqlprotectagainstexternals .= ' tc.rowid IS NOT NULL'; |
|
| 3663 | + $sqlprotectagainstexternals .= ' AND c.email = "'.$db->sanitize($email_split[0]).'@'.$db->sanitize($email_split[1]).'"'; |
|
| 3664 | + $sqlprotectagainstexternals .= ' )'; |
|
| 3665 | + $sqlprotectagainstexternals .= ' OR t.origin_email = "'.$db->sanitize($email_split[0]).'@'.$db->sanitize($email_split[1]).'"'; |
|
| 3666 | + $sqlprotectagainstexternals .= ' )'; |
|
| 3667 | 3667 | } |
| 3668 | 3668 | $original_file = $conf->ticket->multidir_output[$entity].'/'.$original_file; |
| 3669 | 3669 | // If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser |
@@ -4034,7 +4034,7 @@ discard block |
||
| 4034 | 4034 | function archiveOrBackupFile($srcfile, $max_versions = 5, $archivedir = '', $suffix = "v", $moveorcopy = 'move') |
| 4035 | 4035 | { |
| 4036 | 4036 | $base_file_pattern = ($archivedir ? $archivedir : dirname($srcfile)).'/'.basename($srcfile).".".$suffix; |
| 4037 | - $files_in_directory = glob($base_file_pattern . "*"); |
|
| 4037 | + $files_in_directory = glob($base_file_pattern."*"); |
|
| 4038 | 4038 | |
| 4039 | 4039 | // Extract the modification timestamps for each file |
| 4040 | 4040 | $files_with_timestamps = []; |
@@ -4075,7 +4075,7 @@ discard block |
||
| 4075 | 4075 | } |
| 4076 | 4076 | |
| 4077 | 4077 | $timestamp = dol_now('gmt'); |
| 4078 | - $new_backup = $srcfile . ".v" . $timestamp; |
|
| 4078 | + $new_backup = $srcfile.".v".$timestamp; |
|
| 4079 | 4079 | |
| 4080 | 4080 | // Move or copy the original file to the new backup with the timestamp |
| 4081 | 4081 | if ($moveorcopy == 'move') { |