diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 0a57508c271..fbaf68a96d9 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -162,7 +162,7 @@ foreach($dirbarcode as $reldir) { $filebis=$reg[1]; - // Chargement de la classe de codage + // Loading encoding class require_once $newdir.$file; $classname = "mod".ucfirst($filebis); $module = new $classname($db); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 46ca2b9fd87..b3f1d7a5d51 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir) $classname = preg_replace('/\-.*$/','',$classname); if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') { - // Chargement de la classe de numerotation + // Charging the numbering class require_once $dir.$filebis; $module = new $classname($db); diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index c9bf610bd1b..07113231bcc 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -130,7 +130,7 @@ foreach ($dirmodels as $reldir) $classname = preg_replace('/\-.*$/','',$classname); if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') { - // Chargement de la classe de numerotation + // Charging the numbering class require_once $dir.$filebis; $module = new $classname($db); diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index a409d0c8b3f..ea81e63305e 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -221,7 +221,7 @@ if (is_resource($handle)) { if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg)) { - // Chargement de la classe de numerotation + // Charging the numbering class $classname = $reg[1]; require_once $dir.'/'.$file; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 0a13c3e7fab..9ffd7ac6401 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -101,12 +101,12 @@ if ($action == 'update' && $user->rights->categorie->creer) } else { - setEventMessage($categorie->error, 'errors'); + setEventMessages($categorie->error, $categorie->errors, 'errors'); } } else { - setEventMessage($categorie->error, 'errors'); + setEventMessages($categorie->error, $categorie->errors, 'errors'); } } diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 94570d48f3e..98f02c7a742 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -95,7 +95,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'add'; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -128,7 +128,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'edit'; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index bf86c1d496c..39f8d62fb7b 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -122,7 +122,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -137,13 +137,13 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' $result=$object->add_type($newobject,$elementtype); if ($result >= 0) { - setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref)); + setEventMessages($langs->trans("WasAddedSuccessfully",$newobject->ref), null, 'mesgs'); } else { if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings'); + setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings'); } else { diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 24eb117684f..066df5fb39e 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -62,7 +62,7 @@ if ($action == 'builddoc') $result=$cat->write_file(GETPOST('id','int')); if ($result < 0) { - setEventMessage($cat->error, 'errors'); + setEventMessages($cat->error, $cat->errors, 'errors'); } } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2ff7796bfae..2a892033865 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -117,7 +117,7 @@ if (empty($reshook)) { if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { - setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { @@ -129,7 +129,7 @@ if (empty($reshook)) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } $action=''; @@ -141,14 +141,14 @@ if (empty($reshook)) if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // As security measure, we don't allow send from the GUI - setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); - setEventMessage('', 'warnings'); - setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); + setEventMessages('', null, 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $action=''; } else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { - setEventMessage($langs->trans("NotEnoughPermissions"), 'warnings'); + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action=''; } else @@ -351,27 +351,27 @@ if (empty($reshook)) } else { - setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo")); + setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs'); } // Loop finished, set global statut of mail if ($nbko > 0) { $statut=2; // Status 'sent partially' (because at least one error) - if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); - else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); + if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); + else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); } else { if ($nbok >= $num) { $statut=3; // Send to everybody - setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); + setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); } else { $statut=2; // Status 'sent partially' (because not send to everybody) - setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); + setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs'); } } @@ -443,11 +443,11 @@ if (empty($reshook)) $result=$mailfile->sendfile(); if ($result) { - setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2))); + setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)), null, 'mesgs'); } else { - setEventMessage($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, 'errors'); + setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); } $action=''; @@ -488,7 +488,7 @@ if (empty($reshook)) $mesgs[] = $object->error; } - setEventMessage($mesgs, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action="create"; } @@ -518,7 +518,7 @@ if (empty($reshook)) $mesg = $object->error; } - setEventMessage($mesg, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action=""; } @@ -582,7 +582,7 @@ if (empty($reshook)) $mesgs[] =$object->error; } - setEventMessage($mesgs, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action="edit"; } else @@ -597,7 +597,7 @@ if (empty($reshook)) if ($object->id > 0) { $object->valid($user); - setEventMessage($langs->trans("MailingSuccessfullyValidated")); + setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } @@ -628,7 +628,7 @@ if (empty($reshook)) } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -764,18 +764,18 @@ else // You ensure that every user is using its own SMTP server. $linktoadminemailbefore=''; $linktoadminemailend=''; - setEventMessage($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), 'warnings'); - setEventMessage($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), 'warnings'); - if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessage($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), 'warnings'); + setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); + setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); + if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); $_GET["action"]=''; } else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message - setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); - setEventMessage('', 'warnings'); - setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); + setEventMessages('', null, 'warnings'); + setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $_GET["action"]=''; } else diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index cd3ff7b00ee..ad4e3210619 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -80,7 +80,7 @@ if ($action == 'add') //print $dir."\n
"; dol_syslog("Scan directory ".$dir." for modules"); - // Chargement de la classe + // Loading Class $file = $dir."/".$module.".modules.php"; $classname = "mailing_".$module; @@ -100,24 +100,24 @@ if ($action == 'add') } if ($result > 0) { - setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs'); + setEventMessages($langs->trans("XTargetsAdded",$result), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } if ($result == 0) { - setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings'); + setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings'); } if ($result < 0) { - setEventMessage($langs->trans("Error").($obj->error?' '.$obj->error:''),'errors'); + setEventMessages($langs->trans("Error").($obj->error?' '.$obj->error:''), null, 'errors'); } } if (GETPOST('clearlist')) { - // Chargement de la classe + // Loading Class $obj = new MailingTargets($db); $obj->clear_target($id); @@ -267,7 +267,7 @@ if ($object->fetch($id) >= 0) // Loop on each submodule foreach($modulenames as $modulename) { - // Chargement de la classe + // Loading Class $file = $dir.$modulename.".modules.php"; $classname = "mailing_".$modulename; require_once $file; diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 59753ee1904..5904bec0009 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -83,7 +83,7 @@ if (is_resource($handle)) $modulename=$reg[1]; if ($modulename == 'example') continue; - // Chargement de la classe + // Loading Class $file = $dir."/".$modulename.".modules.php"; $classname = "mailing_".$modulename; require_once $file; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bb7e399f28a..822c43f3370 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1546,7 +1546,7 @@ class Form print img_picto($langs->trans("Search"), 'search'); } } - print ''; + print ''; if ($hidelabel == 3) { print img_picto($langs->trans("Search"), 'search'); } @@ -1663,7 +1663,7 @@ class Form require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $num = $this->db->num_rows($result); - $out.=''; $out.=''; $i = 0; diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php index 113f35299ca..ee1c3b8e96c 100644 --- a/htdocs/core/modules/export/modules_export.php +++ b/htdocs/core/modules/export/modules_export.php @@ -64,7 +64,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac { $moduleid=$reg[1]; - // Chargement de la classe + // Loading Class $file = $dir."/export_".$moduleid.".modules.php"; $classname = "Export".ucfirst($moduleid); diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 4fa5052a90a..a27b0fd9426 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -84,7 +84,7 @@ class ModeleImports { $moduleid=$reg[1]; - // Chargement de la classe + // Loading Class $file = $dir."/import_".$moduleid.".modules.php"; $classname = "Import".ucfirst($moduleid); diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 88e4ecc8596..3a3436c71a9 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -107,7 +107,7 @@ class Export if ($enabled) { - // Chargement de la classe + // Loading Class $file = $dir.$modulename.".class.php"; $classname = $modulename; require_once $file; diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index ab833203759..1f34377e6ec 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -56,16 +56,16 @@ create table llx_overwrite_trans transvalue text )ENGINE=innodb; -ALTER TABLE llx_payment_salary ADD COLUMN datec datetime after tms; +ALTER TABLE llx_payment_salary ADD COLUMN datec datetime AFTER tms; ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user_creat fk_user_author integer; -ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) after pass; +ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) AFTER pass; -ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid; +ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL DEFAULT '' AFTER rowid; ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype; -ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL; +ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL DEFAULT ''; ALTER TABLE llx_expedition ADD COLUMN import_key varchar(14); ALTER TABLE llx_expedition ADD COLUMN extraparams varchar(255); @@ -76,7 +76,7 @@ ALTER TABLE llx_prelevement_lignes MODIFY COLUMN code_banque varchar(128); ALTER TABLE llx_societe_rib MODIFY COLUMN code_banque varchar(128); ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30); -ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL after fk_shipping_method; +ALTER TABLE llx_commande ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_shipping_method; ALTER TABLE llx_ecm_directories MODIFY COLUMN fullpath varchar(750); ALTER TABLE llx_ecm_directories DROP INDEX idx_ecm_directories; @@ -107,20 +107,20 @@ ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (label, entity); --ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files_fullpath(fullpath); -ALTER TABLE llx_product ADD COLUMN onportal tinyint DEFAULT 0 after tobuy; +ALTER TABLE llx_product ADD COLUMN onportal smallint DEFAULT 0 AFTER tobuy; -ALTER TABLE llx_user ADD COLUMN employee tinyint DEFAULT 1; +ALTER TABLE llx_user ADD COLUMN employee smallint DEFAULT 1; CREATE TABLE IF NOT EXISTS llx_c_hrm_function ( rowid integer PRIMARY KEY, - pos tinyint DEFAULT 0 NOT NULL, + pos smallint DEFAULT 0 NOT NULL, code varchar(16) NOT NULL, label varchar(50), - c_level tinyint DEFAULT 0 NOT NULL, - active tinyint DEFAULT 1 NOT NULL + c_level smallint DEFAULT 0 NOT NULL, + active smallint DEFAULT 1 NOT NULL )ENGINE=innodb; INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(1, 5, 'EXECBOARD', 'Executive board', 0, 1); @@ -136,10 +136,10 @@ INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES CREATE TABLE IF NOT EXISTS llx_c_hrm_department ( rowid integer PRIMARY KEY, - pos tinyint DEFAULT 0 NOT NULL, + pos smallint DEFAULT 0 NOT NULL, code varchar(16) NOT NULL, label varchar(50), - active tinyint DEFAULT 1 NOT NULL + active smallint DEFAULT 1 NOT NULL )ENGINE=innodb; INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(1, 5,'MANAGEMENT', 'Management', 1); @@ -178,7 +178,7 @@ CREATE TABLE IF NOT EXISTS llx_establishment ( fk_user_mod integer NOT NULL, datec datetime NOT NULL, tms timestamp NOT NULL, - status tinyint DEFAULT 1 + status smallint DEFAULT 1 ) ENGINE=InnoDB; @@ -260,7 +260,7 @@ CREATE TABLE llx_product_pricerules var_percent FLOAT NOT NULL, -- Price variation over based price var_min_percent FLOAT NOT NULL -- Min price discount over general price ); -ALTER TABLE llx_product ADD COLUMN price_autogen TINYINT(1) DEFAULT 0; +ALTER TABLE llx_product ADD COLUMN price_autogen smallint DEFAULT 0; ALTER TABLE llx_product_pricerules ADD CONSTRAINT unique_level UNIQUE (level); diff --git a/htdocs/product/canvas/product/tpl/card_create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php index 81ddb147fe3..c5f968dee4f 100644 --- a/htdocs/product/canvas/product/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -90,9 +90,6 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe volume_units; ?> -trans("Hidden"); ?> -hidden; ?> - trans("NoteNotVisibleOnBill"); ?> textarea_note; ?> diff --git a/htdocs/product/canvas/service/tpl/card_create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php index 9d526383a67..39c91695f8f 100644 --- a/htdocs/product/canvas/service/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -63,9 +63,6 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe duration_unit; ?> -trans("Hidden"); ?> -hidden; ?> - trans("NoteNotVisibleOnBill"); ?> textarea_note; ?> diff --git a/htdocs/product/card.php b/htdocs/product/card.php index dcc303a2e0b..a7291cc1895 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -249,7 +249,6 @@ if (empty($reshook)) $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); $object->finished = GETPOST('finished'); - $object->hidden = GETPOST('hidden')=='yes'?1:0; $object->fk_unit = GETPOST('units'); $object->accountancy_code_sell = GETPOST('accountancy_code_sell'); $object->accountancy_code_buy = GETPOST('accountancy_code_buy'); @@ -335,7 +334,6 @@ if (empty($reshook)) $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); $object->finished = GETPOST('finished'); - $object->hidden = GETPOST('hidden')=='yes'?1:0; $units = GETPOST('units', 'int'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index aea4a3c1433..ba4dc432d36 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -84,11 +84,13 @@ class Product extends CommonObject //! Base price ('TTC' for price including tax or 'HT' for net price) var $price_base_type; //! Arrays for multiprices - var $multiprices=array(); - var $multiprices_ttc=array(); - var $multiprices_base_type=array(); - var $multiprices_tva_tx=array(); - var $multiprices_recuperableonly=array(); + public $multiprices=array(); + public $multiprices_ttc=array(); + public $multiprices_base_type=array(); + public $multiprices_min=array(); + public $multiprices_min_ttc=array(); + public $multiprices_tva_tx=array(); + public $multiprices_recuperableonly=array(); //! Price by quantity arrays var $price_by_qty; var $prices_by_qty=array(); @@ -125,6 +127,12 @@ class Product extends CommonObject var $customcode; // Customs code + /** + * Product URL + * @var string + */ + public $url; + //! Unites de mesure var $weight; var $weight_units; @@ -717,6 +725,7 @@ class Product extends CommonObject $sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null"); $sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1); + $sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL'); $sql.= " WHERE rowid = " . $id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -1443,6 +1452,14 @@ class Product extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $this->multiprices[$level] = $price; + $this->multiprices_ttc[$level] = $price_ttc; + $this->multiprices_min[$level]= $price_min; + $this->multiprices_min_ttc[$level]= $price_min_ttc; + $this->multiprices_base_type[$level]= $newpricebase; + $this->multiprices_tva_tx[$level]= $newvat; + $this->multiprices_recuperableonly[$level]= $newnpr; + $this->price = $price; $this->price_ttc = $price_ttc; $this->price_min = $price_min; @@ -1487,33 +1504,15 @@ class Product extends CommonObject * * @param int $expression_id Expression * @return int <0 if KO, >0 if OK + * @deprecated Use Product::update instead */ function setPriceExpression($expression_id) { - global $conf; + global $user; - // Clean parameters - $this->db->begin(); - $expression_id = $expression_id != 0 ? $expression_id : 'NULL'; + $this->fk_price_expression = $expression_id; - $sql = "UPDATE ".MAIN_DB_PREFIX."product"; - $sql.= " SET fk_price_expression = ".$expression_id; - $sql.= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::setPriceExpression", LOG_DEBUG); - - $resql = $this->db->query($sql); - if ($resql) - { - $this->db->commit(); - return 1; - } - else - { - $this->error=$this->db->error()." sql=".$sql; - $this->db->rollback(); - return -1; - } + return $this->update($this->id, $user); } /**