Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2015-11-06 18:57:46 +01:00
commit b2d9f21253
20 changed files with 88 additions and 97 deletions

View File

@ -162,7 +162,7 @@ foreach($dirbarcode as $reldir)
{ {
$filebis=$reg[1]; $filebis=$reg[1];
// Chargement de la classe de codage // Loading encoding class
require_once $newdir.$file; require_once $newdir.$file;
$classname = "mod".ucfirst($filebis); $classname = "mod".ucfirst($filebis);
$module = new $classname($db); $module = new $classname($db);

View File

@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
$classname = preg_replace('/\-.*$/','',$classname); $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') 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; require_once $dir.$filebis;
$module = new $classname($db); $module = new $classname($db);

View File

@ -130,7 +130,7 @@ foreach ($dirmodels as $reldir)
$classname = preg_replace('/\-.*$/','',$classname); $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') 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; require_once $dir.$filebis;
$module = new $classname($db); $module = new $classname($db);

View File

@ -221,7 +221,7 @@ if (is_resource($handle))
{ {
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg)) if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
{ {
// Chargement de la classe de numerotation // Charging the numbering class
$classname = $reg[1]; $classname = $reg[1];
require_once $dir.'/'.$file; require_once $dir.'/'.$file;

View File

@ -101,12 +101,12 @@ if ($action == 'update' && $user->rights->categorie->creer)
} }
else else
{ {
setEventMessage($categorie->error, 'errors'); setEventMessages($categorie->error, $categorie->errors, 'errors');
} }
} }
else else
{ {
setEventMessage($categorie->error, 'errors'); setEventMessages($categorie->error, $categorie->errors, 'errors');
} }
} }

View File

@ -95,7 +95,7 @@ $cancel != $langs->trans("Cancel") &&
else else
{ {
$action = 'add'; $action = 'add';
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -128,7 +128,7 @@ $cancel != $langs->trans("Cancel") &&
else else
{ {
$action = 'edit'; $action = 'edit';
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }

View File

@ -122,7 +122,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
} }
else 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); $result=$object->add_type($newobject,$elementtype);
if ($result >= 0) if ($result >= 0)
{ {
setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref)); setEventMessages($langs->trans("WasAddedSuccessfully",$newobject->ref), null, 'mesgs');
} }
else else
{ {
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings'); setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
} }
else else
{ {

View File

@ -62,7 +62,7 @@ if ($action == 'builddoc')
$result=$cat->write_file(GETPOST('id','int')); $result=$cat->write_file(GETPOST('id','int'));
if ($result < 0) if ($result < 0)
{ {
setEventMessage($cat->error, 'errors'); setEventMessages($cat->error, $cat->errors, 'errors');
} }
} }

View File

@ -117,7 +117,7 @@ if (empty($reshook))
{ {
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{ {
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
} }
else else
{ {
@ -129,7 +129,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
$action=''; $action='';
@ -141,14 +141,14 @@ if (empty($reshook))
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{ {
// As security measure, we don't allow send from the GUI // As security measure, we don't allow send from the GUI
setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessage('<textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings'); setEventMessages('<textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
$action=''; $action='';
} }
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{ {
setEventMessage($langs->trans("NotEnoughPermissions"), 'warnings'); setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings');
$action=''; $action='';
} }
else else
@ -351,27 +351,27 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo")); setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs');
} }
// Loop finished, set global statut of mail // Loop finished, set global statut of mail
if ($nbko > 0) if ($nbko > 0)
{ {
$statut=2; // Status 'sent partially' (because at least one error) $statut=2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
} }
else else
{ {
if ($nbok >= $num) if ($nbok >= $num)
{ {
$statut=3; // Send to everybody $statut=3; // Send to everybody
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok)); setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
} }
else else
{ {
$statut=2; // Status 'sent partially' (because not send to everybody) $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(); $result=$mailfile->sendfile();
if ($result) 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 else
{ {
setEventMessage($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, 'errors'); setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
} }
$action=''; $action='';
@ -488,7 +488,7 @@ if (empty($reshook))
$mesgs[] = $object->error; $mesgs[] = $object->error;
} }
setEventMessage($mesgs, 'errors'); setEventMessages($mesg, $mesgs, 'errors');
$action="create"; $action="create";
} }
@ -518,7 +518,7 @@ if (empty($reshook))
$mesg = $object->error; $mesg = $object->error;
} }
setEventMessage($mesg, 'errors'); setEventMessages($mesg, $mesgs, 'errors');
$action=""; $action="";
} }
@ -582,7 +582,7 @@ if (empty($reshook))
$mesgs[] =$object->error; $mesgs[] =$object->error;
} }
setEventMessage($mesgs, 'errors'); setEventMessages($mesg, $mesgs, 'errors');
$action="edit"; $action="edit";
} }
else else
@ -597,7 +597,7 @@ if (empty($reshook))
if ($object->id > 0) if ($object->id > 0)
{ {
$object->valid($user); $object->valid($user);
setEventMessage($langs->trans("MailingSuccessfullyValidated")); setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
@ -628,7 +628,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$db->rollback(); $db->rollback();
} }
} }
@ -764,18 +764,18 @@ else
// You ensure that every user is using its own SMTP server. // You ensure that every user is using its own SMTP server.
$linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">'; $linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
$linktoadminemailend='</a>'; $linktoadminemailend='</a>';
setEventMessage($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), 'warnings'); setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
setEventMessage($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), '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)) setEventMessage($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), '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"]=''; $_GET["action"]='';
} }
else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{ {
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message // on affiche donc juste un message
setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessage('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings'); setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
$_GET["action"]=''; $_GET["action"]='';
} }
else else

View File

@ -80,7 +80,7 @@ if ($action == 'add')
//print $dir."\n<br>"; //print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules"); dol_syslog("Scan directory ".$dir." for modules");
// Chargement de la classe // Loading Class
$file = $dir."/".$module.".modules.php"; $file = $dir."/".$module.".modules.php";
$classname = "mailing_".$module; $classname = "mailing_".$module;
@ -100,24 +100,24 @@ if ($action == 'add')
} }
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs'); setEventMessages($langs->trans("XTargetsAdded",$result), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit; exit;
} }
if ($result == 0) if ($result == 0)
{ {
setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings'); setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings');
} }
if ($result < 0) 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')) if (GETPOST('clearlist'))
{ {
// Chargement de la classe // Loading Class
$obj = new MailingTargets($db); $obj = new MailingTargets($db);
$obj->clear_target($id); $obj->clear_target($id);
@ -267,7 +267,7 @@ if ($object->fetch($id) >= 0)
// Loop on each submodule // Loop on each submodule
foreach($modulenames as $modulename) foreach($modulenames as $modulename)
{ {
// Chargement de la classe // Loading Class
$file = $dir.$modulename.".modules.php"; $file = $dir.$modulename.".modules.php";
$classname = "mailing_".$modulename; $classname = "mailing_".$modulename;
require_once $file; require_once $file;

View File

@ -83,7 +83,7 @@ if (is_resource($handle))
$modulename=$reg[1]; $modulename=$reg[1];
if ($modulename == 'example') continue; if ($modulename == 'example') continue;
// Chargement de la classe // Loading Class
$file = $dir."/".$modulename.".modules.php"; $file = $dir."/".$modulename.".modules.php";
$classname = "mailing_".$modulename; $classname = "mailing_".$modulename;
require_once $file; require_once $file;

View File

@ -1546,7 +1546,7 @@ class Form
print img_picto($langs->trans("Search"), 'search'); print img_picto($langs->trans("Search"), 'search');
} }
} }
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' autofocus />'; print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
if ($hidelabel == 3) { if ($hidelabel == 3) {
print img_picto($langs->trans("Search"), 'search'); 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'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'" autofocus>'; $out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
$out.='<option value="0" selected>&nbsp;</option>'; $out.='<option value="0" selected>&nbsp;</option>';
$i = 0; $i = 0;

View File

@ -64,7 +64,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
{ {
$moduleid=$reg[1]; $moduleid=$reg[1];
// Chargement de la classe // Loading Class
$file = $dir."/export_".$moduleid.".modules.php"; $file = $dir."/export_".$moduleid.".modules.php";
$classname = "Export".ucfirst($moduleid); $classname = "Export".ucfirst($moduleid);

View File

@ -84,7 +84,7 @@ class ModeleImports
{ {
$moduleid=$reg[1]; $moduleid=$reg[1];
// Chargement de la classe // Loading Class
$file = $dir."/import_".$moduleid.".modules.php"; $file = $dir."/import_".$moduleid.".modules.php";
$classname = "Import".ucfirst($moduleid); $classname = "Import".ucfirst($moduleid);

View File

@ -107,7 +107,7 @@ class Export
if ($enabled) if ($enabled)
{ {
// Chargement de la classe // Loading Class
$file = $dir.$modulename.".class.php"; $file = $dir.$modulename.".class.php";
$classname = $modulename; $classname = $modulename;
require_once $file; require_once $file;

View File

@ -56,16 +56,16 @@ create table llx_overwrite_trans
transvalue text transvalue text
)ENGINE=innodb; )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_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_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 import_key varchar(14);
ALTER TABLE llx_expedition ADD COLUMN extraparams varchar(255); 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_societe_rib MODIFY COLUMN code_banque varchar(128);
ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30); 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 MODIFY COLUMN fullpath varchar(750);
ALTER TABLE llx_ecm_directories DROP INDEX idx_ecm_directories; 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_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 CREATE TABLE IF NOT EXISTS llx_c_hrm_function
( (
rowid integer PRIMARY KEY, rowid integer PRIMARY KEY,
pos tinyint DEFAULT 0 NOT NULL, pos smallint DEFAULT 0 NOT NULL,
code varchar(16) NOT NULL, code varchar(16) NOT NULL,
label varchar(50), label varchar(50),
c_level tinyint DEFAULT 0 NOT NULL, c_level smallint DEFAULT 0 NOT NULL,
active tinyint DEFAULT 1 NOT NULL active smallint DEFAULT 1 NOT NULL
)ENGINE=innodb; )ENGINE=innodb;
INSERT INTO llx_c_hrm_function (rowid, pos, code, label, c_level, active) VALUES(1, 5, 'EXECBOARD', 'Executive board', 0, 1); 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 CREATE TABLE IF NOT EXISTS llx_c_hrm_department
( (
rowid integer PRIMARY KEY, rowid integer PRIMARY KEY,
pos tinyint DEFAULT 0 NOT NULL, pos smallint DEFAULT 0 NOT NULL,
code varchar(16) NOT NULL, code varchar(16) NOT NULL,
label varchar(50), label varchar(50),
active tinyint DEFAULT 1 NOT NULL active smallint DEFAULT 1 NOT NULL
)ENGINE=innodb; )ENGINE=innodb;
INSERT INTO llx_c_hrm_department (rowid, pos, code, label, active) VALUES(1, 5,'MANAGEMENT', 'Management', 1); 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, fk_user_mod integer NOT NULL,
datec datetime NOT NULL, datec datetime NOT NULL,
tms timestamp NOT NULL, tms timestamp NOT NULL,
status tinyint DEFAULT 1 status smallint DEFAULT 1
) ENGINE=InnoDB; ) ENGINE=InnoDB;
@ -260,7 +260,7 @@ CREATE TABLE llx_product_pricerules
var_percent FLOAT NOT NULL, -- Price variation over based price var_percent FLOAT NOT NULL, -- Price variation over based price
var_min_percent FLOAT NOT NULL -- Min price discount over general 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); ALTER TABLE llx_product_pricerules ADD CONSTRAINT unique_level UNIQUE (level);

View File

@ -90,9 +90,6 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<?php echo $object->volume_units; ?> <?php echo $object->volume_units; ?>
</td></tr> </td></tr>
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
<td><?php echo $object->hidden; ?></td></tr>
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td> <tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
<?php echo $object->textarea_note; ?> <?php echo $object->textarea_note; ?>
</td></tr> </td></tr>

View File

@ -63,9 +63,6 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
<?php echo $object->duration_unit; ?> <?php echo $object->duration_unit; ?>
</td></tr> </td></tr>
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
<td><?php echo $object->hidden; ?></td></tr>
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td> <tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
<?php echo $object->textarea_note; ?> <?php echo $object->textarea_note; ?>
</td></tr> </td></tr>

View File

@ -249,7 +249,6 @@ if (empty($reshook))
$object->volume = GETPOST('volume'); $object->volume = GETPOST('volume');
$object->volume_units = GETPOST('volume_units'); $object->volume_units = GETPOST('volume_units');
$object->finished = GETPOST('finished'); $object->finished = GETPOST('finished');
$object->hidden = GETPOST('hidden')=='yes'?1:0;
$object->fk_unit = GETPOST('units'); $object->fk_unit = GETPOST('units');
$object->accountancy_code_sell = GETPOST('accountancy_code_sell'); $object->accountancy_code_sell = GETPOST('accountancy_code_sell');
$object->accountancy_code_buy = GETPOST('accountancy_code_buy'); $object->accountancy_code_buy = GETPOST('accountancy_code_buy');
@ -335,7 +334,6 @@ if (empty($reshook))
$object->volume = GETPOST('volume'); $object->volume = GETPOST('volume');
$object->volume_units = GETPOST('volume_units'); $object->volume_units = GETPOST('volume_units');
$object->finished = GETPOST('finished'); $object->finished = GETPOST('finished');
$object->hidden = GETPOST('hidden')=='yes'?1:0;
$units = GETPOST('units', 'int'); $units = GETPOST('units', 'int');

View File

@ -84,11 +84,13 @@ class Product extends CommonObject
//! Base price ('TTC' for price including tax or 'HT' for net price) //! Base price ('TTC' for price including tax or 'HT' for net price)
var $price_base_type; var $price_base_type;
//! Arrays for multiprices //! Arrays for multiprices
var $multiprices=array(); public $multiprices=array();
var $multiprices_ttc=array(); public $multiprices_ttc=array();
var $multiprices_base_type=array(); public $multiprices_base_type=array();
var $multiprices_tva_tx=array(); public $multiprices_min=array();
var $multiprices_recuperableonly=array(); public $multiprices_min_ttc=array();
public $multiprices_tva_tx=array();
public $multiprices_recuperableonly=array();
//! Price by quantity arrays //! Price by quantity arrays
var $price_by_qty; var $price_by_qty;
var $prices_by_qty=array(); var $prices_by_qty=array();
@ -125,6 +127,12 @@ class Product extends CommonObject
var $customcode; // Customs code var $customcode; // Customs code
/**
* Product URL
* @var string
*/
public $url;
//! Unites de mesure //! Unites de mesure
var $weight; var $weight;
var $weight_units; var $weight_units;
@ -717,6 +725,7 @@ class Product extends CommonObject
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null"); $sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1); $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; $sql.= " WHERE rowid = " . $id;
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -1443,6 +1452,14 @@ class Product extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) 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 = $price;
$this->price_ttc = $price_ttc; $this->price_ttc = $price_ttc;
$this->price_min = $price_min; $this->price_min = $price_min;
@ -1487,33 +1504,15 @@ class Product extends CommonObject
* *
* @param int $expression_id Expression * @param int $expression_id Expression
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @deprecated Use Product::update instead
*/ */
function setPriceExpression($expression_id) function setPriceExpression($expression_id)
{ {
global $conf; global $user;
// Clean parameters $this->fk_price_expression = $expression_id;
$this->db->begin();
$expression_id = $expression_id != 0 ? $expression_id : 'NULL';
$sql = "UPDATE ".MAIN_DB_PREFIX."product"; return $this->update($this->id, $user);
$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;
}
} }
/** /**