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

This commit is contained in:
Laurent Destailleur 2015-12-16 19:27:23 +01:00
commit 6133298e58
23 changed files with 141 additions and 95 deletions

Binary file not shown.

View File

@ -503,7 +503,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">'; print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">'; print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnDeliveryReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>'; print $langs->trans("FreeLegalTextOnDeliveryReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="DELIVERY_FREE_TEXT" class="flat" cols="120">'.$conf->global->DELIVERY_FREE_TEXT.'</textarea>'; $variablename='DELIVERY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';

View File

@ -124,10 +124,12 @@ if ($action == 'send' && ! $_POST['cancel'])
if ($result) if ($result)
{ {
setEventMessages($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto), null, 'mesgs'); setEventMessages($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto), null, 'mesgs');
setEventMessages($smsfile->error, $smsfile->errors, 'mesgs');
} }
else else
{ {
setEventMessages($langs->trans("ResultKo"), null, 'errors'); setEventMessages($langs->trans("ResultKo"), null, 'errors');
setEventMessages($smsfile->error, $smsfile->errors, 'errors');
} }
$action=''; $action='';

View File

@ -2837,7 +2837,7 @@ else if ($id > 0 || ! empty($ref))
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="5">'; print '</td><td colspan="5">';
if ($action == 'editthirdparty') { if ($action == 'editthirdparty') {
$form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid'); $form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid','client>0');
} else { } else {
print ' &nbsp;' . $soc->getNomUrl(1, 'compta'); print ' &nbsp;' . $soc->getNomUrl(1, 'compta');
print ' &nbsp; '; print ' &nbsp; ';

View File

@ -149,9 +149,10 @@ class CSMSFile
$sms->message=$this->message; $sms->message=$this->message;
$res=$sms->SmsSend(); $res=$sms->SmsSend();
$this->error = $sms->error;
$this->errors = $sms->errors;
if ($res <= 0) if ($res <= 0)
{ {
$this->error=$sms->error;
dol_syslog("CSMSFile::sendfile: sms send error=".$this->error, LOG_ERR); dol_syslog("CSMSFile::sendfile: sms send error=".$this->error, LOG_ERR);
} }
else else

View File

@ -2017,8 +2017,8 @@ class Form
{ {
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
} }
$opt.= ' - '.$duration_value.' '.$langs->trans($dur[$duration_unit]); $opt.= ' - '.$duration_value.' '.($dur[$duration_unit]?$langs->trans($dur[$duration_unit]):'');
$outval.=' - '.$duration_value.' '.$langs->transnoentities($dur[$duration_unit]); $outval.=' - '.$duration_value.' '.($dur[$duration_unit]?$langs->transnoentities($dur[$duration_unit]):'');
} }
$opt.= "</option>\n"; $opt.= "</option>\n";

View File

@ -91,6 +91,19 @@ function accounting_prepare_head(AccountingAccount $object)
return $head; return $head;
} }
/**
* Return accounting account without zero on the right
*
* @param string $account Accounting account
* @return string String without zero on the right
*/
function clean_account($account)
{
$account = rtrim($account,"0");
return $account;
}
/** /**
* Return general accounting account with defined length * Return general accounting account with defined length
* *
@ -131,7 +144,7 @@ function length_accountg($account)
*/ */
function length_accounta($accounta) function length_accounta($accounta)
{ {
global $conf, $langs; global $conf;
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;

View File

@ -224,7 +224,7 @@ if (empty($reshook))
$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int')); $ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'));
if ($ret < 0) if ($ret < 0)
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
} }
@ -237,7 +237,7 @@ if (empty($reshook))
$ret=$object->addline_batch($batch_line[$i]); $ret=$object->addline_batch($batch_line[$i]);
if ($ret < 0) if ($ret < 0)
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
} }
@ -249,14 +249,14 @@ if (empty($reshook))
$ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment. $ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
if ($ret <= 0) if ($ret <= 0)
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
} }
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Qty")).'</div>'; setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("QtyToShip")), null, 'errors');
$error++; $error++;
} }
@ -287,7 +287,7 @@ if (empty($reshook))
} }
else else
{ {
$mesg=$object->error; setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -337,19 +337,18 @@ if (empty($reshook))
} }
else else
{ {
$langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($langs->trans($object->error), null, 'errors');
} }
} }
// TODO add alternative status
else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate))) /*else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate)))
{ {
$result = $object->setStatut(0); $result = $object->setStatut(0);
if ($result < 0) if ($result < 0)
{ {
$mesg = $object->error; setEventMessages($object->error, $object->errors, 'errors');
} }
} }*/
else if ($action == 'setdate_livraison' && $user->rights->expedition->creer) else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
{ {
@ -360,7 +359,7 @@ if (empty($reshook))
$result=$object->set_date_livraison($user,$datedelivery); $result=$object->set_date_livraison($user,$datedelivery);
if ($result < 0) if ($result < 0)
{ {
$mesg='<div class="error">'.$object->error.'</div>'; setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -485,8 +484,6 @@ if ($action == 'create')
setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors'); setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors');
} }
dol_htmloutput_mesg($mesg);
if ($origin) if ($origin)
{ {
$classname = ucfirst($origin); $classname = ucfirst($origin);
@ -928,8 +925,6 @@ else if ($id || $ref)
if ($object->id > 0) if ($object->id > 0)
{ {
dol_htmloutput_mesg($mesg);
if (!empty($object->origin)) if (!empty($object->origin))
{ {
$typeobject = $object->origin; $typeobject = $object->origin;
@ -943,8 +938,6 @@ else if ($id || $ref)
$head=shipping_prepare_head($object); $head=shipping_prepare_head($object);
dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending');
dol_htmloutput_mesg($mesg);
/* /*
* Confirmation de la suppression * Confirmation de la suppression
*/ */

View File

@ -1068,6 +1068,7 @@ class Expedition extends CommonObject
break; break;
} }
} }
if ($error) break; // break for loop incase of error
} }
} }
} }

View File

@ -996,7 +996,7 @@ class CommandeFournisseur extends CommonOrder
{ {
$result = -1; $result = -1;
$this->error = $langs->trans('NotAuthorized'); $this->error = $langs->trans('NotAuthorized');
$this->errors[] = $lanfs->trans('NotAuthorized'); $this->errors[] = $langs->trans('NotAuthorized');
dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR); dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR);
} }
return $result ; return $result ;

View File

@ -0,0 +1,25 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 4.0.0 or higher.
--
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value.
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN validated tinyint DEFAULT 0 NOT NULL;

View File

@ -35,5 +35,6 @@ CREATE TABLE llx_accounting_bookkeeping
fk_user_author integer NOT NULL, fk_user_author integer NOT NULL,
import_key varchar(14), import_key varchar(14),
code_journal varchar(10) DEFAULT NULL, code_journal varchar(10) DEFAULT NULL,
piece_num integer NOT NULL piece_num integer NOT NULL,
validated tinyint DEFAULT 0 NOT NULL -- 0 line not validated / 1 line validated (No deleting / No modification)
) ENGINE=innodb; ) ENGINE=innodb;

View File

@ -149,21 +149,21 @@ if (empty($reshook))
else $errors[] = 'FailedToValidateBarCode'; else $errors[] = 'FailedToValidateBarCode';
$error++; $error++;
setEventMessage($errors,'errors'); setEventMessages($errors, null, 'errors');
} }
} }
if ($action == 'setaccountancy_code_buy') { if ($action == 'setaccountancy_code_buy') {
$result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy')); $result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy'));
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors');
$action=""; $action="";
} }
if ($action == 'setaccountancy_code_sell') if ($action == 'setaccountancy_code_sell')
{ {
$result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell')); $result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell'));
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors');
$action=""; $action="";
} }
@ -174,13 +174,13 @@ if (empty($reshook))
if (! GETPOST('label')) if (! GETPOST('label'))
{ {
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), null, 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
if (empty($ref)) if (empty($ref))
{ {
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), 'errors'); setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), null, 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
@ -230,7 +230,8 @@ if (empty($reshook))
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors'); $mesg='Failed to get bar code type information ';
setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors');
} }
$object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_code = $stdobject->barcode_type_code;
$object->barcode_type_coder = $stdobject->barcode_type_coder; $object->barcode_type_coder = $stdobject->barcode_type_coder;
@ -296,8 +297,8 @@ if (empty($reshook))
} }
else else
{ {
if (count($object->errors)) setEventMessage($object->errors, 'errors'); if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
else setEventMessage($langs->trans($object->error), 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors');
$action = "create"; $action = "create";
} }
} }
@ -359,7 +360,8 @@ if (empty($reshook))
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors'); $mesg='Failed to get bar code type information ';
setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors');
} }
$object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_code = $stdobject->barcode_type_code;
$object->barcode_type_coder = $stdobject->barcode_type_coder; $object->barcode_type_coder = $stdobject->barcode_type_coder;
@ -384,15 +386,15 @@ if (empty($reshook))
} }
else else
{ {
if (count($object->errors)) setEventMessage($object->errors, 'errors'); if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
else setEventMessage($langs->trans($object->error), 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors');
$action = 'edit'; $action = 'edit';
} }
} }
else else
{ {
if (count($object->errors)) setEventMessage($object->errors, 'errors'); if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
else setEventMessage($langs->trans("ErrorProductBadRefOrLabel"), 'errors'); else setEventMessages($langs->trans("ErrorProductBadRefOrLabel"), null, 'errors');
$action = 'edit'; $action = 'edit';
} }
} }
@ -406,7 +408,7 @@ if (empty($reshook))
{ {
if (! GETPOST('clone_content') && ! GETPOST('clone_prices') ) if (! GETPOST('clone_content') && ! GETPOST('clone_prices') )
{ {
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
} }
else else
{ {
@ -433,7 +435,7 @@ if (empty($reshook))
if ($result < 1) if ($result < 1)
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans('ErrorProductClone'), 'errors'); setEventMessages($langs->trans('ErrorProductClone'), null, 'errors');
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$originalId); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$originalId);
exit; exit;
} }
@ -460,7 +462,7 @@ if (empty($reshook))
$mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref); $mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref);
$mesg.=' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$object->ref.'">'.$langs->trans("ShowCardHere").'</a>.'; $mesg.=' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$object->ref.'">'.$langs->trans("ShowCardHere").'</a>.';
setEventMessage($mesg, 'errors'); setEventMessages($mesg, null, 'errors');
$object->fetch($id); $object->fetch($id);
} }
else else
@ -468,12 +470,12 @@ if (empty($reshook))
$db->rollback(); $db->rollback();
if (count($object->errors)) if (count($object->errors))
{ {
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
dol_print_error($db,$object->errors); dol_print_error($db,$object->errors);
} }
else else
{ {
setEventMessage($langs->trans($object->error), 'errors'); setEventMessages($langs->trans($object->error), null, 'errors');
dol_print_error($db,$object->error); dol_print_error($db,$object->error);
} }
} }
@ -504,7 +506,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage($langs->trans($object->error), 'errors'); setEventMessages($langs->trans($object->error), null, 'errors');
$reload = 0; $reload = 0;
$action=''; $action='';
} }
@ -630,7 +632,7 @@ if (empty($reshook))
return; return;
} }
setEventMessage($langs->trans("ErrorUnknown") . ": $result", 'errors'); setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors');
} elseif (GETPOST('commandeid') > 0) { } elseif (GETPOST('commandeid') > 0) {
$result = $commande->addline( $result = $commande->addline(
$desc, $desc,
@ -702,7 +704,7 @@ if (empty($reshook))
} }
else { else {
$action=""; $action="";
setEventMessage($langs->trans("WarningSelectOneDocument"), 'warnings'); setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings');
} }
} }

View File

@ -105,7 +105,7 @@ if (empty($reshook))
$filetomerge->file_name=$filename; $filetomerge->file_name=$filename;
$result=$filetomerge->delete_by_file($user); $result=$filetomerge->delete_by_file($user);
if ($result<0) { if ($result<0) {
setEventMessage($filetomerge->error,'errors'); setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
} }
} }
} }
@ -137,7 +137,7 @@ if ($action=='filemerge')
$result=$filetomerge->delete_by_product($user, $object->id); $result=$filetomerge->delete_by_product($user, $object->id);
} }
if ($result<0) { if ($result<0) {
setEventMessage($filetomerge->error,'errors'); setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
} }
// for each file checked add it to the product // for each file checked add it to the product
@ -152,7 +152,7 @@ if ($action=='filemerge')
$result=$filetomerge->create($user); $result=$filetomerge->create($user);
if ($result<0) { if ($result<0) {
setEventMessage($filetomerge->error,'errors'); setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
} }
} }
} }

View File

@ -101,7 +101,7 @@ if (empty($reshook))
if ($result > 0) if ($result > 0)
{ {
$object->cost_price = price2num($cost_price); $object->cost_price = price2num($cost_price);
setEventMessage($langs->trans("RecordSaved")); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
} }
else else
{ {
@ -119,7 +119,7 @@ if (empty($reshook))
$action = ''; $action = '';
$result=$object->remove_product_fournisseur_price($rowid); $result=$object->remove_product_fournisseur_price($rowid);
if($result > 0){ if($result > 0){
setEventMessage($langs->trans("PriceRemoved")); setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
}else{ }else{
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -151,7 +151,7 @@ if (empty($reshook))
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFieldMustBeANumeric",'eeee'), 'errors'); setEventMessages($langs->trans("ErrorFieldMustBeANumeric",'eeee'), null, 'errors');
} }
if (empty($quantity)) if (empty($quantity))
{ {
@ -199,12 +199,12 @@ if (empty($reshook))
$object->fetch($object->product_id_already_linked); $object->fetch($object->product_id_already_linked);
$productLink = $object->getNomUrl(1,'supplier'); $productLink = $object->getNomUrl(1,'supplier');
setEventMessage($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), 'errors'); setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), null, 'errors');
} }
else if ($ret < 0) else if ($ret < 0)
{ {
$error++; $error++;
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -220,7 +220,7 @@ if (empty($reshook))
{ {
$error++; $error++;
setEventMessage($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
else else
{ {
@ -231,7 +231,7 @@ if (empty($reshook))
$price_result = $priceparser->parseProductSupplier($id, $price_expression, $quantity, $tva_tx); $price_result = $priceparser->parseProductSupplier($id, $price_expression, $quantity, $tva_tx);
if ($price_result < 0) { //Expression is not valid if ($price_result < 0) { //Expression is not valid
$error++; $error++;
setEventMessage($priceparser->translatedError(), 'errors'); setEventMessages($priceparser->translatedError(), null, 'errors');
} }
} }
if (! $error && ! empty($conf->dynamicprices->enabled)) { if (! $error && ! empty($conf->dynamicprices->enabled)) {
@ -239,7 +239,7 @@ if (empty($reshook))
if ($ret < 0) if ($ret < 0)
{ {
$error++; $error++;
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }

View File

@ -61,7 +61,7 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $liste_limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortfield) $sortfield="p.ref"; if (! $sortfield) $sortfield="p.ref";
@ -293,7 +293,7 @@ else
// Displays product removal confirmation // Displays product removal confirmation
if (GETPOST('delprod')) { if (GETPOST('delprod')) {
setEventMessage($langs->trans("ProductDeleted", GETPOST('delprod'))); setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
} }
if ($sref) $param="&amp;sref=".$sref; if ($sref) $param="&amp;sref=".$sref;

View File

@ -6,7 +6,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2014-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com> * Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -131,7 +131,7 @@ if (empty($reshook))
if ($priceparser->parseProduct($object) < 0) { if ($priceparser->parseProduct($object) < 0) {
$error ++; $error ++;
setEventMessage($priceparser->translatedError(), 'errors'); setEventMessages($priceparser->translatedError(), null, 'errors');
} }
} }
} }
@ -194,7 +194,7 @@ if (empty($reshook))
$newprice_min = price2num($val['price_min'], 'MU'); $newprice_min = price2num($val['price_min'], 'MU');
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) { if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) {
setEventMessage($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), 'errors'); setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors');
$error ++; $error ++;
break; break;
} }
@ -203,7 +203,7 @@ if (empty($reshook))
if ($res < 0) { if ($res < 0) {
$error ++; $error ++;
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
break; break;
} }
} }
@ -211,12 +211,12 @@ if (empty($reshook))
if (!$error && $object->update($object->id, $user) < 0) { if (!$error && $object->update($object->id, $user) < 0) {
$error++; $error++;
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
if (empty($error)) { if (empty($error)) {
$action = ''; $action = '';
setEventMessage($langs->trans("RecordSaved")); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$db->commit(); $db->commit();
} else { } else {
$action = 'edit_price'; $action = 'edit_price';
@ -229,7 +229,7 @@ if (empty($reshook))
{ {
$result = $object->log_price_delete($user, $_GET ["lineid"]); $result = $object->log_price_delete($user, $_GET ["lineid"]);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -341,7 +341,7 @@ if (empty($reshook))
if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier) if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier)
{ {
setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
$error++; $error++;
$action='add_customer_price'; $action='add_customer_price';
} }
@ -351,9 +351,9 @@ if (empty($reshook))
$result = $prodcustprice->create($user, 0, $update_child_soc); $result = $prodcustprice->create($user, 0, $update_child_soc);
if ($result < 0) { if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} else { } else {
setEventMessage($langs->trans('RecordSaved'), 'mesgs'); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} }
$action = ''; $action = '';
@ -367,9 +367,9 @@ if (empty($reshook))
$result = $prodcustprice->delete($user); $result = $prodcustprice->delete($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($prodcustprice->error, 'mesgs'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
} else { } else {
setEventMessage($langs->trans('RecordDeleted'), 'errors'); setEventMessages($langs->trans('RecordDeleted'), null, 'errors');
} }
$action = ''; $action = '';
} }
@ -391,7 +391,7 @@ if (empty($reshook))
if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
{ {
setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
$error++; $error++;
$action='update_customer_price'; $action='update_customer_price';
} }
@ -401,9 +401,9 @@ if (empty($reshook))
$result = $prodcustprice->update($user, 0, $update_child_soc); $result = $prodcustprice->update($user, 0, $update_child_soc);
if ($result < 0) { if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} else { } else {
setEventMessage($langs->trans('Save'), 'mesgs'); setEventMessages($langs->trans('Save'), null, 'mesgs');
} }
$action = ''; $action = '';
@ -1257,7 +1257,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$result = $prodcustprice->fetch(GETPOST('lineid', 'int')); $result = $prodcustprice->fetch(GETPOST('lineid', 'int'));
if ($result < 0) { if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} }
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
@ -1346,7 +1346,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); $result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
if ($result < 0) { if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} }
$option = '&socid=' . GETPOST('socid', 'int') . '&id=' . $object->id; $option = '&socid=' . GETPOST('socid', 'int') . '&id=' . $object->id;
@ -1422,7 +1422,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
if ($result < 0) { if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
} }
$option = '&search_soc=' . $search_soc . '&id=' . $object->id; $option = '&search_soc=' . $search_soc . '&id=' . $object->id;

View File

@ -139,15 +139,15 @@ class MouvementStock extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($this->db->jdate($obj->eatby) != $eatby) if ($this->db->jdate($obj->eatby) != $eatby)
{ {
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby); $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby));
dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby)); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
if ($this->db->jdate($obj->sellby) != $sellby) if ($this->db->jdate($obj->sellby) != $sellby)
{ {
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby); $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby));
dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby)); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }

View File

@ -100,7 +100,7 @@ if ($action == "correct_stock")
if (! is_numeric($_POST["nbpiece"])) if (! is_numeric($_POST["nbpiece"]))
{ {
$error++; $error++;
setEventMessage($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), 'errors'); setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
$action='correction'; $action='correction';
} }
@ -203,6 +203,14 @@ if (! empty($search_product)) $sql.= " AND p.label LIKE '%".$db->escape($s
if (! empty($search_warehouse)) $sql.= " AND e.label LIKE '%".$db->escape($search_warehouse)."%'"; if (! empty($search_warehouse)) $sql.= " AND e.label LIKE '%".$db->escape($search_warehouse)."%'";
if (! empty($search_user)) $sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'"; if (! empty($search_user)) $sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'";
if (! empty($search_batch)) $sql.= " AND m.batch LIKE '%".$db->escape($search_batch)."%'"; if (! empty($search_batch)) $sql.= " AND m.batch LIKE '%".$db->escape($search_batch)."%'";
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($conf->liste_limit+1, $offset);
@ -248,7 +256,7 @@ if ($resql)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
@ -470,8 +478,8 @@ if ($resql)
if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined
if ($search_user) $param.='&search_user='.urlencode($search_user); if ($search_user) $param.='&search_user='.urlencode($search_user);
if ($idproduct > 0) $param.='&idproduct='.$idproduct; if ($idproduct > 0) $param.='&idproduct='.$idproduct;
if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,''); if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,'');
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords);
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
if ($id) print '<input type="hidden" name="id" value="'.$id.'">'; if ($id) print '<input type="hidden" name="id" value="'.$id.'">';

View File

@ -77,7 +77,7 @@ if ($action == 'setstocklimit')
$object->seuil_stock_alerte=$stocklimit; $object->seuil_stock_alerte=$stocklimit;
$result=$object->update($object->id,$user,0,'update'); $result=$object->update($object->id,$user,0,'update');
if ($result < 0) if ($result < 0)
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action=''; $action='';
} }
@ -89,7 +89,7 @@ if ($action == 'setdesiredstock')
$object->desiredstock=$desiredstock; $object->desiredstock=$desiredstock;
$result=$object->update($object->id,$user,0,'update'); $result=$object->update($object->id,$user,0,'update');
if ($result < 0) if ($result < 0)
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action=''; $action='';
} }

View File

@ -176,7 +176,7 @@ if ($action == 'order' && isset($_POST['valid']))
$fail++; $fail++;
$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;"; $msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
$msg .= $order->error; $msg .= $order->error;
setEventMessage($msg, 'errors'); setEventMessages($msg, null, 'errors');
} else { } else {
$id = $result; $id = $result;
} }
@ -195,7 +195,7 @@ if ($action == 'order' && isset($_POST['valid']))
$fail++; $fail++;
$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;"; $msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
$msg .= $order->error; $msg .= $order->error;
setEventMessage($msg, 'errors'); setEventMessages($msg, null, 'errors');
} }
$i++; $i++;
} }
@ -205,7 +205,7 @@ if ($action == 'order' && isset($_POST['valid']))
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans('OrderCreated'), 'mesgs'); setEventMessages($langs->trans('OrderCreated'), null, 'mesgs');
header('Location: replenishorders.php'); header('Location: replenishorders.php');
exit; exit;
} }
@ -216,7 +216,7 @@ if ($action == 'order' && isset($_POST['valid']))
} }
if ($box == 0) if ($box == 0)
{ {
setEventMessage($langs->trans('SelectProductWithNotNullQty'), 'warnings'); setEventMessages($langs->trans('SelectProductWithNotNullQty'), null, 'warnings');
} }
} }

View File

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