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

Conflicts:
	htdocs/commande/card.php
	htdocs/core/boxes/box_factures_fourn.php
	htdocs/core/boxes/box_factures_fourn_imp.php
	htdocs/core/boxes/box_ficheinter.php
	htdocs/core/boxes/box_members.php
	htdocs/core/boxes/box_propales.php
	htdocs/core/class/commonobject.class.php
	htdocs/core/class/html.formmail.class.php
	htdocs/core/lib/functions.lib.php
	htdocs/fourn/class/fournisseur.facture.class.php
This commit is contained in:
Laurent Destailleur 2021-02-28 13:37:45 +01:00
commit 886cbc61c8
18 changed files with 154 additions and 93 deletions

View File

@ -978,6 +978,7 @@ if ($resql) {
print "</tr>\n";
} else {
// If template is for a module, check module is enabled.
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
@ -985,6 +986,7 @@ if ($resql) {
continue;
}
}
$keyforobj = 'type_template';
if (!in_array($obj->$keyforobj, array_keys($elementList))) {
$i++;

View File

@ -782,7 +782,7 @@ if (empty($reshook)) {
}
}
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);

View File

@ -600,7 +600,7 @@ if (empty($reshook)) {
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);

View File

@ -1939,7 +1939,7 @@ if (empty($reshook)) {
$_GET["originid"] = $_POST["originid"];
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);

View File

@ -93,7 +93,7 @@ class box_factures extends ModeleBoxes
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.datef as df";
$sql .= ", f.paye, f.fk_statut, f.datec, f.tms";
$sql .= ", f.paye, f.fk_statut as status, f.datec, f.tms";
$sql .= ", f.date_lim_reglement as datelimite";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -139,8 +139,10 @@ class box_factures extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
$facturestatic->alreadypaid = $objp->paye;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@ -189,7 +191,7 @@ class box_factures extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->paye),
);
$line++;

View File

@ -85,6 +85,8 @@ class box_factures_fourn extends ModeleBoxes
);
if ($user->rights->fournisseur->facture->lire) {
$langs->load("bills");
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
$sql .= ", s.logo, s.email, s.entity";
@ -92,7 +94,7 @@ class box_factures_fourn extends ModeleBoxes
$sql .= ", f.total_ht";
$sql .= ", f.total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.paye, f.fk_statut";
$sql .= ", f.paye, f.fk_statut as status";
$sql .= ', f.datef as df';
$sql .= ', f.datec as datec';
$sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type';
@ -125,6 +127,7 @@ class box_factures_fourn extends ModeleBoxes
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$datelimite = $this->db->jdate($objp->datelimite);
$date = $this->db->jdate($objp->df);
$datem = $this->db->jdate($objp->tms);
@ -135,7 +138,8 @@ class box_factures_fourn extends ModeleBoxes
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$facturestatic->ref_supplier = $objp->ref_supplier;
$thirdpartystatic->id = $objp->socid;
@ -189,7 +193,7 @@ class box_factures_fourn extends ModeleBoxes
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),
);
$line++;

View File

@ -81,6 +81,8 @@ class box_factures_fourn_imp extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills", $max));
if ($user->rights->fournisseur->facture->lire) {
$langs->load("bills");
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
$sql .= ", s.logo, s.email, s.entity";
@ -89,7 +91,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql .= ", f.total_ht as total_ht";
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.paye, f.fk_statut, f.type";
$sql .= ", f.paye, f.fk_statut as status, f.type";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ",".MAIN_DB_PREFIX."facture_fourn as f";
if (!$user->rights->societe->client->voir && !$user->socid) {
@ -97,7 +99,7 @@ class box_factures_fourn_imp extends ModeleBoxes
}
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.entity = ".$conf->entity;
$sql .= " AND f.paye=0";
$sql .= " AND f.paye = 0";
$sql .= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -129,7 +131,8 @@ class box_factures_fourn_imp extends ModeleBoxes
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->date_echeance = $datelimite;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@ -176,7 +179,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),
);
$line++;

View File

@ -97,7 +97,7 @@ class box_factures_imp extends ModeleBoxes
$sql .= ", f.total as total_ht";
$sql .= ", f.tva as total_tva";
$sql .= ", f.total_ttc";
$sql .= ", f.paye, f.fk_statut, f.rowid as facid";
$sql .= ", f.paye, f.fk_statut as status, f.rowid as facid";
$sql .= ", sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) {
@ -139,8 +139,10 @@ class box_factures_imp extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->fk_statut;
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
$facturestatic->alreadypaid = $objp->paye;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@ -189,7 +191,7 @@ class box_factures_imp extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $objp->am),
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->am),
);
$line++;

View File

@ -81,7 +81,7 @@ class box_ficheinter extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastFicheInter", $max));
if (!empty($user->rights->ficheinter->lire)) {
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut";
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
$sql .= ", f.datec";
$sql .= ", f.date_valid as datev";
$sql .= ", f.tms as datem";
@ -116,7 +116,8 @@ class box_ficheinter extends ModeleBoxes
$objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec);
$ficheinterstatic->statut = $objp->fk_statut;
$ficheinterstatic->statut = $objp->status;
$ficheinterstatic->status = $objp->status;
$ficheinterstatic->id = $objp->rowid;
$ficheinterstatic->ref = $objp->ref;

View File

@ -119,8 +119,11 @@ class box_members extends ModeleBoxes
$memberstatic->morphy = $objp->morphy;
$memberstatic->company = $objp->company;
$memberstatic->statut = $objp->status;
$memberstatic->date_creation = $datec;
$memberstatic->date_modification = $datem;
$memberstatic->need_subscription = $objp->subscription;
$memberstatic->datefin = $this->db->jdate($objp->date_end_subscription);
if (!empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty();

View File

@ -87,7 +87,7 @@ class box_propales extends ModeleBoxes
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.total_tva, p.total_ttc, p.tms";
$sql .= ", p.rowid, p.ref, p.fk_statut as status, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.total_tva, p.total_ttc, p.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->socid) {
@ -128,6 +128,8 @@ class box_propales extends ModeleBoxes
$propalstatic->total_ht = $objp->total_ht;
$propalstatic->total_tva = $objp->total_tva;
$propalstatic->total_ttc = $objp->total_ttc;
$propalstatic->statut = $objp->status;
$propalstatic->status = $objp->status;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
@ -140,7 +142,7 @@ class box_propales extends ModeleBoxes
$societestatic->entity = $objp->entity;
$late = '';
if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
if ($objp->status == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
$late = img_warning($langs->trans("Late"));
}
@ -169,7 +171,7 @@ class box_propales extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $propalstatic->LibStatut($objp->fk_statut, 3),
'text' => $propalstatic->LibStatut($objp->status, 3),
);
$line++;

View File

@ -89,7 +89,7 @@ class box_supplier_orders extends ModeleBoxes
$sql .= ", c.total_ht";
$sql .= ", c.total_tva";
$sql .= ", c.total_ttc";
$sql .= ", c.fk_statut";
$sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) {
@ -122,6 +122,7 @@ class box_supplier_orders extends ModeleBoxes
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
$supplierorderstatic->statut = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@ -157,7 +158,7 @@ class box_supplier_orders extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $supplierorderstatic->LibStatut($objp->fk_statut, 3),
'text' => $supplierorderstatic->LibStatut($objp->status, 3),
);
$line++;

View File

@ -89,7 +89,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql .= ", c.total_ht";
$sql .= ", c.total_tva";
$sql .= ", c.total_ttc";
$sql .= ", c.fk_statut";
$sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) {
@ -122,11 +122,10 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$delivery_date = $this->db->jdate($objp->delivery_date);
$datem = $this->db->jdate($objp->tms);
$supplierorderstatic->delivery_date = $delivery_date;
$supplierorderstatic->statut = $objp->fk_statut;
$supplierorderstatic->id = $objp->rowid;
$supplierorderstatic->ref = $objp->ref;
$supplierorderstatic->delivery_date = $delivery_date;
$supplierorderstatic->statut = $objp->status;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;

View File

@ -493,6 +493,10 @@ abstract class CommonObject
*/
public $sendtoid;
/**
* @var float Amount already paid (used to show correct status)
*/
public $alreadypaid;
/**
* @var array List of child tables. To test if we can delete object.
@ -2447,7 +2451,8 @@ abstract class CommonObject
$line->date_end,
$line->array_options,
$line->fk_unit,
$line->multicurrency_subprice
$line->multicurrency_subprice,
$line->ref_supplier
);
break;
case 'invoice_supplier':
@ -2469,7 +2474,8 @@ abstract class CommonObject
$line->date_end,
$line->array_options,
$line->fk_unit,
$line->multicurrency_subprice
$line->multicurrency_subprice,
$line->ref_supplier
);
break;
default:

View File

@ -366,8 +366,8 @@ class FormMail extends Form
// Load translation files required by the page
$langs->loadLangs(array('other', 'mails'));
// Clear temp files. Must be done at beginning, before call of triggers
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
// Clear temp files. Must be done before call of triggers, at beginning (mode = init), or when we select a new template
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
$this->clear_attached_files();
}
@ -1227,6 +1227,8 @@ class FormMail extends Form
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{
global $conf;
$ret = new ModelMail();
if ($id == -2 && empty($label)) {
@ -1242,7 +1244,7 @@ class FormMail extends Form
$languagetosearchmain = '';
}
$sql = "SELECT rowid, label, topic, joinfiles, content, content_lines, lang";
$sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang";
$sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql .= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
@ -1267,74 +1269,92 @@ class FormMail extends Form
} else {
$sql .= $db->order("position,lang,label", "ASC,ASC,ASC"); // If no language provided, we give priority to lang not defined
}
$sql .= $db->plimit(1);
//$sql .= $db->plimit(1);
//print $sql;
$resql = $db->query($sql);
if ($resql) {
// Get first found
if (!$resql)
{
dol_print_error($db);
return -1;
}
// Get first found
while (1) {
$obj = $db->fetch_object($resql);
if ($obj) {
// If template is for a module, check module is enabled; if not, take next template
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
continue;
}
}
// If a record was found
$ret->id = $obj->rowid;
$ret->module = $obj->module;
$ret->label = $obj->label;
$ret->lang = $obj->lang;
$ret->topic = $obj->topic;
$ret->content = $obj->content;
$ret->content_lines = $obj->content_lines;
$ret->joinfiles = $obj->joinfiles;
} elseif ($id == -2) {
// Not found with the provided label
return -1;
break;
} else {
// If there is no template at all
$defaultmessage = '';
// If no record found
if ($id == -2) {
// Not found with the provided label
return -1;
} else {
// If there is no template at all
$defaultmessage = '';
if ($type_template == 'body') {
// Special case to use this->withbody as content
$defaultmessage = $this->withbody;
} elseif ($type_template == 'facture_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoice");
} elseif ($type_template == 'facture_relance') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder");
} elseif ($type_template == 'propal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendProposal");
} elseif ($type_template == 'supplier_proposal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierProposal");
} elseif ($type_template == 'order_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendOrder");
} elseif ($type_template == 'order_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder");
} elseif ($type_template == 'invoice_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice");
} elseif ($type_template == 'shipping_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($type_template == 'fichinter_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter");
} elseif ($type_template == 'actioncomm_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm");
} elseif ($type_template == 'thirdparty') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty");
} elseif (!empty($type_template)) {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric");
if ($type_template == 'body') {
// Special case to use this->withbody as content
$defaultmessage = $this->withbody;
} elseif ($type_template == 'facture_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoice");
} elseif ($type_template == 'facture_relance') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder");
} elseif ($type_template == 'propal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendProposal");
} elseif ($type_template == 'supplier_proposal_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierProposal");
} elseif ($type_template == 'order_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendOrder");
} elseif ($type_template == 'order_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder");
} elseif ($type_template == 'invoice_supplier_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice");
} elseif ($type_template == 'shipping_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($type_template == 'fichinter_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter");
} elseif ($type_template == 'actioncomm_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm");
} elseif ($type_template == 'thirdparty') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty");
} elseif (!empty($type_template)) {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric");
}
$ret->label = 'default';
$ret->lang = $outputlangs->defaultlang;
$ret->topic = '';
$ret->joinfiles = 1;
$ret->content = $defaultmessage;
$ret->content_lines = '';
break;
}
$ret->label = 'default';
$ret->lang = $outputlangs->defaultlang;
$ret->topic = '';
$ret->joinfiles = 1;
$ret->content = $defaultmessage;
$ret->content_lines = '';
}
$db->free($resql);
return $ret;
} else {
dol_print_error($db);
$this->error=$db->lasterror;
$this->errors[]=$db->lasterror;
return -1;
}
$db->free($resql);
return $ret;
}
/**
@ -1382,7 +1402,9 @@ class FormMail extends Form
*/
public function fetchAllEMailTemplate($type_template, $user, $outputlangs, $active = 1)
{
$sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position";
global $conf;
$sql = "SELECT rowid, module, label, topic, content, content_lines, lang, fk_user, private, position";
$sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql .= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
@ -1399,6 +1421,14 @@ class FormMail extends Form
$num = $this->db->num_rows($resql);
$this->lines_model = array();
while ($obj = $this->db->fetch_object($resql)) {
// If template is for a module, check module is enabled.
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
continue;
}
}
$line = new ModelMail();
$line->id = $obj->rowid;
$line->label = $obj->label;

View File

@ -3422,7 +3422,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'help', 'holiday',
'intervention', 'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_asset', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_asset', 'object_barcode', 'object_bill', 'object_billr', 'object_billa', 'object_billd', 'object_bom',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert',
'object_folder', 'object_folder-open','object_generic',
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
@ -3464,7 +3464,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$arrayconvpictotofa = array(
'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'search-dollar', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book', 'asset'=>'money-check-alt',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical',
'bom'=>'shapes',
'chart'=>'chart-line', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd',
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
@ -3547,7 +3547,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$arrayconvpictotomorcess = array(
'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'asset'=>'infobox-bank_account',
'bank_account'=>'bg-infobox-bank_account',
'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billd'=>'infobox-commande',
'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande',
'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'conversation'=>'infobox-contrat',
'donation'=>'infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'infobox-action',
'hrm'=>'infobox-adherent', 'group'=>'infobox-adherent', 'intervention'=>'infobox-contrat',

View File

@ -69,13 +69,15 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA
if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) {
global $mysoc;
print img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"');
print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
print '<div class="classvatforalllines hidden inline-block nowraponall">';
//print '<input class="inline-block maxwidth50" type="text" name="vatforalllines" id="vatforalllines" value="">';
print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1);
print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
print '</div>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=vatforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
//print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
if (GETPOST('mode', 'aZ09') == 'vatforalllines') {
print '<div class="classvatforalllines inline-block nowraponall">';
print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1);
print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
print '</div>';
}
}
print '</td>';

View File

@ -2399,6 +2399,10 @@ class FactureFournisseur extends CommonInvoice
} elseif ($this->type == self::TYPE_DEPOSIT) {
$label = '<u class="paddingrightonly">'.$langs->transnoentitiesnoconv("Deposit").'</u>';
}
if (isset($this->status)) {
$alreadypaid = -1;
$label .= ' '.$this->getLibStatut(5, $alreadypaid);
}
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
}