diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 0c92bcb8950..616c8697c61 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy"));
+$socid = GETPOST('socid', 'int');
+
$action = GETPOST('action', 'aZ09');
$search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_doc_type = GETPOST("search_doc_type", 'alpha');
@@ -97,8 +99,9 @@ $pagenext = $page + 1;
if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.piece_num,t.rowid";
-
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db);
+$hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
@@ -160,145 +163,151 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.let
if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
-include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
+$parameters=array('socid'=>$socid);
+$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');
-if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
+if (empty($reshook))
{
- $search_mvt_num = '';
- $search_doc_type = '';
- $search_doc_ref = '';
- $search_doc_date = '';
- $search_accountancy_code = '';
- $search_accountancy_code_start = '';
- $search_accountancy_code_end = '';
- $search_accountancy_aux_code = '';
- $search_accountancy_aux_code_start = '';
- $search_accountancy_aux_code_end = '';
- $search_mvt_label = '';
- $search_direction = '';
- $search_ledger_code = '';
- $search_date_start = '';
- $search_date_end = '';
- $search_date_creation_start = '';
- $search_date_creation_end = '';
- $search_date_modification_start = '';
- $search_date_modification_end = '';
- $search_date_export_start = '';
- $search_date_export_end = '';
- $search_debit = '';
- $search_credit = '';
- $search_lettering_code = '';
-}
+ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
-// Must be after the remove filter action, before the export.
-$param = '';
-$filter = array ();
-if (! empty($search_date_start)) {
- $filter['t.doc_date>='] = $search_date_start;
- $tmp=dol_getdate($search_date_start);
- $param .= '&search_date_startmonth=' . $tmp['mon'] . '&search_date_startday=' . $tmp['mday'] . '&search_date_startyear=' . $tmp['year'];
-}
-if (! empty($search_date_end)) {
- $filter['t.doc_date<='] = $search_date_end;
- $tmp=dol_getdate($search_date_end);
- $param .= '&search_date_endmonth=' . $tmp['mon'] . '&search_date_endday=' . $tmp['mday'] . '&search_date_endyear=' . $tmp['year'];
-}
-if (! empty($search_doc_date)) {
- $filter['t.doc_date'] = $search_doc_date;
- $tmp=dol_getdate($search_doc_date);
- $param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year'];
-}
-if (! empty($search_doc_type)) {
- $filter['t.doc_type'] = $search_doc_type;
- $param .= '&search_doc_type=' . urlencode($search_doc_type);
-}
-if (! empty($search_doc_ref)) {
- $filter['t.doc_ref'] = $search_doc_ref;
- $param .= '&search_doc_ref=' . urlencode($search_doc_ref);
-}
-if (! empty($search_accountancy_code)) {
- $filter['t.numero_compte'] = $search_accountancy_code;
- $param .= '&search_accountancy_code=' . urlencode($search_accountancy_code);
-}
-if (! empty($search_accountancy_code_start)) {
- $filter['t.numero_compte>='] = $search_accountancy_code_start;
- $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
-}
-if (! empty($search_accountancy_code_end)) {
- $filter['t.numero_compte<='] = $search_accountancy_code_end;
- $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
-}
-if (! empty($search_accountancy_aux_code)) {
- $filter['t.subledger_account'] = $search_accountancy_aux_code;
- $param .= '&search_accountancy_aux_code=' . urlencode($search_accountancy_aux_code);
-}
-if (! empty($search_accountancy_aux_code_start)) {
- $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
- $param .= '&search_accountancy_aux_code_start=' . urlencode($search_accountancy_aux_code_start);
-}
-if (! empty($search_accountancy_aux_code_end)) {
- $filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
- $param .= '&search_accountancy_aux_code_end=' . urlencode($search_accountancy_aux_code_end);
-}
-if (! empty($search_mvt_label)) {
- $filter['t.label_operation'] = $search_mvt_label;
- $param .= '&search_mvt_label=' . urlencode($search_mvt_label);
-}
-if (! empty($search_direction)) {
- $filter['t.sens'] = $search_direction;
- $param .= '&search_direction=' . urlencode($search_direction);
-}
-if (! empty($search_ledger_code)) {
- $filter['t.code_journal'] = $search_ledger_code;
- $param .= '&search_ledger_code=' . urlencode($search_ledger_code);
-}
-if (! empty($search_mvt_num)) {
- $filter['t.piece_num'] = $search_mvt_num;
- $param .= '&search_mvt_num=' . urlencode($search_mvt_num);
-}
-if (! empty($search_date_creation_start)) {
- $filter['t.date_creation>='] = $search_date_creation_start;
- $tmp=dol_getdate($search_date_creation_start);
- $param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year'];
-}
-if (! empty($search_date_creation_end)) {
- $filter['t.date_creation<='] = $search_date_creation_end;
- $tmp=dol_getdate($search_date_creation_end);
- $param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year'];
-}
-if (! empty($search_date_modification_start)) {
- $filter['t.tms>='] = $search_date_modification_start;
- $tmp=dol_getdate($search_date_modification_start);
- $param .= '&date_modification_startmonth=' . $tmp['mon'] . '&date_modification_startday=' . $tmp['mday'] . '&date_modification_startyear=' . $tmp['year'];
-}
-if (! empty($search_date_modification_end)) {
- $filter['t.tms<='] = $search_date_modification_end;
- $tmp=dol_getdate($search_date_modification_end);
- $param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year'];
-}
-if (! empty($search_date_export_start)) {
- $filter['t.date_export>='] = $search_date_export_start;
- $tmp=dol_getdate($search_date_export_start);
- $param .= '&date_export_startmonth=' . $tmp['mon'] . '&date_export_startday=' . $tmp['mday'] . '&date_export_startyear=' . $tmp['year'];
-}
-if (! empty($search_date_export_end)) {
- $filter['t.date_export<='] = $search_date_export_end;
- $tmp=dol_getdate($search_date_export_end);
- $param .= '&date_export_endmonth=' . $tmp['mon'] . '&date_export_endday=' . $tmp['mday'] . '&date_export_endyear=' . $tmp['year'];
-}
-if (! empty($search_debit)) {
- $filter['t.debit'] = $search_debit;
- $param .= '&search_debit=' . urlencode($search_debit);
-}
-if (! empty($search_credit)) {
- $filter['t.credit'] = $search_credit;
- $param .= '&search_credit=' . urlencode($search_credit);
-}
-if (! empty($search_lettering_code)) {
- $filter['t.lettering_code'] = $search_lettering_code;
- $param .= '&search_lettering_code=' . urlencode($search_lettering_code);
-}
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
+ {
+ $search_mvt_num = '';
+ $search_doc_type = '';
+ $search_doc_ref = '';
+ $search_doc_date = '';
+ $search_accountancy_code = '';
+ $search_accountancy_code_start = '';
+ $search_accountancy_code_end = '';
+ $search_accountancy_aux_code = '';
+ $search_accountancy_aux_code_start = '';
+ $search_accountancy_aux_code_end = '';
+ $search_mvt_label = '';
+ $search_direction = '';
+ $search_ledger_code = '';
+ $search_date_start = '';
+ $search_date_end = '';
+ $search_date_creation_start = '';
+ $search_date_creation_end = '';
+ $search_date_modification_start = '';
+ $search_date_modification_end = '';
+ $search_date_export_start = '';
+ $search_date_export_end = '';
+ $search_debit = '';
+ $search_credit = '';
+ $search_lettering_code = '';
+ }
+ // Must be after the remove filter action, before the export.
+ $param = '';
+ $filter = array ();
+ if (! empty($search_date_start)) {
+ $filter['t.doc_date>='] = $search_date_start;
+ $tmp=dol_getdate($search_date_start);
+ $param .= '&search_date_startmonth=' . $tmp['mon'] . '&search_date_startday=' . $tmp['mday'] . '&search_date_startyear=' . $tmp['year'];
+ }
+ if (! empty($search_date_end)) {
+ $filter['t.doc_date<='] = $search_date_end;
+ $tmp=dol_getdate($search_date_end);
+ $param .= '&search_date_endmonth=' . $tmp['mon'] . '&search_date_endday=' . $tmp['mday'] . '&search_date_endyear=' . $tmp['year'];
+ }
+ if (! empty($search_doc_date)) {
+ $filter['t.doc_date'] = $search_doc_date;
+ $tmp=dol_getdate($search_doc_date);
+ $param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year'];
+ }
+ if (! empty($search_doc_type)) {
+ $filter['t.doc_type'] = $search_doc_type;
+ $param .= '&search_doc_type=' . urlencode($search_doc_type);
+ }
+ if (! empty($search_doc_ref)) {
+ $filter['t.doc_ref'] = $search_doc_ref;
+ $param .= '&search_doc_ref=' . urlencode($search_doc_ref);
+ }
+ if (! empty($search_accountancy_code)) {
+ $filter['t.numero_compte'] = $search_accountancy_code;
+ $param .= '&search_accountancy_code=' . urlencode($search_accountancy_code);
+ }
+ if (! empty($search_accountancy_code_start)) {
+ $filter['t.numero_compte>='] = $search_accountancy_code_start;
+ $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
+ }
+ if (! empty($search_accountancy_code_end)) {
+ $filter['t.numero_compte<='] = $search_accountancy_code_end;
+ $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
+ }
+ if (! empty($search_accountancy_aux_code)) {
+ $filter['t.subledger_account'] = $search_accountancy_aux_code;
+ $param .= '&search_accountancy_aux_code=' . urlencode($search_accountancy_aux_code);
+ }
+ if (! empty($search_accountancy_aux_code_start)) {
+ $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
+ $param .= '&search_accountancy_aux_code_start=' . urlencode($search_accountancy_aux_code_start);
+ }
+ if (! empty($search_accountancy_aux_code_end)) {
+ $filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
+ $param .= '&search_accountancy_aux_code_end=' . urlencode($search_accountancy_aux_code_end);
+ }
+ if (! empty($search_mvt_label)) {
+ $filter['t.label_operation'] = $search_mvt_label;
+ $param .= '&search_mvt_label=' . urlencode($search_mvt_label);
+ }
+ if (! empty($search_direction)) {
+ $filter['t.sens'] = $search_direction;
+ $param .= '&search_direction=' . urlencode($search_direction);
+ }
+ if (! empty($search_ledger_code)) {
+ $filter['t.code_journal'] = $search_ledger_code;
+ $param .= '&search_ledger_code=' . urlencode($search_ledger_code);
+ }
+ if (! empty($search_mvt_num)) {
+ $filter['t.piece_num'] = $search_mvt_num;
+ $param .= '&search_mvt_num=' . urlencode($search_mvt_num);
+ }
+ if (! empty($search_date_creation_start)) {
+ $filter['t.date_creation>='] = $search_date_creation_start;
+ $tmp=dol_getdate($search_date_creation_start);
+ $param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year'];
+ }
+ if (! empty($search_date_creation_end)) {
+ $filter['t.date_creation<='] = $search_date_creation_end;
+ $tmp=dol_getdate($search_date_creation_end);
+ $param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year'];
+ }
+ if (! empty($search_date_modification_start)) {
+ $filter['t.tms>='] = $search_date_modification_start;
+ $tmp=dol_getdate($search_date_modification_start);
+ $param .= '&date_modification_startmonth=' . $tmp['mon'] . '&date_modification_startday=' . $tmp['mday'] . '&date_modification_startyear=' . $tmp['year'];
+ }
+ if (! empty($search_date_modification_end)) {
+ $filter['t.tms<='] = $search_date_modification_end;
+ $tmp=dol_getdate($search_date_modification_end);
+ $param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year'];
+ }
+ if (! empty($search_date_export_start)) {
+ $filter['t.date_export>='] = $search_date_export_start;
+ $tmp=dol_getdate($search_date_export_start);
+ $param .= '&date_export_startmonth=' . $tmp['mon'] . '&date_export_startday=' . $tmp['mday'] . '&date_export_startyear=' . $tmp['year'];
+ }
+ if (! empty($search_date_export_end)) {
+ $filter['t.date_export<='] = $search_date_export_end;
+ $tmp=dol_getdate($search_date_export_end);
+ $param .= '&date_export_endmonth=' . $tmp['mon'] . '&date_export_endday=' . $tmp['mday'] . '&date_export_endyear=' . $tmp['year'];
+ }
+ if (! empty($search_debit)) {
+ $filter['t.debit'] = $search_debit;
+ $param .= '&search_debit=' . urlencode($search_debit);
+ }
+ if (! empty($search_credit)) {
+ $filter['t.credit'] = $search_credit;
+ $param .= '&search_credit=' . urlencode($search_credit);
+ }
+ if (! empty($search_lettering_code)) {
+ $filter['t.lettering_code'] = $search_lettering_code;
+ $param .= '&search_lettering_code=' . urlencode($search_lettering_code);
+ }
+}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@@ -527,6 +536,11 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
+$parameters=array();
+$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
+else $moreforfilter = $hookmanager->resPrint;
+
print '
';
print '
';
@@ -635,6 +649,13 @@ if (! empty($arrayfields['t.code_journal']['checked']))
{
print ' | ';
}
+
+
+// Fields from hook
+$parameters=array('arrayfields'=>$arrayfields);
+$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+
// Date creation
if (! empty($arrayfields['t.date_creation']['checked']))
{
@@ -695,6 +716,10 @@ if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arr
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
+// Hook fields
+$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
+$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
@@ -796,6 +821,11 @@ if ($num > 0)
if (! $i) $totalarray['nbfield']++;
}
+ // Fields from hook
+ $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
+ $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+
// Creation operation date
if (! empty($arrayfields['t.date_creation']['checked']))
{
@@ -853,10 +883,15 @@ if ($num > 0)
elseif ($totalarray['totalcreditfield'] == $i) print ''.price($totalarray['totalcredit']).' | ';
else print ' | ';
}
+ $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+ $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+
print '';
}
}
+
print "
";
print '
';
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 36162e8b9aa..25b04c7c1e2 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1615,11 +1615,14 @@ class Propal extends CommonObject
/**
* Load array lines
*
- * @param int $only_product Return only physical products
+ * @param int $only_product Return only physical products
+ * @param int $loadalsotranslation Return translation for products
+ *
* @return int <0 if KO, >0 if OK
*/
- public function fetch_lines($only_product = 0)
+ public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
{
+ global $langs, $conf;
// phpcs:enable
$this->lines=array();
@@ -1712,6 +1715,13 @@ class Propal extends CommonObject
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals();
+
+ // multilangs
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
+ $line = new Product($this->db);
+ $line->fetch($objp->fk_product);
+ $line->getMultiLangs();
+ }
$this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 4eb3b3236e0..8469dc0cd1f 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1888,10 +1888,12 @@ class Commande extends CommonOrder
* Load array lines
*
* @param int $only_product Return only physical products
+ * @param int $loadalsotranslation Return translation for products
* @return int <0 if KO, >0 if OK
*/
- public function fetch_lines($only_product = 0)
+ public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
{
+ global $langs, $conf;
// phpcs:enable
$this->lines=array();
@@ -1983,6 +1985,13 @@ class Commande extends CommonOrder
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals();
+
+ // multilangs
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
+ $line = new Product($this->db);
+ $line->fetch($objp->fk_product);
+ $line->getMultiLangs();
+ }
$this->lines[$i] = $line;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index f249443ac66..a502b885ab3 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1467,10 +1467,14 @@ class Facture extends CommonInvoice
/**
* Load all detailed lines into this->lines
*
+ * @param int $only_product Return only physical products
+ * @param int $loadalsotranslation Return translation for products
+ *
* @return int 1 if OK, < 0 if KO
*/
- public function fetch_lines()
+ public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
{
+ global $langs, $conf;
// phpcs:enable
$this->lines=array();
@@ -1559,6 +1563,13 @@ class Facture extends CommonInvoice
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals();
+
+ // multilangs
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
+ $line = new Product($this->db);
+ $line->fetch($objp->fk_product);
+ $line->getMultiLangs();
+ }
$this->lines[$i] = $line;
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 91a373743c4..e16187412a0 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -716,10 +716,14 @@ class Contrat extends CommonObject
* Load lines array into this->lines.
* This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed
*
+ * @param int $only_product Return only physical products
+ * @param int $loadalsotranslation Return translation for products
+ *
* @return ContratLigne[] Return array of contract lines
*/
- public function fetch_lines()
+ public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
{
+ global $langs, $conf;
// phpcs:enable
$this->nbofserviceswait=0;
$this->nbofservicesopened=0;
@@ -828,6 +832,13 @@ class Contrat extends CommonObject
// Retreive all extrafields for contract
// fetch optionals attributes and labels
$line->fetch_optionals();
+
+ // multilangs
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
+ $line = new Product($this->db);
+ $line->fetch($objp->fk_product);
+ $line->getMultiLangs();
+ }
$this->lines[$pos] = $line;
$this->lines_id_index_mapper[$line->id] = $pos;
diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php
index b5eb5257ecc..0900c8c3ffe 100644
--- a/htdocs/core/actions_extrafields.inc.php
+++ b/htdocs/core/actions_extrafields.inc.php
@@ -27,7 +27,7 @@ $maxsizestring=255;
$maxsizeint=10;
$mesg=array();
-$extrasize=GETPOST('size', 'int');
+$extrasize=GETPOST('size', 'intcomma');
$type=GETPOST('type', 'alpha');
$param=GETPOST('param', 'alpha');
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index fae30c05e73..b8f5c0480b5 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1645,7 +1645,10 @@ class ExtraFields
elseif ($type == 'double')
{
if (!empty($value)) {
- $value=price($value);
+ //$value=price($value);
+ $sizeparts = explode(",", $size);
+ $number_decimals = $sizeparts[1];
+ $value=price($value, 0, $langs, 0, 0, $number_decimals, '');
}
}
elseif ($type == 'boolean')
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index 53cdd50b644..71345305579 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -7,7 +7,7 @@
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017 Ferran Marcet
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
/**
* \file htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
* \ingroup commande
- * \brief File of the class allowing to generate the orders to the Eratosthene model
+ * \brief File of Class to generate PDF orders with template Eratosthène
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
@@ -149,13 +149,13 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1; // Affiche logo
- $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
- $this->option_modereg = 1; // Affiche mode reglement
- $this->option_condreg = 1; // Affiche conditions reglement
- $this->option_codeproduitservice = 1; // Affiche code produit-service
- $this->option_multilang = 1; // Dispo en plusieurs langues
- $this->option_escompte = 0; // Affiche si il y a eu escompte
+ $this->option_logo = 1; // Display logo
+ $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
+ $this->option_modereg = 1; // Display payment mode
+ $this->option_condreg = 1; // Display payment terms
+ $this->option_codeproduitservice = 1; // Display product-service code
+ $this->option_multilang = 1; // Available in several languages
+ $this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
index f10f858544f..b426cc77d5e 100644
--- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php
@@ -25,7 +25,7 @@
/**
* \file htdocs/core/modules/commande/doc/pdf_proforma.modules.php
* \ingroup commande
- * \brief Fichier de la classe permettant de generer les commandes au modele Proforma
+ * \brief File of Class to generate PDF orders with template Proforma
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/doc/pdf_einstein.modules.php';
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
- * Classe permettant de generer les commandes au modele Proforma
+ * Class to generate PDF orders with template Proforma
*/
class pdf_proforma extends pdf_einstein
{
diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
index 97fedf45808..d358149d7cc 100644
--- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php
+++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
@@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2008 Raphael Bertrand (Resultic)
* Copyright (C) 2011 Fabrice CHERRIER
- * Copyright (C) 2013-2018 Philippe Grand
+ * Copyright (C) 2013-2019 Philippe Grand
* Copyright (C) 2015 Marcos García
* Copyright (C) 2018 Frédéric France
*
@@ -144,13 +144,13 @@ class pdf_strato extends ModelePDFContract
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1; // Affiche logo
- $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
- $this->option_modereg = 0; // Affiche mode reglement
- $this->option_condreg = 0; // Affiche conditions reglement
- $this->option_codeproduitservice = 0; // Affiche code produit-service
- $this->option_multilang = 0; // Dispo en plusieurs langues
- $this->option_draft_watermark = 1; //Support add of a watermark on drafts
+ $this->option_logo = 1; // Display logo
+ $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
+ $this->option_modereg = 0; // Display payment mode
+ $this->option_condreg = 0; // Display payment terms
+ $this->option_codeproduitservice = 0; // Display product-service code
+ $this->option_multilang = 0; // Available in several languages
+ $this->option_draft_watermark = 1; // Support add of a watermark on drafts
// Get source company
$this->emetteur=$mysoc;
diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
index 8696bc21a02..235e7e5c66c 100644
--- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
@@ -3,7 +3,7 @@
* Copyright (C) 2005-2015 Laurent Destailleur
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2013 Florian Henry
- * Copyright (C) 2015 Marcos García
+ * Copyright (C) 2015 Marcos García
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
/**
* \file htdocs/core/modules/expedition/doc/pdf_merou.modules.php
* \ingroup expedition
- * \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou
+ * \brief Class file used to generate the dispatch slips for the Merou model
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
@@ -134,7 +134,7 @@ class pdf_merou extends ModelePdfExpedition
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1;
+ $this->option_logo = 1; // Display logo
// Get source company
$this->emetteur=$mysoc;
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index e8de6ffdb73..ea5efb359d0 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -23,7 +23,7 @@
/**
* \file htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
* \ingroup expedition
- * \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget
+ * \brief Class file used to generate the dispatch slips for the Rouget model
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
@@ -133,7 +133,7 @@ class pdf_rouget extends ModelePdfExpedition
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1;
+ $this->option_logo = 1; // Display logo
// Get source company
$this->emetteur=$mysoc;
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index de1ebc00a8b..9890df8b607 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -160,13 +160,13 @@ class pdf_crabe extends ModelePDFFactures
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1; // Affiche logo
- $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
- $this->option_modereg = 1; // Affiche mode reglement
- $this->option_condreg = 1; // Affiche conditions reglement
- $this->option_codeproduitservice = 1; // Affiche code produit-service
- $this->option_multilang = 1; // Dispo en plusieurs langues
- $this->option_escompte = 1; // Affiche si il y a eu escompte
+ $this->option_logo = 1; // Display logo
+ $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
+ $this->option_modereg = 1; // Display payment mode
+ $this->option_condreg = 1; // Display payment terms
+ $this->option_codeproduitservice = 1; // Display product-service code
+ $this->option_multilang = 1; // Available in several languages
+ $this->option_escompte = 1; // Displays if there has been a discount
$this->option_credit_note = 1; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 9c7c7797841..1413bd3c777 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -160,13 +160,13 @@ class pdf_sponge extends ModelePDFFactures
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1; // Affiche logo
- $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
- $this->option_modereg = 1; // Affiche mode reglement
- $this->option_condreg = 1; // Affiche conditions reglement
- $this->option_codeproduitservice = 1; // Affiche code produit-service
- $this->option_multilang = 1; // Dispo en plusieurs langues
- $this->option_escompte = 1; // Affiche si il y a eu escompte
+ $this->option_logo = 1; // Display logo
+ $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
+ $this->option_modereg = 1; // Display payment mode
+ $this->option_condreg = 1; // Display payment terms
+ $this->option_codeproduitservice = 1; // Display product-service code
+ $this->option_multilang = 1; // Available in several languages
+ $this->option_escompte = 1; // Displays if there has been a discount
$this->option_credit_note = 1; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
@@ -449,7 +449,7 @@ class pdf_sponge extends ModelePDFFactures
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
-
+
$pdf->startTransaction();
$pdf->SetFont('', '', $default_font_size - 1);
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index d60c4d835a5..00f9c84338e 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -234,7 +234,8 @@ if ($id > 0 || ! empty($ref))
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
-
+
+ if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty);
$total_ht+=$objp->total_ht;
$total_qty+=$objp->qty;
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index afd3a51ec8e..1c5c4b82a5d 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -595,7 +595,7 @@ if ($sql_select)
print '';
//print ''.$prodreftxt.' | ';
-
+ if ($type_element == 'invoice' && $objp->doc_type == Facture::TYPE_CREDIT_NOTE) $objp->prod_qty=-($objp->prod_qty);
print ''.$objp->prod_qty.' | ';
$total_qty+=$objp->prod_qty;