diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index 6ad1cdc6974..fb3a1ccf702 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -246,11 +246,14 @@ if ($reshook == 0) {
}
}
+$permissiontoadd = 1;
+
//asort($elementList);
$id = 25;
+
/*
* Actions
*/
@@ -338,6 +341,7 @@ if (empty($reshook)) {
}
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
+ $action = 'add';
}
}
@@ -411,6 +415,7 @@ if (empty($reshook)) {
} else {
dol_print_error($db);
}
+ $action = 'add';
}
}
@@ -489,6 +494,7 @@ if (empty($reshook)) {
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
} else {
setEventMessages($db->error(), null, 'errors');
+ $action = 'edit';
}
}
}
@@ -515,7 +521,7 @@ if (empty($reshook)) {
if ($action == $acts[0]) {
$rowidcol = "rowid";
- $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."=".((int) $rowid);
+ $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql);
if (!$result) {
@@ -527,7 +533,7 @@ if (empty($reshook)) {
if ($action == $acts[1]) {
$rowidcol = "rowid";
- $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."=".((int) $rowid);
+ $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql);
if (!$result) {
@@ -545,18 +551,38 @@ $form = new Form($db);
$formadmin = new FormAdmin($db);
$help_url = '';
-$title = $langs->trans("EMailsSetup");
+if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
+ $title = $langs->trans("EMailsSetup");
+} else {
+ $title = $langs->trans("EMailsTemplates");
+}
llxHeader('', $title, $help_url);
$linkback = '';
$titlepicto = 'title_setup';
-print load_fiche_titre($title, $linkback, $titlepicto);
-$head = email_admin_prepare_head();
+$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add';
+$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
+
+
+if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
+ print load_fiche_titre($title, '', $titlepicto);
+} else {
+ print load_fiche_titre($title, $newcardbutton, $titlepicto);
+}
+
+if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
+ $head = email_admin_prepare_head();
+
+ print dol_get_fiche_head($head, 'templates', '', -1);
+
+ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
+ print load_fiche_titre('', $newcardbutton, '');
+ }
+}
-print dol_get_fiche_head($head, 'templates', '', -1);
// Confirmation de la suppression de la ligne
if ($action == 'delete') {
@@ -599,7 +625,7 @@ $sql .= $db->plimit($listlimit + 1, $offset);
$fieldlist = explode(',', $tabfield[$id]);
-if ($action == 'view') {
+if ($action == 'add') {
// Form to add a new line
print '
';
-print dol_get_fiche_end();
+if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
+ print dol_get_fiche_end();
+}
+
// End of page
llxFooter();
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 340ac1dfc8c..9069b63179f 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -310,6 +310,8 @@ if ($object->fetch($id) >= 0) {
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic');
//print '';
+
+ print '';
print '
';
//print '
';
@@ -323,7 +325,7 @@ if ($object->fetch($id) >= 0) {
//print '| | ';
print '
';
//print "
\n";
- print '
';
+ print '
'; // End tr
clearstatcache();
@@ -424,9 +426,9 @@ if ($object->fetch($id) >= 0) {
print '';
if ($allowaddtarget) {
- print '';
+ print '';
} else {
- print '';
+ print '';
//print $langs->trans("MailNoChangePossible");
print " ";
}
@@ -445,6 +447,7 @@ if ($object->fetch($id) >= 0) {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
+ print '
'; // End table
print '';
print '
';
@@ -535,7 +538,7 @@ if ($object->fetch($id) >= 0) {
$morehtmlcenter = '';
if ($allowaddtarget) {
- $morehtmlcenter = ''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'';
+ $morehtmlcenter = ''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'';
}
$morehtmlcenter .= ' id.'">'.$langs->trans("Download").'';
diff --git a/htdocs/compta/facture/index.php b/htdocs/compta/facture/index.php
index 0a526e39e1e..1821d4720af 100644
--- a/htdocs/compta/facture/index.php
+++ b/htdocs/compta/facture/index.php
@@ -43,9 +43,8 @@ if (isset($user->socid) && $user->socid > 0) {
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
// Maximum elements of the tables
-$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
-$maxLatestEditCount = 5;
-$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
+$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
+$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
/*
@@ -64,7 +63,7 @@ if ($tmp) {
print $tmp;
print '
';
}
-$tmp = getCustomerInvoiceDraftTable($max, $socid);
+$tmp = getCustomerInvoiceDraftTable($maxDraftCount, $socid);
if ($tmp) {
print $tmp;
print '
';
@@ -74,13 +73,13 @@ print '';
print '';
-$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
+$tmp = getCustomerInvoiceLatestEditTable($max, $socid);
if ($tmp) {
print $tmp;
print '
';
}
-$tmp = getCustomerInvoiceUnpaidOpenTable($max, $socid);
+$tmp = getCustomerInvoiceUnpaidOpenTable($maxOpenCount, $socid);
if ($tmp) {
print $tmp;
print '
';
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 0ed0134a944..20d38ed3805 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -575,7 +575,7 @@ class pdf_einstein extends ModelePDFCommandes
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
- $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
+ $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index a901a23cc69..5cf7ce6645b 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -800,7 +800,7 @@ class pdf_eratosthene extends ModelePDFCommandes
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
- $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
+ $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index be42ab002d5..b1ab0f671b9 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -749,9 +749,9 @@ class pdf_crabe extends ModelePDFFactures
if (!isset($this->tva[$vatrate])) {
$this->tva[$vatrate] = 0;
}
- $this->tva[$vatrate] += $tvaligne;
+ $this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
$vatcode = $object->lines[$i]->vat_src_code;
- $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
+ $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
if ($posYAfterImage > $posYAfterDescription) {
$nexY = $posYAfterImage;
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 2def31cbf30..c1413a103f8 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -887,9 +887,9 @@ class pdf_sponge extends ModelePDFFactures
if (!isset($this->tva[$vatrate])) {
$this->tva[$vatrate] = 0;
}
- $this->tva[$vatrate] += $tvaligne;
+ $this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
$vatcode = $object->lines[$i]->vat_src_code;
- $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
+ $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
$nexY = max($nexY, $posYAfterImage);
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index ef43f05b86a..4b928d8af07 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -138,9 +138,8 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ORDER BY sp.poste";
$resql = $this->db->query($sql);
- $s .= $langs->trans("PostOrFunction").' ';
- $s .= '