diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index fa5887e13f3..14c9a7dee5b 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -2457,7 +2457,7 @@ if ($id > 0) {
} elseif ($valuetoshow == 2) {
$valuetoshow = $langs->trans('CurrentNext');
}
- $class = "center";
+ $class = "center tdoverflowmax125";
} elseif ($value == 'price' || preg_match('/^amount/i', $value)) {
$valuetoshow = price($valuetoshow);
}
@@ -2469,6 +2469,8 @@ if ($id > 0) {
$key = $langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value);
$valuetoshow = nl2br($valuetoshow);
+ $titletoshow = $valuetoshow;
+ $class = 'small tdoverflowmax200';
} elseif ($value == 'label' && $tabname[$id] == 'c_country') {
$key = $langs->trans("Country".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->$value);
@@ -2496,6 +2498,8 @@ if ($id > 0) {
} elseif ($value == 'libelle' && $tabname[$id] == 'c_payment_term') {
$key = $langs->trans("PaymentConditionShort".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->$value);
+ $titletoshow = $key;
+ $class = "tdoverflowmax150";
} elseif ($value == 'libelle' && $tabname[$id] == 'c_paiement') {
$transavailableforcode = $langs->tab_translate["PaymentType".strtoupper($obj->code)];
$key = $langs->trans("PaymentType".strtoupper($obj->code));
@@ -2641,7 +2645,7 @@ if ($id > 0) {
// Favorite, EEC & Sepa
// Only for country dictionary
if ($id == DICT_COUNTRY) {
- print '
';
+ print ' | ';
// Is in EEC
if ($iserasable) {
print ''.$actl[$obj->eec].'';
@@ -2649,7 +2653,7 @@ if ($id > 0) {
print ''.$langs->trans("AlwaysActive").'';
}
print ' | ';
- print '';
+ print ' | ';
// Is in Sepa
if ($iserasable) {
print ''.$actl[$obj->sepa].'';
@@ -2657,7 +2661,7 @@ if ($id > 0) {
print ''.$langs->trans("AlwaysActive").'';
}
print ' | ';
- print '';
+ print ' | ';
// Favorite
if ($iserasable) {
print ''.$actl[$obj->favorite].'';
@@ -2669,7 +2673,7 @@ if ($id > 0) {
}
// Active
- print ' | ';
+ print ' | ';
if ($canbedisabled) {
print ''.$actl[$obj->active].'';
} else {
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index d3ce6b98013..a7413028b3d 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -70,6 +70,7 @@ $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$mode = GETPOST('mode', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
+$backtopage = GETPOST('backtopage');
$contextpage = GETPOST('contextpage', 'aZ09');
$id = $rowid = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('rowid'));
@@ -290,15 +291,21 @@ if ($rowid > 0) {
* Actions
*/
-if (GETPOST('cancel', 'alpha')) {
+if (GETPOST('cancel', 'alpha') || GETPOST('actioncancel', 'alpha')) {
$action = 'list';
$massaction = '';
+
+ if (!empty($backtopage)) {
+ header("Location: ".$backtopage);
+ exit(1);
+ }
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
$parameters = array();
+$object = null;
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -442,6 +449,11 @@ if (empty($reshook)) {
if ($result) { // Add is ok
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id' => 25); // Clean $_POST array, we keep only id
+
+ if (!empty($backtopage)) {
+ header("Location: ".$backtopage);
+ exit(1);
+ }
} else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
@@ -743,6 +755,7 @@ if ($action == 'create') {
print '';
print '';
print '';
+ print '';
print '';
print ' ';
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 444fdcfa455..ded66298a6c 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2106,7 +2106,7 @@ if ($action == 'create') {
print '';
// Validaty duration
- print '| '.$langs->trans("ValidityDuration").' | '.img_picto('', 'clock', 'class="pictofixedwidth"').' '.$langs->trans("days").' | ';
+ print '| '.$langs->trans("ValidityDuration").' | '.img_picto('', 'clock', 'class="pictofixedwidth"').' '.$langs->trans("days").' | ';
// Terms of payment
print '| '.$langs->trans('PaymentConditionsShort').' | ';
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 9fe0895d2ad..ce23b7d5edb 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -3422,9 +3422,14 @@ class Facture extends CommonInvoice
$num = $this->ref;
}
- $this->newref = dol_sanitizeFileName($num);
+ if (!$num) {
+ $error++;
+ } else {
+ $this->oldref = $this->ref;
+ $this->newref = dol_sanitizeFileName($num);
+ }
- if ($num) {
+ if (!$error) {
$this->update_price(1);
// Validate
@@ -3442,132 +3447,125 @@ class Facture extends CommonInvoice
$this->error = $this->db->lasterror();
$error++;
}
+ }
- // We check if the invoice was provisional
- /*
- if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref))) {
- // La verif qu'une remise n'est pas utilisee 2 fois est faite au moment de l'insertion de ligne
- }
- */
+ if (!$error) {
+ // Define third party as a customer
+ $result = $this->thirdparty->setAsCustomer();
- if (!$error) {
- // Define third party as a customer
- $result = $this->thirdparty->setAsCustomer();
+ // If active (STOCK_CALCULATE_ON_BILL), we decrement the main product and its components at invoice validation
+ if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_BILL') && $idwarehouse > 0) {
+ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
+ $langs->load("agenda");
- // If active (STOCK_CALCULATE_ON_BILL), we decrement the main product and its components at invoice validation
- if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_BILL') && $idwarehouse > 0) {
- require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
- $langs->load("agenda");
+ // Loop on each line
+ $cpt = count($this->lines);
+ for ($i = 0; $i < $cpt; $i++) {
+ if ($this->lines[$i]->fk_product > 0) {
+ $mouvP = new MouvementStock($this->db);
+ $mouvP->origin = &$this; // deprecated
+ $mouvP->setOrigin($this->element, $this->id);
- // Loop on each line
- $cpt = count($this->lines);
- for ($i = 0; $i < $cpt; $i++) {
- if ($this->lines[$i]->fk_product > 0) {
- $mouvP = new MouvementStock($this->db);
- $mouvP->origin = &$this; // deprecated
- $mouvP->setOrigin($this->element, $this->id);
+ // We decrease stock for product
+ if ($this->type == self::TYPE_CREDIT_NOTE) {
+ // TODO If warehouseid has been set into invoice line, we should use this value in priority
+ // $newidwarehouse = $this->lines[$i]->fk_warehouse ? $this->lines[$i]->fk_warehouse : $idwarehouse;
+ $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr", $num), '', '', $this->lines[$i]->batch);
+ if ($result < 0) {
+ $error++;
+ $this->error = $mouvP->error;
+ $this->errors = array_merge($this->errors, $mouvP->errors);
+ }
+ } else {
+ // TODO If warehouseid has been set into invoice line, we should use this value in priority
+ // $newidwarehouse = $this->lines[$i]->fk_warehouse ? $this->lines[$i]->fk_warehouse : $idwarehouse;
- // We decrease stock for product
- if ($this->type == self::TYPE_CREDIT_NOTE) {
- // TODO If warehouseid has been set into invoice line, we should use this value in priority
- // $newidwarehouse = $this->lines[$i]->fk_warehouse ? $this->lines[$i]->fk_warehouse : $idwarehouse;
- $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr", $num), '', '', $this->lines[$i]->batch);
- if ($result < 0) {
- $error++;
- $this->error = $mouvP->error;
- $this->errors = array_merge($this->errors, $mouvP->errors);
- }
- } else {
- // TODO If warehouseid has been set into invoice line, we should use this value in priority
- // $newidwarehouse = $this->lines[$i]->fk_warehouse ? $this->lines[$i]->fk_warehouse : $idwarehouse;
+ $is_batch_line = false;
+ if ($batch_rule > 0) {
+ $productStatic->fetch($this->lines[$i]->fk_product);
+ if ($productStatic->hasbatch() && is_object($productbatch)) {
+ $is_batch_line = true;
+ $product_qty_remain = $this->lines[$i]->qty;
- $is_batch_line = false;
- if ($batch_rule > 0) {
- $productStatic->fetch($this->lines[$i]->fk_product);
- if ($productStatic->hasbatch() && is_object($productbatch)) {
- $is_batch_line = true;
- $product_qty_remain = $this->lines[$i]->qty;
+ $sortfield = '';
+ $sortorder = '';
+ // find lot/serial by sellby (DLC) and eatby dates (DLUO) first
+ if ($batch_rule == Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST) {
+ $sortfield = 'pl.sellby,pl.eatby,pb.qty,pl.rowid';
+ $sortorder = 'ASC,ASC,ASC,ASC';
+ }
- $sortfield = '';
- $sortorder = '';
- // find lot/serial by sellby (DLC) and eatby dates (DLUO) first
- if ($batch_rule == Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST) {
- $sortfield = 'pl.sellby,pl.eatby,pb.qty,pl.rowid';
- $sortorder = 'ASC,ASC,ASC,ASC';
- }
+ $resBatchList = $productbatch->findAllForProduct($productStatic->id, $idwarehouse, (getDolGlobalInt('STOCK_DISALLOW_NEGATIVE_TRANSFER') ? 0 : null), $sortfield, $sortorder);
+ if (!is_array($resBatchList)) {
+ $error++;
+ $this->error = $this->db->lasterror();
+ }
- $resBatchList = $productbatch->findAllForProduct($productStatic->id, $idwarehouse, (getDolGlobalInt('STOCK_DISALLOW_NEGATIVE_TRANSFER') ? 0 : null), $sortfield, $sortorder);
- if (!is_array($resBatchList)) {
+ if (!$error) {
+ $batchList = $resBatchList;
+ if (empty($batchList)) {
$error++;
- $this->error = $this->db->lasterror();
+ $langs->load('errors');
+ $warehouseStatic->fetch($idwarehouse);
+ $this->error = $langs->trans('ErrorBatchNoFoundForProductInWarehouse', $productStatic->label, $warehouseStatic->ref);
+ dol_syslog(__METHOD__.' Error: '.$langs->transnoentitiesnoconv('ErrorBatchNoFoundForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
}
- if (!$error) {
- $batchList = $resBatchList;
- if (empty($batchList)) {
+ foreach ($batchList as $batch) {
+ if ($batch->qty <= 0) {
+ continue; // try to decrement only batches have positive quantity first
+ }
+
+ // enough quantity in this batch
+ if ($batch->qty >= $product_qty_remain) {
+ $product_batch_qty = $product_qty_remain;
+ } else {
+ // not enough (take all in batch)
+ $product_batch_qty = $batch->qty;
+ }
+ $result = $mouvP->livraison($user, $productStatic->id, $idwarehouse, $product_batch_qty, $this->lines[$i]->subprice, $langs->trans('InvoiceValidatedInDolibarr', $num), '', '', '', $batch->batch);
+ if ($result < 0) {
+ $error++;
+ $this->error = $mouvP->error;
+ $this->errors = array_merge($this->errors, $mouvP->errors);
+ break;
+ }
+
+ $product_qty_remain -= $product_batch_qty;
+ // all product quantity was decremented
+ if ($product_qty_remain <= 0) {
+ break;
+ }
+ }
+
+ if (!$error && $product_qty_remain > 0) {
+ if (getDolGlobalInt('STOCK_DISALLOW_NEGATIVE_TRANSFER')) {
$error++;
$langs->load('errors');
$warehouseStatic->fetch($idwarehouse);
- $this->error = $langs->trans('ErrorBatchNoFoundForProductInWarehouse', $productStatic->label, $warehouseStatic->ref);
- dol_syslog(__METHOD__.' Error: '.$langs->transnoentitiesnoconv('ErrorBatchNoFoundForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
- }
-
- foreach ($batchList as $batch) {
- if ($batch->qty <= 0) {
- continue; // try to decrement only batches have positive quantity first
- }
-
- // enough quantity in this batch
- if ($batch->qty >= $product_qty_remain) {
- $product_batch_qty = $product_qty_remain;
- } else {
- // not enough (take all in batch)
- $product_batch_qty = $batch->qty;
- }
- $result = $mouvP->livraison($user, $productStatic->id, $idwarehouse, $product_batch_qty, $this->lines[$i]->subprice, $langs->trans('InvoiceValidatedInDolibarr', $num), '', '', '', $batch->batch);
+ $this->error = $langs->trans('ErrorBatchNoFoundEnoughQuantityForProductInWarehouse', $productStatic->label, $warehouseStatic->ref);
+ dol_syslog(__METHOD__.' Error: '.$langs->transnoentitiesnoconv('ErrorBatchNoFoundEnoughQuantityForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
+ } else {
+ // take in the first batch
+ $batch = $batchList[0];
+ $result = $mouvP->livraison($user, $productStatic->id, $idwarehouse, $product_qty_remain, $this->lines[$i]->subprice, $langs->trans('InvoiceValidatedInDolibarr', $num), '', '', '', $batch->batch);
if ($result < 0) {
$error++;
$this->error = $mouvP->error;
$this->errors = array_merge($this->errors, $mouvP->errors);
- break;
- }
-
- $product_qty_remain -= $product_batch_qty;
- // all product quantity was decremented
- if ($product_qty_remain <= 0) {
- break;
- }
- }
-
- if (!$error && $product_qty_remain > 0) {
- if (getDolGlobalInt('STOCK_DISALLOW_NEGATIVE_TRANSFER')) {
- $error++;
- $langs->load('errors');
- $warehouseStatic->fetch($idwarehouse);
- $this->error = $langs->trans('ErrorBatchNoFoundEnoughQuantityForProductInWarehouse', $productStatic->label, $warehouseStatic->ref);
- dol_syslog(__METHOD__.' Error: '.$langs->transnoentitiesnoconv('ErrorBatchNoFoundEnoughQuantityForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
- } else {
- // take in the first batch
- $batch = $batchList[0];
- $result = $mouvP->livraison($user, $productStatic->id, $idwarehouse, $product_qty_remain, $this->lines[$i]->subprice, $langs->trans('InvoiceValidatedInDolibarr', $num), '', '', '', $batch->batch);
- if ($result < 0) {
- $error++;
- $this->error = $mouvP->error;
- $this->errors = array_merge($this->errors, $mouvP->errors);
- }
}
}
}
}
}
+ }
- if (!$is_batch_line) { // If stock move not yet processed
- $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr", $num));
- if ($result < 0) {
- $error++;
- $this->error = $mouvP->error;
- $this->errors = array_merge($this->errors, $mouvP->errors);
- }
+ if (!$is_batch_line) { // If stock move not yet processed
+ $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr", $num));
+ if ($result < 0) {
+ $error++;
+ $this->error = $mouvP->error;
+ $this->errors = array_merge($this->errors, $mouvP->errors);
}
}
}
@@ -3605,8 +3603,6 @@ class Facture extends CommonInvoice
}
if (!$error) {
- $this->oldref = $this->ref;
-
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
// Now we rename also files into index
@@ -3624,28 +3620,6 @@ class Facture extends CommonInvoice
$error++;
$this->error = $this->db->lasterror();
}
-
- // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
- $oldref = dol_sanitizeFileName($this->ref);
- $newref = dol_sanitizeFileName($num);
- $dirsource = $conf->facture->dir_output.'/'.$oldref;
- $dirdest = $conf->facture->dir_output.'/'.$newref;
- if (!$error && file_exists($dirsource)) {
- dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
-
- if (@rename($dirsource, $dirdest)) {
- dol_syslog("Rename ok");
- // Rename docs starting with $oldref with $newref
- $listoffiles = dol_dir_list($conf->facture->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
- foreach ($listoffiles as $fileentry) {
- $dirsource = $fileentry['name'];
- $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
- $dirsource = $fileentry['path'].'/'.$dirsource;
- $dirdest = $fileentry['path'].'/'.$dirdest;
- @rename($dirsource, $dirdest);
- }
- }
- }
}
}
@@ -3689,8 +3663,31 @@ class Facture extends CommonInvoice
$this->setFinal($user);
}
}
- } else {
- $error++;
+ }
+
+ // Rename directory if dir was a temporary ref
+ if (!$error && preg_match('/^[\(]?PROV/i', $this->oldref)) {
+ // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
+ $oldref = dol_sanitizeFileName($this->oldref);
+ $newref = dol_sanitizeFileName($num);
+ $dirsource = $conf->facture->dir_output.'/'.$oldref;
+ $dirdest = $conf->facture->dir_output.'/'.$newref;
+ if (!$error && file_exists($dirsource)) {
+ dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
+
+ if (@rename($dirsource, $dirdest)) {
+ dol_syslog("Rename ok");
+ // Rename docs starting with $oldref with $newref
+ $listoffiles = dol_dir_list($conf->facture->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
+ foreach ($listoffiles as $fileentry) {
+ $dirsource = $fileentry['name'];
+ $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
+ $dirsource = $fileentry['path'].'/'.$dirsource;
+ $dirdest = $fileentry['path'].'/'.$dirdest;
+ @rename($dirsource, $dirdest);
+ }
+ }
+ }
}
if (!$error) {
diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php
index cd5a8c98eae..c57dc8f1148 100644
--- a/htdocs/core/boxes/box_factures_fourn_imp.php
+++ b/htdocs/core/boxes/box_factures_fourn_imp.php
@@ -229,7 +229,7 @@ class box_factures_fourn_imp extends ModeleBoxes
'text' => " ",
);
$this->info_box_contents[$line][] = array(
- 'td' => 'class="right liste_total" ',
+ 'td' => 'class="nowraponall right liste_total"',
'text' => price($totalamount, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(
diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php
index a4f91c30985..c59f62a80d9 100644
--- a/htdocs/core/boxes/box_factures_imp.php
+++ b/htdocs/core/boxes/box_factures_imp.php
@@ -235,7 +235,7 @@ class box_factures_imp extends ModeleBoxes
// Add the sum à the bottom of the boxes
$this->info_box_contents[$line][] = array(
- 'tr' => 'class="liste_total_wrap"',
+ 'tr' => 'class="liste_total"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total"),
);
@@ -244,7 +244,7 @@ class box_factures_imp extends ModeleBoxes
'text' => " ",
);
$this->info_box_contents[$line][] = array(
- 'td' => 'class="right liste_total" ',
+ 'td' => 'class="nowraponall right liste_total" ',
'text' => price($totalamount, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 164856bc428..bf4623828be 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -957,6 +957,7 @@ class Notify
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
+ // Note the substitution array should contains __REF__, __NEWREF__ ....
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
$message = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
} else {
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 218fb832749..6354e8e0604 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -1906,6 +1906,8 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu
//var_dump($arraydefaultmessage);
//var_dump($arrayofmessagename);
print $form->selectarray('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $arrayofmessagename, $obj->value.':'.$tmp[1], 'None', 0, 0, '', 0, 0, 0, '', '', 1);
+
+ print ''.img_picto('', 'add').'';
} elseif (preg_match('/MAIL_FROM$/i', $const)) {
print img_picto('', 'email', 'class="pictofixedwidth"').'';
} else { // type = 'string' ou 'chaine'
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index f23489eeab4..2c36229efab 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -927,9 +927,9 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.$filename;
- $result .= ' | ';
+ $result .= ' ';
- $result .= '| ';
+ $result .= ' | ';
$result .= '';
$result .= '';
@@ -942,7 +942,7 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
$result .= '';
$result .= '| '.$companystatic->getNomUrl(1, 'customer').' | ';
- $result .= ''.dol_print_date($db->jdate($obj->datec), 'day').' | ';
+ $result .= ''.dol_print_date($db->jdate($obj->datec), 'day').' | ';
$result .= ''.price($obj->total_ttc).' | ';
// Load amount of existing payment of invoice (needed for complete status)
@@ -1207,7 +1207,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
print '';
print $societestatic->getNomUrl(1, 'customer');
print ' | ';
- print '';
+ print ' | ';
print dol_print_date($db->jdate($obj->datelimite), 'day');
if ($tmpinvoice->hasDelay()) {
print img_warning($langs->trans("Late"));
diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
index 86bf821cd36..e2efbf55e37 100644
--- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
+++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php
@@ -99,7 +99,7 @@ class InterfaceNotification extends DolibarrTriggers
$notify = new Notify($this->db);
$resultSend = $notify->send($action, $object);
if ($resultSend < 0) {
- $this->errors = array_merge($this->errors, $notify->errors);
+ $this->errors = array_merge(empty($this->errors) ? array() : $this->errors, $notify->errors);
return $resultSend;
}
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index efe048b4887..1bd78f84e59 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -132,7 +132,7 @@ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture',
// Common permissions
$usercanread = ($user->hasRight("fournisseur", "facture", "lire") || $user->hasRight("supplier_invoice", "lire"));
$usercancreate = ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"));
-$usercandelete = ($user->hasRight("fournisseur", "facture", "supprimer") || $user->hasRight("supplier_invoice", "supprimer"));
+$usercandelete = (($user->hasRight("fournisseur", "facture", "supprimer") || $user->hasRight("supplier_invoice", "supprimer")) || ($usercancreate && $object->is_erasable() == 1));
$usercancreatecontract = $user->hasRight("contrat", "creer");
// Advanced permissions
@@ -279,7 +279,7 @@ if (empty($reshook)) {
$isErasable = $object->is_erasable();
- if (($usercandelete && $isErasable > 0) || ($usercancreate && $isErasable == 1)) {
+ if ($usercandelete && $isErasable > 0) {
$revertstock = GETPOST('revertstock');
if ($revertstock) {
@@ -4175,8 +4175,9 @@ if ($action == 'create') {
}
// Delete
- $isErasable = $object->is_erasable();
- if ($action != 'confirm_edit' && ($usercandelete || ($usercancreate && $isErasable == 1))) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
+ if ($action != 'confirm_edit' && $usercandelete) {
+ $isErasable = $object->is_erasable();
+
$enableDelete = false;
$htmltooltip = '';
$params = (empty($conf->use_javascript_ajax) ? array() : array('attr' => array('class' => 'reposition')));
diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index bf9ee344cd1..8b158a80ccc 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -249,7 +249,7 @@ if ($result > 0) {
// Add notification form
- print ' | | |