';
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 ''.$langs->trans("TicketSeverity").' ';
+ print ' '.$langs->trans("TicketSeverity").' ';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 1);
print ' ';
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/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/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
index bef3e07e910..0b4b773be40 100644
--- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
+++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
@@ -55,6 +55,8 @@ ALTER TABLE llx_user DROP COLUMN idpers3;
-- v17
+ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_percent (percent);
+
UPDATE llx_c_paiement SET code = 'BANCON' WHERE code = 'BAN' AND libelle = 'Bancontact';
-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN fk_user_creat integer NULL;
diff --git a/htdocs/install/mysql/tables/llx_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_actioncomm.key.sql
index ee16386c7c4..944471620ae 100644
--- a/htdocs/install/mysql/tables/llx_actioncomm.key.sql
+++ b/htdocs/install/mysql/tables/llx_actioncomm.key.sql
@@ -27,5 +27,6 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datep (datep);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datep2 (datep2);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_recurid (recurid);
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_ref_ext (ref_ext);
+ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_percent (percent);
ALTER TABLE llx_actioncomm ADD UNIQUE INDEX uk_actioncomm_ref (ref, entity);
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/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 8f9c4aa302f..2cd9d55aefb 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1932,7 +1932,7 @@ BackupDumpWizard=Wizard to build the database dump file
BackupZipWizard=Wizard to build the archive of documents directory
SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason:
SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is a manual process only a privileged user may perform.
-InstallModuleFromWebHasBeenDisabledContactUs=Install of external modules from the application is currently locked. Please contact us if you need us to enable this feature.
+InstallModuleFromWebHasBeenDisabledContactUs=Install or development of external modules from the application is currently locked for security purpose. Please contact us if you need to enable this feature.
InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file %s to allow this feature.
ConfFileMustContainCustom=Installing or building an external module from application need to save the module files into directory %s . To have this directory processed by Dolibarr, you must setup your conf/conf.php to add the 2 directive lines:$dolibarr_main_url_root_alt='/custom'; $dolibarr_main_document_root_alt='%s/custom';
HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index b6001b2b27b..67dfb75a242 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -240,7 +240,7 @@ OppStatusPENDING=Pending
OppStatusWON=Won
OppStatusLOST=Lost
Budget=Budget
-AllowToLinkFromOtherCompany=Allow to link project from other companySupported values: - Keep empty: Can link any project of the company (default) - "all": Can link any projects, even projects of other companies - A list of third-party ids separated by commas: can link all projects of these third partys (Example: 123,4795,53)
+AllowToLinkFromOtherCompany=Allow to link an element with a project of other companySupported values: - Keep empty: Can link elements with any projects in the same company (default) - "all": Can link elements with any projects, even projects of other companies - A list of third-party ids separated by commas: can link elements with any projects of these third partys (Example: 123,4795,53)
LatestProjects=Latest %s projects
LatestModifiedProjects=Latest %s modified projects
OtherFilteredTasks=Other filtered tasks
@@ -284,7 +284,7 @@ ProfitIsCalculatedWith=Profit is calculated using
AddPersonToTask=Add also to tasks
UsageOrganizeEvent=Usage: Event Organization
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classify project as closed when all its tasks are completed (100%% progress)
-PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks at 100 %% progress won't be affected: you will have to close them manually. This option only affects open projects.
+PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks already set to a progress of 100 %% won't be affected: you will have to close them manually. This option only affects open projects.
SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, then bulk action "Generate Invoice" to bill them
ProjectTasksWithoutTimeSpent=Project tasks without time spent
FormForNewLeadDesc=Thanks to fill the following form to contact us. You can also send us an email directly to %s .
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/index.php b/htdocs/modulebuilder/index.php
index 29959822af1..538b1cac290 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1974,6 +1974,28 @@ if ($message) {
$infomodulesfound = ''.$form->textwithpicto('', $langs->trans("ModuleBuilderDesc3", count($listofmodules)).' '.$langs->trans("ModuleBuilderDesc4", $FILEFLAG).' '.$textforlistofdirs).'
';
+
+$dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
+$allowonlineinstall = true;
+if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
+ $allowonlineinstall = false;
+}
+if (empty($allowonlineinstall)) {
+ if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
+ // Show clean message
+ $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
+ } else {
+ // Show technical message
+ $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'), 0, 0, 1, 'warning');
+ }
+
+ print $message;
+
+ llxFooter();
+ exit(0);
+}
+
+
// Load module descriptor
$error = 0;
$moduleobj = null;
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/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 17eadfe4e17..0b6896260c2 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -54,6 +54,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected i
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'timespentlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'alpha');
+$mode = GETPOST('mode', 'alpha');
$id = GETPOST('id', 'int');
$projectid = GETPOST('projectid', 'int');
@@ -323,10 +324,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
}
}
-if ($action == 'confirm_deleteline' && $confirm == "yes" && $user->rights->projet->supprimer) {
- $object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_id
+if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer'))) {
+ $object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_xxx
- if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
+ if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
$result = $object->delTimeSpent($user); // delete line with $object->timespent_id
if ($result < 0) {
@@ -2109,7 +2110,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print ' ';
print ' ';
} elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks
- if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
+ if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) {
print ' ';
print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
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";