';
print '| ';
print $langs->trans('PaymentMode');
@@ -440,7 +440,7 @@ if ($object->id > 0) {
print ' | ';
if (isModEnabled("banque")) {
- // Compte bancaire par défaut
+ // Default bank account for payments
print '';
print '| ';
print $langs->trans('PaymentBankAccount');
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 1d2631c0b6c..eb1791285c0 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -209,12 +209,12 @@ $checkedtypetiers = 0;
$arrayfields = array(
'p.ref'=>array('label'=>"Ref", 'checked'=>1),
'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>-1),
- 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1)),
- 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1)),
+ 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(isModEnabled('project') ? 1 : 0)),
+ 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(isModEnabled('project') ? 1 : 0)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1),
's.town'=>array('label'=>"Town", 'checked'=>-1),
- 's.zip'=>array('label'=>"Zip", 'checked'=>1),
+ 's.zip'=>array('label'=>"Zip", 'checked'=>-1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
@@ -1430,6 +1430,14 @@ if ($resql) {
}
print " | \n";
+ $totalarray = array(
+ 'nbfield' => 0,
+ 'val' => array(
+ 'p.total_ht' => 0,
+ 'p.total_tva' => 0,
+ 'p.total_ttc' => 0,
+ ),
+ );
// Fields title
print '';
@@ -1550,14 +1558,6 @@ if ($resql) {
if (!empty($arrayfields['total_mark_rate']['checked'])) {
print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
}
- $totalarray = array(
- 'nbfield' => 0,
- 'val' => array(
- 'p.total_ht' => 0,
- 'p.total_tva' => 0,
- 'p.total_ttc' => 0,
- ),
- );
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@@ -1570,6 +1570,7 @@ if ($resql) {
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+
print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) {
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
@@ -1614,6 +1615,7 @@ if ($resql) {
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
+
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
@@ -2076,7 +2078,7 @@ if ($resql) {
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives
- print '| ';
+ print ' | ';
if ($obj->socid > 0) {
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) {
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 54cd0f2b58c..a56f0486e6f 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -59,7 +59,10 @@ $search_number = GETPOST('search_number', 'alpha');
$search_status = GETPOST('search_status') ?GETPOST('search_status', 'alpha') : 'opened'; // 'all' or ''='opened'
$optioncss = GETPOST('optioncss', 'alpha');
-$search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array");
+$search_category_list ="";
+if (isModEnabled('categorie')) {
+ $search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array");
+}
$socid = 0;
// Security check
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index b586c69d464..9bd14d120fe 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -1756,8 +1756,8 @@ abstract class CommonInvoice extends CommonObject
if ($this->ref_client) {
$complementaryinfo .= '/20/'.$this->ref_client;
}
- if ($this->thirdparty->vat_number) {
- $complementaryinfo .= '/30/'.$this->thirdparty->vat_number;
+ if ($this->thirdparty->tva_intra) {
+ $complementaryinfo .= '/30/'.$this->thirdparty->tva_intra;
}
// Header
diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php
index b76ad8c7a47..3b10f38d238 100644
--- a/htdocs/core/class/dolreceiptprinter.class.php
+++ b/htdocs/core/class/dolreceiptprinter.class.php
@@ -46,6 +46,7 @@
* {dol_print_barcode} Print barcode
* {dol_print_logo} Print logo stored on printer. Example : 32|32
* {dol_print_logo_old} Print logo stored on printer. Must be followed by logo code. For old printers.
+ * {dol_print_logo_old_cf} Print logo stored on printer. Must be followed by logo code. For old printers. May help for centering image.
* {dol_print_object_lines} Print object lines
* {dol_print_object_tax} Print object total tax
* {dol_print_object_local_tax} Print object local tax
@@ -63,7 +64,8 @@
* Replaced by month number
* Replaced by day number
* Replaced by day number
- * Replaced by current date
+ * Replaced by current date and time
+ * Replaced by current date without time
* Replaced by object id
* Replaced by object ref
* Replaced by customer firstname
@@ -191,10 +193,18 @@ class dolReceiptPrinter extends Printer
'dol_value_day' => 'DOL_VALUE_DAY',
'dol_value_day_letters' => 'DOL_VALUE_DAY',
'dol_value_currentdate' => 'DOL_VALUE_CURRENTDATE',
+ 'dol_value_currentdate_notime' => 'CurrentDateWithTime',
+ 'dol_value_currentdate_letters' => 'DOL_VALUE_CURRENTDATE_LETTERS',
+ 'dol_value_currentyear' => 'CurrentYear',
+ 'dol_value_currentmonth_letters' => 'DOL_VALUE_CURRENT_MONTH_LETTERS',
+ 'dol_value_currentmonth' => 'DOL_VALUE_CURRENT_MONTH',
+ 'dol_value_currentday' => 'DOL_VALUE_CURRENT_DAY',
+ 'dol_value_currentday_letters' => 'DOL_VALUE_CURRENT_DAY',
'dol_print_payment' => 'DOL_PRINT_PAYMENT',
'dol_print_curr_date' => 'DOL_PRINT_CURR_DATE',
'dol_print_logo' => 'DOL_PRINT_LOGO',
'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD',
+ 'dol_print_logo_old_cf' => 'DOL_PRINT_LOGO_OLD_CF',
'dol_value_object_id' => 'InvoiceID',
'dol_value_object_ref' => 'InvoiceRef',
'dol_print_object_lines' => 'DOL_PRINT_OBJECT_LINES',
@@ -577,9 +587,12 @@ class dolReceiptPrinter extends Printer
public function sendToPrinter($object, $templateid, $printerid)
{
global $conf, $mysoc, $langs, $user;
+
+ $langs->load('bills');
+
$error = 0;
$ret = $this->loadTemplate($templateid);
-
+ $now = dol_now('tzuser');
// tags a remplacer par leur valeur avant de parser (dol_value_xxx)
$this->template = str_replace('{dol_value_object_id}', $object->id, $this->template);
$this->template = str_replace('{dol_value_object_ref}', $object->ref, $this->template);
@@ -591,7 +604,15 @@ class dolReceiptPrinter extends Printer
$this->template = str_replace('{dol_value_month}', dol_print_date($object->date, '%m'), $this->template);
$this->template = str_replace('{dol_value_day}', dol_print_date($object->date, '%d'), $this->template);
$this->template = str_replace('{dol_value_day_letters}', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template);
- $this->template = str_replace('{dol_value_currentdate}', dol_print_date(dol_now(), 'dayhour'), $this->template);
+
+ $this->template = str_replace('{dol_value_currentdate}', dol_print_date($now, 'dayhour'), $this->template);
+ $this->template = str_replace('{dol_value_currentdate_notime}', dol_print_date($now, 'day'), $this->template);
+ $this->template = str_replace('{dol_value_currentdate_letters}', dol_print_date($now, 'dayhourtext'), $this->template);
+ $this->template = str_replace('{dol_value_currentyear}', dol_print_date($now, '%Y'), $this->template);
+ $this->template = str_replace('{dol_value_currentmonth_letters}', $langs->trans("Month".dol_print_date($now, '%m')), $this->template);
+ $this->template = str_replace('{dol_value_currentmonth}', dol_print_date($now, '%m'), $this->template);
+ $this->template = str_replace('{dol_value_currentday}', dol_print_date($now, '%d'), $this->template);
+ $this->template = str_replace('{dol_value_currentday_letters}', $langs->trans("Day".dol_print_date($now, '%m')[1]), $this->template);
$this->template = str_replace('{dol_value_customer_firstname}', $object->thirdparty->firstname, $this->template);
$this->template = str_replace('{dol_value_customer_lastname}', $object->thirdparty->lastname, $this->template);
@@ -759,6 +780,10 @@ class dolReceiptPrinter extends Printer
$img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo);
$this->printer->bitImage($img);
break;
+ case 'DOL_PRINT_LOGO_OLD_CF':
+ $img = EscposImage::load(DOL_DATA_ROOT.'/mycompany/logos/'.$mysoc->logo);
+ $this->printer->bitImageColumnFormat($img);
+ break;
case 'DOL_PRINT_QRCODE':
// $vals[$tplline]['value'] -> qrCode($content, $ec, $size, $model)
$this->printer->qrcode($vals[$tplline]['value']);
@@ -845,9 +870,9 @@ class dolReceiptPrinter extends Printer
}
break;
case 'DOL_VALUE_PLACE':
- $sql = "SELECT floor, label FROM ".$this->db->prefix()."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref)));
- $resql = $this->db->query($sql);
- $obj = $this->db->fetch_object($resql);
+ $sql = "SELECT floor, label FROM ".$this->db->prefix()."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref)));
+ $resql = $this->db->query($sql);
+ $obj = $this->db->fetch_object($resql);
if ($obj) {
$this->printer->text($obj->label);
}
diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php
index 68b8410e647..f08640c6e55 100644
--- a/htdocs/core/class/html.formsms.class.php
+++ b/htdocs/core/class/html.formsms.class.php
@@ -285,7 +285,7 @@ function limitChars(textarea, limit, infodiv)
print '';
} else {
print '';
- print ' '.$langs->trans("SmsInfoCharRemain").': '.(160 - dol_strlen($defaultmessage)).' | ';
+ print ''.$langs->trans("SmsInfoCharRemain").': '.(160 - dol_strlen($defaultmessage)).' ';
}
print " \n";
}
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 0f00bbf770d..f2a185e534d 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -334,7 +334,7 @@ class FormTicket
print '';
// Severity => Priority
- print ' | ';
+ print ' | | ';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 1);
print ' | ';
diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
index b11e2a7e563..8be86dda944 100644
--- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
+++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
@@ -173,7 +173,9 @@ class doc_generic_asset_odt extends ModelePDFAsset
if ($nbofiles) {
$texte .= '';
}
diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
index 2dcf5512dc1..bec28b941aa 100644
--- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
+++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
@@ -169,7 +169,9 @@ class doc_generic_bom_odt extends ModelePDFBom
$texte .= '';
}
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index 9239ec0ed4b..5e94397bc91 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -159,7 +159,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
$texte .= $conf->global->COMMANDE_ADDON_PDF_ODT_PATH;
$texte .= '';
$texte .= '';
- $texte .= '';
+ $texte .= '';
$texte .= '
';
// Scan directories
@@ -176,7 +176,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
$texte .= '';
}
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index 222286d5592..dad1ebc9122 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -51,8 +51,7 @@ class doc_generic_contract_odt extends ModelePDFContract
public $phpmin = array(7, 0);
/**
- * Dolibarr version of the loaded document
- * @var string
+ * @var string Dolibarr version of the loaded document
*/
public $version = 'dolibarr';
@@ -94,7 +93,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
- // Recupere emetteur
+ // Get source company
$this->emetteur = $mysoc;
if (!$this->emetteur->country_code) {
$this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
@@ -123,7 +122,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$texte .= '';
$texte .= '';
$texte .= '';
- $texte .= '';
+ $texte .= '';
// List of directories area
$texte .= '';
@@ -161,10 +160,25 @@ class doc_generic_contract_odt extends ModelePDFContract
$texte .= ' ';
// Scan directories
- if (count($listofdir)) {
- $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).'';
+ $nbofiles = count($listoffiles);
+ if (!empty($conf->global->CONTRACT_ADDON_PDF_ODT_PATH)) {
+ $texte .= $langs->trans("NumberOfModelFilesFound").': ';
+ //$texte.=$nbofiles?'':'';
+ $texte .= count($listoffiles);
+ //$texte.=$nbofiles?'':'';
+ $texte .= '';
}
+ if ($nbofiles) {
+ $texte .= '';
+ }
// Add input to upload a new template file.
$texte .= ''.$langs->trans("UploadNewTemplate");
$maxfilesizearray = getMaxFileSizeArray();
@@ -228,7 +242,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$sav_charset_output = $outputlangs->charset_output;
$outputlangs->charset_output = 'UTF-8';
- // Load traductions files required by page
+ // Load translation files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
if ($conf->contrat->multidir_output[$object->entity]) {
@@ -382,16 +396,21 @@ class doc_generic_contract_odt extends ModelePDFContract
dol_syslog($e->getMessage(), LOG_INFO);
}
+ // Call the ODTSubstitution hook
+ $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
+ $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+
foreach ($tmparray as $key => $value) {
try {
- if (preg_match('/logo$/', $key)) { // Image
+ if (preg_match('/logo$/', $key)) {
+ // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
- } else // Text
- {
+ } else {
+ // Text
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
} catch (OdfException $e) {
@@ -448,7 +467,7 @@ class doc_generic_contract_odt extends ModelePDFContract
}
// Call the beforeODTSave hook
- $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
+ $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Write new file
@@ -457,6 +476,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$odfHandler->exportAsAttachedPDF($file);
} catch (Exception $e) {
$this->error = $e->getMessage();
+ dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
} else {
@@ -464,10 +484,12 @@ class doc_generic_contract_odt extends ModelePDFContract
$odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error = $e->getMessage();
+ dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
+ $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
index cfb23269ca9..73793c5a757 100644
--- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
+++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
@@ -175,7 +175,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$texte .= ' ';
}
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index 061f18e5442..0b8fa2d4621 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -174,7 +174,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texte .= ' ';
}
diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
index 2ab951147b9..ed48c93c4de 100644
--- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
+++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
@@ -164,7 +164,9 @@ class doc_generic_member_odt extends ModelePDFMember
$texte .= ' ';
}
diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
index 42b3c529fe4..b89c4eab2cd 100644
--- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
+++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
@@ -175,7 +175,9 @@ class doc_generic_mo_odt extends ModelePDFMo
$texte .= ' ';
}
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index 4e8be5f6389..2015da21f61 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -468,7 +468,9 @@ class doc_generic_project_odt extends ModelePDFProjects
$texte .= ' ';
}
diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
index ba386eedfe7..a7f3eab4a30 100644
--- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
+++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
@@ -433,7 +433,9 @@ class doc_generic_task_odt extends ModelePDFTask
$texte .= ' ';
}
diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
index 4d8edca7f64..4ebc742b4bb 100644
--- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
+++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
@@ -168,7 +168,9 @@ class doc_generic_reception_odt extends ModelePdfReception
$texte .= ' ';
}
diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
index 0f5adc3fc7d..eb6ba838d7a 100644
--- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
+++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
@@ -172,7 +172,9 @@ class doc_generic_stock_odt extends ModelePDFStock
$texte .= ' ';
}
diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
index f3177233589..12bbcc12edc 100644
--- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
@@ -163,7 +163,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
// Scan directories
$nbofiles = count($listoffiles);
- if (!empty($conf->global->COMMANDE_ADDON_PDF_ODT_PATH)) {
+ if (!empty($conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': ';
//$texte.=$nbofiles?'':'';
$texte .= count($listoffiles);
@@ -175,7 +175,9 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
$texte .= '';
}
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
index 5e4b75a183e..7ff463df8b3 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
@@ -5,7 +5,7 @@
* Copyright (C) 2010-2014 Juanjo Menent
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017 Ferran Marcet
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2022 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
@@ -1567,7 +1567,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
'border-left' => false, // remove left line separator
);
- if (!empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) {
+ if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) {
$this->cols['photo']['status'] = true;
}
diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
index fc75445123a..55a7710c5a4 100644
--- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
@@ -179,7 +179,9 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$texte .= '';
diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
index ff6359be5ce..1a2d1e537cc 100644
--- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
+++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
@@ -161,7 +161,9 @@ class doc_generic_ticket_odt extends ModelePDFTicket
$texte .= '';
}
diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
index d129c80f126..1c3e346203b 100644
--- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
+++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
@@ -192,7 +192,9 @@ class doc_generic_user_odt extends ModelePDFUser
$texte .= '';
}
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index d3981dcf264..4842a27fa77 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -84,6 +84,13 @@ class Expedition extends CommonObject
*/
public $picto = 'dolly';
+
+ /**
+ * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
+ */
+ public $fields = array();
+
+
public $socid;
/**
diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php
index 8eb31896f38..aa4e40fcb8f 100644
--- a/htdocs/expedition/class/expeditionstats.class.php
+++ b/htdocs/expedition/class/expeditionstats.class.php
@@ -131,6 +131,54 @@ class ExpeditionStats extends Stats
return $this->_getNbByYear($sql);
}
+ /**
+ * Return the orders amount by month for a year
+ *
+ * @param int $year Year to scan
+ * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
+ * @return array Array with amount by month
+ */
+ public function getAmountByMonth($year, $format = 0)
+ {
+ global $user;
+
+ $sql = "SELECT date_format(c.date_valid,'%m') as dm, SUM(c.".$this->field.")";
+ $sql .= " FROM ".$this->from;
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
+ $sql .= $this->join;
+ $sql .= " WHERE ".$this->where;
+ $sql .= " GROUP BY dm";
+ $sql .= $this->db->order('dm', 'DESC');
+
+ $res = $this->_getAmountByMonth($year, $sql, $format);
+ return $res;
+ }
+
+ /**
+ * Return the orders amount average by month for a year
+ *
+ * @param int $year year for stats
+ * @return array array with number by month
+ */
+ public function getAverageByMonth($year)
+ {
+ global $user;
+
+ $sql = "SELECT date_format(c.date_valid,'%m') as dm, AVG(c.".$this->field.")";
+ $sql .= " FROM ".$this->from;
+ if (empty($user->rights->societe->client->voir) && !$this->socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
+ $sql .= $this->join;
+ $sql .= " WHERE ".$this->where;
+ $sql .= " GROUP BY dm";
+ $sql .= $this->db->order('dm', 'DESC');
+
+ return $this->_getAverageByMonth($year, $sql);
+ }
+
/**
* Return nb, total and average
*
diff --git a/htdocs/expedition/stats/month.php b/htdocs/expedition/stats/month.php
index 34842efaaf3..398bc381715 100644
--- a/htdocs/expedition/stats/month.php
+++ b/htdocs/expedition/stats/month.php
@@ -47,11 +47,12 @@ $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mesg = '';
+$mode = '';
print load_fiche_titre($langs->trans("StatisticsOfSendings").' '.$year, $mesg);
-$stats = new ExpeditionStats($db);
-$data = $stats->getNbExpeditionByMonth($year);
+$stats = new ExpeditionStats($db, $socid, $mode);
+$data = $stats->getNbByMonth($year);
dol_mkdir($conf->expedition->dir_temp);
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 2c929aa40ba..f3260d8ea48 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -106,7 +106,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
- // terms of the settlement
+ // Set payment terms of the settlement
if ($action == 'setconditions' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_supplier_id', 'int'));
@@ -114,7 +114,7 @@ if (empty($reshook)) {
dol_print_error($db, $object->error);
}
}
- // mode de reglement
+ // Payment mode
if ($action == 'setmode' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_supplier_id', 'int'));
@@ -123,6 +123,15 @@ if (empty($reshook)) {
}
}
+ // Bank account
+ if ($action == 'setbankaccount' && $user->rights->societe->creer) {
+ $object->fetch($id);
+ $result = $object->setBankAccount(GETPOST('fk_account', 'int'));
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+
// update supplier order min amount
if ($action == 'setsupplier_order_min_amount') {
$object->fetch($id);
@@ -276,7 +285,7 @@ if ($object->id > 0) {
print " | ";
print ' ';
- // Mode de reglement par defaut
+ // Default payment mode
print '';
print '| ';
print $langs->trans('PaymentMode');
@@ -294,6 +303,26 @@ if ($object->id > 0) {
print " | ";
print ' ';
+ if (isModEnabled("banque")) {
+ // Default bank account for payments
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editbankaccount') {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1);
+ } else {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none');
+ }
+ print " | ";
+ print ' ';
+ }
+
// Relative discounts (Discounts-Drawbacks-Rebates)
print '';
print '| ';
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index c5dbf6b0eac..43a99c4bf5e 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -492,7 +492,8 @@ if ($step == 2 && $datatoimport) {
$text = $objmodelimport->getDriverDescForKey($key);
print ' | '.$form->textwithpicto($objmodelimport->getDriverLabelForKey($key), $text).' | ';
print '';
- print '';
+ $filename = $langs->trans("ExampleOfImportFile").'_'.$datatoimport.'.'.$format;
+ print '';
print img_picto('', 'download', 'class="paddingright opacitymedium"');
print $langs->trans("DownloadEmptyExampleShort");
print '';
@@ -583,7 +584,8 @@ if ($step == 3 && $datatoimport) {
$text = $objmodelimport->getDriverDescForKey($format);
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
print ' | ';
- print '';
+ $filename = $langs->trans("ExampleOfImportFile").'_'.$datatoimport.'.'.$format;
+ print '';
print img_picto('', 'download', 'class="paddingright opacitymedium"');
print $langs->trans("DownloadEmptyExampleShort");
print '';
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index 7f198db6042..47671f4e7c3 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -44,7 +44,7 @@ create table llx_societe
town varchar(50), -- town
fk_departement integer DEFAULT 0, --
fk_pays integer DEFAULT 0, --
- fk_account integer DEFAULT 0, --
+ fk_account integer DEFAULT 0, -- default bank account
phone varchar(20), -- phone number
fax varchar(20), -- fax number
url varchar(255), --
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 79f6f578e5f..03515c9a2e2 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -58,10 +58,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/conf.class.php';
$conf = new Conf();
// Set properties specific to database
-$conf->db->host = $dolibarr_main_db_host;
-$conf->db->port = $dolibarr_main_db_port;
-$conf->db->name = $dolibarr_main_db_name;
-$conf->db->user = $dolibarr_main_db_user;
+$conf->db->host = empty($dolibarr_main_db_host) ? '' : $dolibarr_main_db_host;
+$conf->db->port = empty($dolibarr_main_db_port) ? '' : $dolibarr_main_db_port;
+$conf->db->name = empty($dolibarr_main_db_name) ? '' : $dolibarr_main_db_name;
+$conf->db->user = empty($dolibarr_main_db_user) ? '' : $dolibarr_main_db_user;
$conf->db->pass = empty($dolibarr_main_db_pass) ? '' : $dolibarr_main_db_pass;
$conf->db->type = $dolibarr_main_db_type;
$conf->db->prefix = $dolibarr_main_db_prefix;
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
index 46967d6e4fa..b7dfc374a52 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
@@ -119,7 +119,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$form = new Form($this->db);
$texte = $this->description.". \n";
- $texte .= ' | ';
-
// Add input to upload a new template file.
$texte .= ''.$langs->trans("UploadNewTemplate");
$maxfilesizearray = getMaxFileSizeArray();
@@ -195,6 +193,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$texte .= '';
$texte .= '';
$texte .= ' ';
+
$texte .= '';
$texte .= '';
@@ -282,8 +281,10 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
+
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
+
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
@@ -308,7 +309,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
return -1;
}
- // If CUSTOMER contact defined on order, we use it
+ // If CUSTOMER contact defined on object, we use it
$usecontact = false;
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
if (count($arrayidcontact) > 0) {
@@ -348,7 +349,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
// Line of free text
$newfreetext = '';
- $paramfreetext = 'ORDER_FREE_TEXT';
+ $paramfreetext = 'MYMODULE_MYOBJECT_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
$newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
}
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 5eae5c45dc9..7182dd45f31 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -270,10 +270,13 @@ if (empty($reshook)) {
if ($ret == -3) {
$error++;
- $object->fetch($object->product_id_already_linked);
- $productLink = $object->getNomUrl(1, 'supplier');
+ $tmpobject = new Product($db);
+ $tmpobject->fetch($object->product_id_already_linked);
+ $productLink = $tmpobject->getNomUrl(1, 'supplier');
- setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", $productLink), null, 'errors');
+ $texttoshow = $langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", '{s1}');
+ $texttoshow = str_replace('{s1}', $productLink, $texttoshow);
+ setEventMessages($texttoshow, null, 'errors');
} elseif ($ret < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
@@ -995,52 +998,72 @@ END;
$param = "&id=".$object->id;
+ $nbfields = 0;
+
print ' | ';
if (!empty($arrayfields['pfp.datec']['checked'])) {
print_liste_field_titre("AppliedPricesFrom", $_SERVER["PHP_SELF"], "pfp.datec", "", $param, "", $sortfield, $sortorder, '', '', 1);
+ $nbfields++;
}
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre("Suppliers", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder, '', '', 1);
+ $nbfields++;
}
print_liste_field_titre("SupplierRef", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder, '', '', 1);
+ $nbfields++;
if (!empty($arrayfields['pfp.fk_availability']['checked'])) {
print_liste_field_titre("Availability", $_SERVER["PHP_SELF"], "pfp.fk_availability", "", $param, "", $sortfield, $sortorder);
+ $nbfields++;
}
if (!empty($arrayfields['pfp.quantity']['checked'])) {
print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "pfp.quantity", "", $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
}
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
print_liste_field_titre("PriceQtyMinHT", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
if (isModEnabled("multicurrency")) {
print_liste_field_titre("PriceQtyMinHTCurrency", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
}
if (!empty($arrayfields['pfp.unitprice']['checked'])) {
print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "pfp.unitprice", "", $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
}
if (!empty($arrayfields['pfp.multicurrency_unitprice']['checked'])) {
print_liste_field_titre("UnitPriceHTCurrency", $_SERVER["PHP_SELF"], "pfp.multicurrency_unitprice", "", $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
}
if (isModEnabled("multicurrency")) {
print_liste_field_titre("Currency", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
}
print_liste_field_titre("DiscountQtyMin", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
if (!empty($arrayfields['pfp.delivery_time_days']['checked'])) {
print_liste_field_titre("NbDaysToDelivery", $_SERVER["PHP_SELF"], "pfp.delivery_time_days", "", $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
}
if (!empty($arrayfields['pfp.supplier_reputation']['checked'])) {
print_liste_field_titre("ReputationForThisProduct", $_SERVER["PHP_SELF"], "pfp.supplier_reputation", "", $param, '', $sortfield, $sortorder, 'center ');
+ $nbfields++;
}
if (!empty($arrayfields['pfp.fk_barcode_type']['checked'])) {
print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center ');
+ $nbfields++;
}
if (!empty($arrayfields['pfp.barcode']['checked'])) {
print_liste_field_titre("BarcodeValue", $_SERVER["PHP_SELF"], "pfp.barcode", "", $param, '', $sortfield, $sortorder, 'center ');
+ $nbfields++;
}
if (!empty($arrayfields['pfp.packaging']['checked'])) {
print_liste_field_titre("PackagingForThisProduct", $_SERVER["PHP_SELF"], "pfp.packaging", "", $param, 'align="center"', $sortfield, $sortorder);
+ $nbfields++;
}
if (!empty($arrayfields['pfp.tms']['checked'])) {
print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ', '', 1);
+ $nbfields++;
}
// fetch optionals attributes and labels
@@ -1062,6 +1085,7 @@ END;
}
if (!empty($arrayfields['ef.' . $key]['checked'])) {
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.' . $key, '', $param, '', $sortfield, $sortorder, 'right ');
+ $nbfields++;
}
}
}
@@ -1069,10 +1093,11 @@ END;
}
if (is_object($hookmanager)) {
- $parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
+ $parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
+ $nbfields++;
print " \n";
if (is_array($product_fourn_list)) {
@@ -1254,6 +1279,10 @@ END;
print '';
}
+
+ if (empty($product_fourn_list)) {
+ print '| '.$langs->trans("None").' | ';
+ }
} else {
dol_print_error($db);
}
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index e637e478df4..b96a0f6447e 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -176,7 +176,6 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'p.ref'=>"Ref",
- 'pfp.ref_fourn'=>"RefSupplier",
'p.label'=>"ProductLabel",
'p.description'=>"Description",
"p.note"=>"Note",
@@ -190,7 +189,6 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) {
}
if (isModEnabled('barcode')) {
$fieldstosearchall['p.barcode'] = 'Gencod';
- $fieldstosearchall['pfp.barcode'] = 'GencodBuyPrice';
}
// Personalized search criterias. Example: $conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS = 'p.ref=ProductRef;p.label=ProductLabel;p.description=Description;p.note=Note;'
if (!empty($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS)) {
@@ -459,7 +457,16 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if ($sall) {
- $sql .= natural_search(array_keys($fieldstosearchall), $sall);
+ $sql .= ' AND (';
+ $sql .= natural_search(array_keys($fieldstosearchall), $sall, 0, 1);
+ // Search also into a supplier reference 'pfp.ref_fourn'="RefSupplier"
+ $sql .= ' OR EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid';
+ $sql .= ' AND ('.natural_search('pfp.ref_fourn', $sall, 0, 1);
+ if (isModEnabled('barcode')) {
+ // Search also into a supplier barcode 'pfp.barcode'='GencodBuyPrice';
+ $sql .= ' OR '.natural_search('pfp.barcode', $sall, 0, 1);
+ }
+ $sql .= ')))';
}
// if the type is not 1, we show all products (type = 0,2,3)
if (dol_strlen($search_type) && $search_type != '-1') {
@@ -1338,49 +1345,54 @@ while ($i < min($num, $limit)) {
}
}
}
+ $parameters = array('staticdata' => $obj);
+ // Note that $action and $object may have been modified by hook
+ // do product_static fetch in hook if wanted or anything else
+ $reshook = $hookmanager->executeHooks('loadStaticObject', $parameters, $product_static, $action);
+ if (empty($reshook)) {
+ $product_static->id = $obj->rowid;
+ $product_static->ref = $obj->ref;
+ $product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated
+ $product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier;
+ $product_static->label = $obj->label;
+ $product_static->finished = $obj->finished;
+ $product_static->type = $obj->fk_product_type;
+ $product_static->status_buy = $obj->tobuy;
+ $product_static->status = $obj->tosell;
+ $product_static->status_batch = $obj->tobatch;
+ $product_static->entity = $obj->entity;
+ $product_static->pmp = $obj->pmp;
+ $product_static->accountancy_code_sell = $obj->accountancy_code_sell;
+ $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
+ $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
+ $product_static->accountancy_code_buy = $obj->accountancy_code_buy;
+ $product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
+ $product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
+ $product_static->length = $obj->length;
+ $product_static->length_units = $obj->length_units;
+ $product_static->width = $obj->width;
+ $product_static->width_units = $obj->width_units;
+ $product_static->height = $obj->height;
+ $product_static->height_units = $obj->height_units;
+ $product_static->weight = $obj->weight;
+ $product_static->weight_units = $obj->weight_units;
+ $product_static->volume = $obj->volume;
+ $product_static->volume_units = $obj->volume_units;
+ $product_static->surface = $obj->surface;
+ $product_static->surface_units = $obj->surface_units;
+ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
+ $product_static->fk_unit = $obj->fk_unit;
+ }
- $product_static->id = $obj->rowid;
- $product_static->ref = $obj->ref;
- $product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated
- $product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier;
- $product_static->label = $obj->label;
- $product_static->finished = $obj->finished;
- $product_static->type = $obj->fk_product_type;
- $product_static->status_buy = $obj->tobuy;
- $product_static->status = $obj->tosell;
- $product_static->status_batch = $obj->tobatch;
- $product_static->entity = $obj->entity;
- $product_static->pmp = $obj->pmp;
- $product_static->accountancy_code_sell = $obj->accountancy_code_sell;
- $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
- $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
- $product_static->accountancy_code_buy = $obj->accountancy_code_buy;
- $product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
- $product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
- $product_static->length = $obj->length;
- $product_static->length_units = $obj->length_units;
- $product_static->width = $obj->width;
- $product_static->width_units = $obj->width_units;
- $product_static->height = $obj->height;
- $product_static->height_units = $obj->height_units;
- $product_static->weight = $obj->weight;
- $product_static->weight_units = $obj->weight_units;
- $product_static->volume = $obj->volume;
- $product_static->volume_units = $obj->volume_units;
- $product_static->surface = $obj->surface;
- $product_static->surface_units = $obj->surface_units;
- if (!empty($conf->global->PRODUCT_USE_UNITS)) {
- $product_static->fk_unit = $obj->fk_unit;
- }
-
- // STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
- if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
- if ($obj->fk_product_type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
- $option = 'nobatch';
- if (empty($arrayfields['stock_virtual']['checked'])) {
- $option .= ',novirtual';
+ // STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
+ if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
+ if ($product_static->type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
+ $option = 'nobatch';
+ if (empty($arrayfields['stock_virtual']['checked'])) {
+ $option .= ',novirtual';
+ }
+ $product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
}
- $product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
}
}
@@ -1454,7 +1466,7 @@ while ($i < min($num, $limit)) {
// Label
if (!empty($arrayfields['p.label']['checked'])) {
- print ''.$obj->label.' | ';
+ print ''.$product_static->label.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1464,7 +1476,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['p.fk_product_type']['checked'])) {
print '';
$s = '';
- if ($obj->fk_product_type == 0) {
+ if ($product_static->type == 0) {
$s .= img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"');
} else {
$s .= img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"');
@@ -1478,7 +1490,7 @@ while ($i < min($num, $limit)) {
// Barcode
if (!empty($arrayfields['p.barcode']['checked'])) {
- print ' | '.$obj->barcode.' | ';
+ print ''.$product_static->barcode.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1522,7 +1534,7 @@ while ($i < min($num, $limit)) {
// Weight
if (!empty($arrayfields['p.weight']['checked'])) {
print '';
- print $obj->weight;
+ print $product_static->weight;
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1542,7 +1554,7 @@ while ($i < min($num, $limit)) {
// Length
if (!empty($arrayfields['p.length']['checked'])) {
print '';
- print $obj->length;
+ print $product_static->length;
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1562,7 +1574,7 @@ while ($i < min($num, $limit)) {
// Width
if (!empty($arrayfields['p.width']['checked'])) {
print '';
- print $obj->width;
+ print $product_static->width;
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1582,7 +1594,7 @@ while ($i < min($num, $limit)) {
// Height
if (!empty($arrayfields['p.height']['checked'])) {
print '';
- print $obj->height;
+ print $product_static->height;
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1602,7 +1614,7 @@ while ($i < min($num, $limit)) {
// Surface
if (!empty($arrayfields['p.surface']['checked'])) {
print '';
- print $obj->surface;
+ print $product_static->surface;
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1622,7 +1634,7 @@ while ($i < min($num, $limit)) {
// Volume
if (!empty($arrayfields['p.volume']['checked'])) {
print '';
- print $obj->volume;
+ print $product_static->volume;
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1654,7 +1666,7 @@ while ($i < min($num, $limit)) {
// Sell price
if (!empty($arrayfields['p.sellprice']['checked'])) {
print '';
- if ($obj->tosell && $usercancreadprice) {
+ if ($product_static->status && $usercancreadprice) {
if ($obj->price_base_type == 'TTC') {
print ''.price($obj->price_ttc).' '.$langs->trans("TTC").'';
} else {
@@ -1677,7 +1689,7 @@ while ($i < min($num, $limit)) {
$productpricescache[$obj->rowid] = array();
}
- if ($obj->tosell && $usercancreadprice) {
+ if ($product_static->status && $usercancreadprice) {
// Make 1 request for all price levels (without filter on price_level) and saved result into an cache array
// then reuse the cache array if we need prices for other price levels
$sqlp = "SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type";
@@ -1727,7 +1739,7 @@ while ($i < min($num, $limit)) {
// Better buy price
if (!empty($arrayfields['p.minbuyprice']['checked'])) {
print ' | ';
- if ($obj->tobuy && $obj->bestpurchaseprice != '' && $usercancreadprice) {
+ if ($product_static->status_buy && $obj->bestpurchaseprice != '' && $usercancreadprice) {
if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) {
if ($product_fourn->product_fourn_price_id > 0) {
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) {
@@ -1748,7 +1760,7 @@ while ($i < min($num, $limit)) {
// Number of buy prices
if (!empty($arrayfields['p.numbuyprice']['checked'])) {
print ' | ';
- if ($obj->tobuy && $usercancreadprice) {
+ if ($product_static->status_buy && $usercancreadprice) {
if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) {
$htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
print $form->textwithpicto(count($productFournList), $htmltext);
@@ -1788,7 +1800,7 @@ while ($i < min($num, $limit)) {
// Limit alert
if (!empty($arrayfields['p.seuil_stock_alerte']['checked'])) {
print ' | ';
- if ($obj->fk_product_type != 1) {
+ if ($product_static->type != 1) {
print $obj->seuil_stock_alerte;
}
print ' | ';
@@ -1799,7 +1811,7 @@ while ($i < min($num, $limit)) {
// Desired stock
if (!empty($arrayfields['p.desiredstock']['checked'])) {
print '';
- if ($obj->fk_product_type != 1) {
+ if ($product_static->type != 1) {
print $obj->desiredstock;
}
print ' | ';
@@ -1810,7 +1822,7 @@ while ($i < min($num, $limit)) {
// Stock real
if (!empty($arrayfields['p.stock']['checked'])) {
print '';
- if ($obj->fk_product_type != 1) {
+ if ($product_static->type != 1) {
if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
@@ -1826,7 +1838,7 @@ while ($i < min($num, $limit)) {
// Stock virtual
if (!empty($arrayfields['stock_virtual']['checked'])) {
print ' | ';
- if ($obj->fk_product_type != 1) {
+ if ($product_static->type != 1) {
if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
@@ -1868,38 +1880,38 @@ while ($i < min($num, $limit)) {
}
// Accountancy code sell
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
- print ' | '.$obj->accountancy_code_sell.' | ';
+ print ''.$product_static->accountancy_code_sell.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
- print ''.$obj->accountancy_code_sell_intra.' | ';
+ print ''.$product_static->accountancy_code_sell_intra.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
- print ''.$obj->accountancy_code_sell_export.' | ';
+ print ''.$product_static->accountancy_code_sell_export.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy code buy
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
- print ''.$obj->accountancy_code_buy.' | ';
+ print ''.$product_static->accountancy_code_buy.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
- print ''.$obj->accountancy_code_buy_intra.' | ';
+ print ''.$product_static->accountancy_code_buy_intra.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
- print ''.$obj->accountancy_code_buy_export.' | ';
+ print ''.$product_static->accountancy_code_buy_export.' | ';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1935,7 +1947,7 @@ while ($i < min($num, $limit)) {
if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
- print $product_static->LibStatut($obj->tosell, 5, 0);
+ print $product_static->LibStatut($product_static->status, 5, 0);
}
print '';
if (!$i) {
@@ -1948,7 +1960,7 @@ while ($i < min($num, $limit)) {
if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
- print $product_static->LibStatut($obj->tobuy, 5, 1);
+ print $product_static->LibStatut($product_static->status_buy, 5, 1);
}
print '';
if (!$i) {
diff --git a/htdocs/recruitment/class/api_recruitment.class.php b/htdocs/recruitment/class/api_recruitment.class.php
index af2c87dcdb3..cf4fa7a143e 100644
--- a/htdocs/recruitment/class/api_recruitment.class.php
+++ b/htdocs/recruitment/class/api_recruitment.class.php
@@ -441,7 +441,7 @@ class Recruitment extends DolibarrApi
// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->jobposition->update(DolibarrApiAccess::$user, false) > 0) {
- return $this->get($id);
+ return $this->getJobPosition($id);
} else {
throw new RestException(500, $this->jobposition->error);
}
@@ -484,7 +484,7 @@ class Recruitment extends DolibarrApi
// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->candidature->update(DolibarrApiAccess::$user, false) > 0) {
- return $this->get($id);
+ return $this->getCandidature($id);
} else {
throw new RestException(500, $this->candidature->error);
}
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 8da7e20e4e5..1fb149ba250 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2702,23 +2702,24 @@ class Societe extends CommonObject
if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) {
$label2 .= ' '.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra);
}
+
if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) {
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false) {
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') {
$label2 .= ' '.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1;
}
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false) {
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') {
$label2 .= ' '.$langs->trans('ProfId2'.$this->country_code).': '.$this->idprof2;
}
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false) {
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') {
$label2 .= ' '.$langs->trans('ProfId3'.$this->country_code).': '.$this->idprof3;
}
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false) {
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') {
$label2 .= ' '.$langs->trans('ProfId4'.$this->country_code).': '.$this->idprof4;
}
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false) {
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') {
$label2 .= ' '.$langs->trans('ProfId5'.$this->country_code).': '.$this->idprof5;
}
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false) {
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') {
$label2 .= ' '.$langs->trans('ProfId6'.$this->country_code).': '.$this->idprof6;
}
}
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index dfb5f5ee279..f5fcc56b49d 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -767,7 +767,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && (
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) {
- if ($obj->client > 0) {
+ if ($companystatic->client > 0) {
header("Location: ".DOL_URL_ROOT.'/comm/card.php?socid='.$id);
exit;
}
@@ -1447,27 +1447,36 @@ $totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
+ $parameters = array('staticdata' => $obj);
+ // Note that $action and $object may have been modified by hook
+ // do companystatic fetch in hook if wanted or anything else
+ $reshook = $hookmanager->executeHooks('loadStaticObject', $parameters, $companystatic, $action);
+ if (empty($reshook)) {
+ $companystatic->id = $obj->rowid;
+ $companystatic->name = $obj->name;
+ $companystatic->name_alias = $obj->name_alias;
+ $companystatic->logo = $obj->logo;
+ $companystatic->barcode = $obj->barcode;
+ $companystatic->canvas = $obj->canvas;
+ $companystatic->client = $obj->client;
+ $companystatic->status = $obj->status;
+ $companystatic->email = $obj->email;
+ $companystatic->address = $obj->address;
+ $companystatic->zip = $obj->zip;
+ $companystatic->town = $obj->town;
+ $companystatic->fournisseur = $obj->fournisseur;
+ $companystatic->code_client = $obj->code_client;
+ $companystatic->code_fournisseur = $obj->code_fournisseur;
+ $companystatic->tva_intra = $obj->tva_intra;
+ $companystatic->country_code = $obj->country_code;
- $companystatic->id = $obj->rowid;
- $companystatic->name = $obj->name;
- $companystatic->name_alias = $obj->name_alias;
- $companystatic->logo = $obj->logo;
- $companystatic->canvas = $obj->canvas;
- $companystatic->client = $obj->client;
- $companystatic->status = $obj->status;
- $companystatic->email = $obj->email;
- $companystatic->fournisseur = $obj->fournisseur;
- $companystatic->code_client = $obj->code_client;
- $companystatic->code_fournisseur = $obj->code_fournisseur;
- $companystatic->tva_intra = $obj->tva_intra;
- $companystatic->country_code = $obj->country_code;
+ $companystatic->code_compta_client = $obj->code_compta;
+ $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
- $companystatic->code_compta_client = $obj->code_compta;
- $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
-
- $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
- $companystatic->fk_parent = $obj->fk_parent;
- $companystatic->entity = $obj->entity;
+ $companystatic->fk_prospectlevel = $obj->fk_prospectlevel;
+ $companystatic->fk_parent = $obj->fk_parent;
+ $companystatic->entity = $obj->entity;
+ }
print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">';
if ($contextpage == 'poslist') {
- print dol_escape_htmltag($obj->name);
+ print dol_escape_htmltag($companystatic->name);
} else {
print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
}
@@ -1520,56 +1529,56 @@ while ($i < min($num, $limit)) {
}
// Barcode
if (!empty($arrayfields['s.barcode']['checked'])) {
- print '| '.dol_escape_htmltag($obj->barcode).' | ';
+ print ''.dol_escape_htmltag($companystatic->barcode).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Customer code
if (!empty($arrayfields['s.code_client']['checked'])) {
- print ''.dol_escape_htmltag($obj->code_client).' | ';
+ print ''.dol_escape_htmltag($companystatic->code_client).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Supplier code
if (!empty($arrayfields['s.code_fournisseur']['checked'])) {
- print ''.dol_escape_htmltag($obj->code_fournisseur).' | ';
+ print ''.dol_escape_htmltag($companystatic->code_fournisseur).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account customer code
if (!empty($arrayfields['s.code_compta']['checked'])) {
- print ''.dol_escape_htmltag($obj->code_compta).' | ';
+ print ''.dol_escape_htmltag($companystatic->code_compta_client).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account supplier code
if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) {
- print ''.dol_escape_htmltag($obj->code_compta_fournisseur).' | ';
+ print ''.dol_escape_htmltag($companystatic->code_compta_fournisseur).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Address
if (!empty($arrayfields['s.address']['checked'])) {
- print ''.dol_escape_htmltag($obj->address).' | ';
+ print ''.dol_escape_htmltag($companystatic->address).' | ';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
- print "".dol_escape_htmltag($obj->zip)." | \n";
+ print "".dol_escape_htmltag($companystatic->zip)." | \n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
- print ''.dol_escape_htmltag($obj->town)." | \n";
+ print ''.dol_escape_htmltag($companystatic->town)." | \n";
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1591,7 +1600,7 @@ while ($i < min($num, $limit)) {
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '';
- $labelcountry = ($obj->country_code && ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code)) ? $langs->trans("Country".$obj->country_code) : $obj->country_label;
+ $labelcountry = ($companystatic->country_code && ($langs->trans("Country".$companystatic->country_code) != "Country".$companystatic->country_code)) ? $langs->trans("Country".$companystatic->country_code) : $obj->country_label;
print $labelcountry;
print ' | ';
if (!$i) {
@@ -1638,13 +1647,13 @@ while ($i < min($num, $limit)) {
}
}
if (!empty($arrayfields['s.phone']['checked'])) {
- print ''.dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')." | \n";
+ print ''.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')." | \n";
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['s.fax']['checked'])) {
- print ''.dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')." | \n";
+ print ''.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')." | \n";
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1693,11 +1702,11 @@ while ($i < min($num, $limit)) {
}
// VAT
if (!empty($arrayfields['s.tva_intra']['checked'])) {
- print '';
- if ($obj->tva_intra && !isValidVATID($companystatic)) {
+ print ' | ';
+ if ($companystatic->tva_intra && !isValidVATID($companystatic)) {
print img_warning("BadVATNumber", '', 'pictofixedwidth');
}
- print $obj->tva_intra;
+ print $companystatic->tva_intra;
print " | \n";
if (!$i) {
$totalarray['nbfield']++;
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 5a5a5d6fc9e..7fc268568c8 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -1834,10 +1834,10 @@ if ($action == 'create' || $action == 'adduserldap') {
print ' | '.$langs->trans("LastConnexion").' | ';
print '';
if ($object->datepreviouslogin) {
- print dol_print_date($object->datepreviouslogin, "dayhour").' ('.$langs->trans("Previous").'), ';
+ print dol_print_date($object->datepreviouslogin, "dayhour", "tzuserrel").' ('.$langs->trans("Previous").'), ';
}
if ($object->datelastlogin) {
- print dol_print_date($object->datelastlogin, "dayhour").' ('.$langs->trans("Currently").')';
+ print dol_print_date($object->datelastlogin, "dayhour", "tzuserrel").' ('.$langs->trans("Currently").')';
}
print ' | ';
print " \n";
diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php
index 8f7d152e73a..1ededd091b3 100644
--- a/htdocs/user/perms.php
+++ b/htdocs/user/perms.php
@@ -331,9 +331,9 @@ if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->ad
print ''.$langs->trans("Permissions").' | ';
print '';
-print ''.img_picto('', 'folder-open', 'class="paddingright"').''.$langs->trans("ExpandAll").'';
+print ''.img_picto('', 'folder-open', 'class="paddingright"').''.$langs->trans("ExpandAll").'';
print ' | ';
-print ''.img_picto('', 'folder', 'class="paddingright"').''.$langs->trans("UndoExpandAll").'';
+print ''.img_picto('', 'folder', 'class="paddingright"').''.$langs->trans("UndoExpandAll").'';
print ' | ';
print ''."\n";
@@ -469,6 +469,11 @@ if ($result) {
}
*/
+ $isexpanded = ($updatedmodulename == $obj->module || $module == "allmodules");
+ if (!$action) {
+ $isexpanded = 1; // By default (no action done) we have lines expanded
+ }
+
// Break found, it's a new module to catch
if (isset($obj->module) && ($oldmod <> $obj->module)) {
$oldmod = $obj->module;
@@ -485,24 +490,24 @@ if ($result) {
print '';
if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
if ($caneditperms) {
- print 'module && $module != "allmodules" ? ' style="display:none"' : '').'>';
+ print ' | ';
print 'id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."";
print ' / ';
print 'id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."";
print ' | ';
- print 'module || $module == "allmodules" ? ' style="display:none"' : '').'> | ';
+ print ' | ';
} else {
print ' | ';
}
print ' | ';
} else {
if ($caneditperms) {
- print 'module && $module != "allmodules" ? ' style="display:none"' : '').'>';
+ print ' | ';
print 'id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."";
print ' / ';
print 'id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."";
print ' | ';
- print 'module || $module == "allmodules" ? ' style="display:none"' : '').'> | ';
+ print ' | ';
} else {
print ' | ';
}
@@ -510,11 +515,11 @@ if ($result) {
}
print ' | ';
- print '';
- print '';
+ print ' ';
+ print ' ';
print img_picto('', 'folder', 'class="marginright"');
print ' ';
- print '';
+ print ' ';
print img_picto('', 'folder-open', 'class="marginright"');
print ' ';
print ' | '; //Add picto + / - when open en closed
@@ -522,7 +527,7 @@ if ($result) {
}
print ''."\n";
- print ' module && $module != "allmodules" ? ' style="display:none"' : '').'>';
+ print ' ';
// Picto and label of module
print '| ';
@@ -625,6 +630,7 @@ print '';
print ' | |
|
|
|
|