diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile
index 2be287c2db9..dca74e9e720 100644
--- a/build/docker/Dockerfile
+++ b/build/docker/Dockerfile
@@ -20,6 +20,9 @@ RUN apt-get update -y \
unzip \
curl \
apt-utils \
+ msmtp \
+ msmtp-mta \
+ mailutils \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
@@ -44,7 +47,17 @@ RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
-#RUN echo '172.17.0.1 docker.host' >> /etc/hosts
+#RUN echo 'localhost docker.host' >> /etc/hosts
+
+# set up sendmail config, to use maildev
+RUN echo "account default" > /etc/msmtprc
+RUN echo "auth off" >> /etc/msmtprc
+RUN echo "port 25" >> /etc/msmtprc
+RUN echo "host mail" >> /etc/msmtprc
+RUN echo "from local@localdomain.com" >> /etc/msmtprc
+RUN echo "domain localhost.localdomain" >> /etc/msmtprc
+RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
+RUN echo "localhost localhost.localdomain" >> /etc/hosts
EXPOSE 80
diff --git a/build/docker/README.md b/build/docker/README.md
index 2fd278a531f..d469c7c7aae 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -16,7 +16,7 @@ And then, you can run :
docker-compose up
-This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
+This will run 4 containers Docker : Dolibarr, MariaDB, PhpMyAdmin and MailDev.
The URL to go to the Dolibarr is :
@@ -25,7 +25,10 @@ The URL to go to the Dolibarr is :
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080
+
+In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev
-Setup the database connection during the installation process, please use mariad
-b (name of the database container) as database host.
+ http://0.0.0.0:8081
+
+Setup the database connection during the installation process, please use mariadb (name of the database container) as database host.
Setup documents folder, during the installation process, to /var/documents
diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml
index 7e4ceda902e..2167f069f25 100644
--- a/build/docker/docker-compose.yml
+++ b/build/docker/docker-compose.yml
@@ -52,3 +52,6 @@ services:
ports:
- "8081:80"
- "25:25"
+ networks:
+ - internal-pod
+ - external-pod
diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml
index 03104270dcf..bf283993628 100644
--- a/dev/setup/codesniffer/ruleset.xml
+++ b/dev/setup/codesniffer/ruleset.xml
@@ -17,6 +17,7 @@
*/nltechno*
*/htdocs/includes
*/htdocs/includes
+ .git
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index f5f4bf80221..4e49cb1ab17 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1530,14 +1530,14 @@ class BookKeeping extends CommonObject
$this->label_compte = 'Customer';
$this->label_operation = 'Sales of pea';
$this->debit = 99.9;
- $this->credit = '';
- $this->montant = '';
+ $this->credit = 0.0;
+ $this->amount = 0.0;
$this->sens = 'D';
$this->fk_user_author = $user->id;
- $this->import_key = '';
+ $this->import_key = '20201027';
$this->code_journal = 'VT';
$this->journal_label = 'Journal de vente';
- $this->piece_num = '';
+ $this->piece_num = 1234;
$this->date_creation = $now;
}
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 3f128ab9c5a..b67ded65c6e 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -589,8 +589,9 @@ class Adherent extends CommonObject
$this->town = ($this->town ? $this->town : $this->town);
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
$this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(trim($this->lastname));
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(trim($this->firstname));
+ if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
+ if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = dol_strtoupper($this->lastname);
+ if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
$this->note_public = ($this->note_public ? $this->note_public : $this->note_public);
$this->note_private = ($this->note_private ? $this->note_private : $this->note_private);
diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php
index 9605f46f219..70cdeb14ade 100644
--- a/htdocs/api/class/api_documents.class.php
+++ b/htdocs/api/class/api_documents.class.php
@@ -616,6 +616,12 @@ class Documents extends DolibarrApi
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$object = new Adherent($this->db);
}
+ elseif ($modulepart == 'proposal' || $modulepart == 'propal' || $modulepart == 'propale')
+ {
+ $modulepart = 'propale';
+ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
+ $object = new Propal($this->db);
+ }
// TODO Implement additional moduleparts
else
{
diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php
index 5df55ab7849..c474054b2b4 100644
--- a/htdocs/compta/cashcontrol/report.php
+++ b/htdocs/compta/cashcontrol/report.php
@@ -29,7 +29,7 @@
* \brief List of bank transactions
*/
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
+if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
require '../../main.inc.php';
@@ -125,8 +125,7 @@ elseif ($syear && $smonth && $sday) $sql .= " AND datef BETWEEN '".$db->idate(
else dol_print_error('', 'Year not defined');
$resql = $db->query($sql);
-if ($resql)
-{
+if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
@@ -166,12 +165,10 @@ if ($resql)
$totalarray = array();
$cachebankaccount = array();
$amountpertype = array();
- while ($i < $num)
- {
+ while ($i < $num) {
$objp = $db->fetch_object($resql);
- if (empty($cachebankaccount[$objp->bankid]))
- {
+ if (empty($cachebankaccount[$objp->bankid])) {
$bankaccounttmp = new Account($db);
$bankaccounttmp->fetch($objp->bankid);
$cachebankaccount[$objp->bankid] = $bankaccounttmp;
@@ -235,8 +232,7 @@ if ($resql)
// Debit
print '
';
- if ($objp->amount < 0)
- {
+ if ($objp->amount < 0) {
print price($objp->amount * -1);
$totalarray['val']['totaldebfield'] += $objp->amount;
$amountpertype[$objp->code] += $objp->amount;
@@ -247,8 +243,7 @@ if ($resql)
// Credit
print ' | ';
- if ($objp->amount > 0)
- {
+ if ($objp->amount > 0) {
print price($objp->amount);
$totalarray['val']['totalcredfield'] += $objp->amount;
$amountpertype[$objp->code] -= $objp->amount;
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index ab6e3c732c9..2034803ecb8 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -353,9 +353,9 @@ class Contact extends CommonObject
// Clean parameters
$this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name);
$this->firstname = trim($this->firstname);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname));
- if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname));
+ if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
+ if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = dol_strtoupper($this->lastname);
+ if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
if (empty($this->socid)) $this->socid = 0;
if (empty($this->priv)) $this->priv = 0;
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
@@ -464,9 +464,9 @@ class Contact extends CommonObject
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
// Clean parameters
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname));
- if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname));
+ if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
+ if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = dol_strtoupper($this->lastname);
+ if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
$this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname);
$this->firstname = trim($this->firstname);
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 56b23722a74..c078b4d90dc 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -50,10 +50,8 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'card';
$h++;
- if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
- {
- if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire)
- {
+ if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) {
+ if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire) {
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$nbContact = 0; // TODO
@@ -61,8 +59,7 @@ function societe_prepare_head(Societe $object)
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) $nbContact = $obj->nb;
}
@@ -82,8 +79,7 @@ function societe_prepare_head(Societe $object)
$h++;
}
- if ($object->client == 1 || $object->client == 2 || $object->client == 3)
- {
+ if ($object->client == 1 || $object->client == 2 || $object->client == 3) {
$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
$head[$h][1] = '';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client == 2 || $object->client == 3)) $head[$h][1] .= $langs->trans("Prospect");
@@ -92,8 +88,7 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'customer';
$h++;
- if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
- {
+ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$langs->load("products");
// price
$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
@@ -104,16 +99,14 @@ function societe_prepare_head(Societe $object)
}
$supplier_module_enabled = 0;
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) $supplier_module_enabled = 1;
- if ($supplier_module_enabled == 1 && $object->fournisseur && !empty($user->rights->fournisseur->lire))
- {
+ if ($supplier_module_enabled == 1 && $object->fournisseur && !empty($user->rights->fournisseur->lire)) {
$head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Supplier");
$head[$h][2] = 'supplier';
$h++;
}
- if (!empty($conf->projet->enabled) && (!empty($user->rights->projet->lire)))
- {
+ if (!empty($conf->projet->enabled) && (!empty($user->rights->projet->lire))) {
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Projects");
$nbNote = 0;
@@ -122,12 +115,10 @@ function societe_prepare_head(Societe $object)
$sql .= " WHERE fk_soc = ".$object->id;
$sql .= " AND entity IN (".getEntity('project').")";
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
- while ($i < $num)
- {
+ while ($i < $num) {
$obj = $db->fetch_object($resql);
$nbNote = $obj->nb;
$i++;
@@ -141,19 +132,16 @@ function societe_prepare_head(Societe $object)
}
// Tab to link resources
- if (!empty($conf->resource->enabled) && !empty($conf->global->RESOURCE_ON_THIRDPARTIES))
- {
+ if (!empty($conf->resource->enabled) && !empty($conf->global->RESOURCE_ON_THIRDPARTIES)) {
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=societe&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
$h++;
}
- if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING))
- {
+ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
// Tab to accountancy
- if (!empty($conf->accounting->enabled) && $object->client > 0)
- {
+ if (!empty($conf->accounting->enabled) && $object->client > 0) {
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_customer.php?socid='.$object->id;
$head[$h][1] = $langs->trans("TabLetteringCustomer");
$head[$h][2] = 'lettering_customer';
@@ -161,8 +149,7 @@ function societe_prepare_head(Societe $object)
}
// Tab to accountancy
- if (!empty($conf->accounting->enabled) && $object->fournisseur > 0)
- {
+ if (!empty($conf->accounting->enabled) && $object->fournisseur > 0) {
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_supplier.php?socid='.$object->id;
$head[$h][1] = $langs->trans("TabLetteringSupplier");
$head[$h][2] = 'lettering_supplier';
@@ -172,8 +159,7 @@ function societe_prepare_head(Societe $object)
// Related items
if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
- && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB))
- {
+ && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) {
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Referers");
$head[$h][2] = 'consumption';
@@ -181,8 +167,7 @@ function societe_prepare_head(Societe $object)
}
// Bank accounts
- if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
- {
+ if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) {
$nbBankAccount = 0;
$foundonexternalonlinesystem = 0;
$langs->load("banks");
@@ -190,8 +175,7 @@ function societe_prepare_head(Societe $object)
//$title = $langs->trans("BankAccounts");
$title = $langs->trans("PaymentInformation");
- if (!empty($conf->stripe->enabled))
- {
+ if (!empty($conf->stripe->enabled)) {
//$langs->load("stripe");
//$title = $langs->trans("BankAccountsAndGateways");
@@ -214,12 +198,10 @@ function societe_prepare_head(Societe $object)
}
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
- while ($i < $num)
- {
+ while ($i < $num) {
$obj = $db->fetch_object($resql);
$nbBankAccount = $obj->nb;
$i++;
@@ -238,8 +220,7 @@ function societe_prepare_head(Societe $object)
$h++;
}
- if (!empty($conf->website->enabled) && (!empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) && (!empty($user->rights->societe->lire)))
- {
+ if (!empty($conf->website->enabled) && (!empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) && (!empty($user->rights->societe->lire))) {
$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.$object->id;
$head[$h][1] = $langs->trans("WebSiteAccounts");
$nbNote = 0;
@@ -247,12 +228,10 @@ function societe_prepare_head(Societe $object)
$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as n";
$sql .= " WHERE fk_soc = ".$object->id.' AND fk_website > 0';
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
- while ($i < $num)
- {
+ while ($i < $num) {
$obj = $db->fetch_object($resql);
$nbNote = $obj->nb;
$i++;
@@ -271,22 +250,18 @@ function societe_prepare_head(Societe $object)
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'thirdparty');
- if ($user->socid == 0)
- {
+ if ($user->socid == 0) {
// Notifications
- if (!empty($conf->notification->enabled))
- {
+ if (!empty($conf->notification->enabled)) {
$nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
$sql .= " WHERE fk_soc = ".$object->id;
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
- while ($i < $num)
- {
+ while ($i < $num) {
$obj = $db->fetch_object($resql);
$nbNote = $obj->nb;
$i++;
@@ -328,8 +303,7 @@ function societe_prepare_head(Societe $object)
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$head[$h][1] .= $langs->trans("Events");
- if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
- {
+ if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
}
@@ -437,8 +411,7 @@ function getCountry($searchkey, $withcode = '', $dbtouse = 0, $outputlangs = '',
$result = '';
// Check parameters
- if (empty($searchkey) && empty($searchlabel))
- {
+ if (empty($searchkey) && empty($searchlabel)) {
if ($withcode === 'all') return array('id'=>'', 'code'=>'', 'label'=>'');
else return '';
}
@@ -451,14 +424,11 @@ function getCountry($searchkey, $withcode = '', $dbtouse = 0, $outputlangs = '',
else $sql .= " WHERE label='".$db->escape($searchlabel)."'";
$resql = $dbtouse->query($sql);
- if ($resql)
- {
+ if ($resql) {
$obj = $dbtouse->fetch_object($resql);
- if ($obj)
- {
+ if ($obj) {
$label = ((!empty($obj->label) && $obj->label != '-') ? $obj->label : '');
- if (is_object($outputlangs))
- {
+ if (is_object($outputlangs)) {
$outputlangs->load("dict");
if ($entconv) $label = ($obj->code && ($outputlangs->trans("Country".$obj->code) != "Country".$obj->code)) ? $outputlangs->trans("Country".$obj->code) : $label;
else $label = ($obj->code && ($outputlangs->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code)) ? $outputlangs->transnoentitiesnoconv("Country".$obj->code) : $label;
@@ -506,14 +476,11 @@ function getState($id, $withcode = '', $dbtouse = 0, $withregion = 0, $outputlan
dol_syslog("Company.lib::getState", LOG_DEBUG);
$resql = $dbtouse->query($sql);
- if ($resql)
- {
+ if ($resql) {
$obj = $dbtouse->fetch_object($resql);
- if ($obj)
- {
+ if ($obj) {
$label = ((!empty($obj->name) && $obj->name != '-') ? $obj->name : '');
- if (is_object($outputlangs))
- {
+ if (is_object($outputlangs)) {
$outputlangs->load("dict");
if ($entconv) $label = ($obj->code && ($outputlangs->trans("State".$obj->code) != "State".$obj->code)) ? $outputlangs->trans("State".$obj->code) : $label;
else $label = ($obj->code && ($outputlangs->transnoentitiesnoconv("State".$obj->code) != "State".$obj->code)) ? $outputlangs->transnoentitiesnoconv("State".$obj->code) : $label;
@@ -567,8 +534,7 @@ function currency_name($code_iso, $withcode = '', $outputlangs = null)
$outputlangs->load("dict");
// If there is a translation, we can send immediatly the label
- if ($outputlangs->trans("Currency".$code_iso) != "Currency".$code_iso)
- {
+ if ($outputlangs->trans("Currency".$code_iso) != "Currency".$code_iso) {
return ($withcode ? $code_iso.' - ' : '').$outputlangs->trans("Currency".$code_iso);
}
@@ -577,12 +543,10 @@ function currency_name($code_iso, $withcode = '', $outputlangs = null)
$sql .= " WHERE code_iso='".$db->escape($code_iso)."'";
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
- if ($num)
- {
+ if ($num) {
$obj = $db->fetch_object($resql);
$label = ($obj->label != '-' ? $obj->label : '');
if ($withcode) return ($label == $code_iso) ? "$code_iso" : "$code_iso - $label";
@@ -611,12 +575,10 @@ function getFormeJuridiqueLabel($code)
dol_syslog("Company.lib::getFormeJuridiqueLabel", LOG_DEBUG);
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
- if ($num)
- {
+ if ($num) {
$obj = $db->fetch_object($resql);
$label = ($obj->libelle != '-' ? $obj->libelle : '');
return $label;
@@ -675,8 +637,7 @@ function getCountriesInEEC()
//'CH', // Switzerland - No. Swizerland in not in EEC
);
- if (!empty($conf->global->MAIN_COUNTRIES_IN_EEC))
- {
+ if (!empty($conf->global->MAIN_COUNTRIES_IN_EEC)) {
// For example MAIN_COUNTRIES_IN_EEC = 'AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,NL,HU,IE,IM,IT,LT,LU,LV,MC,MT,PL,PT,RO,SE,SK,SI,UK'
$country_code_in_EEC = explode(',', $conf->global->MAIN_COUNTRIES_IN_EEC);
}
@@ -719,13 +680,11 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$i = -1;
- if (!empty($conf->projet->enabled) && $user->rights->projet->lire)
- {
+ if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
$langs->load("projects");
$newcardbutton = '';
- if (!empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink))
- {
+ if (!empty($conf->projet->enabled) && $user->rights->projet->creer && empty($nocreatelink)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage));
}
@@ -743,8 +702,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$sql .= " ORDER BY p.dateo DESC";
$result = $db->query($sql);
- if ($result)
- {
+ if ($result) {
$num = $db->num_rows($result);
print ' | ';
@@ -758,24 +716,21 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
print '| '.$langs->trans("Status").' | ';
print '
';
- if ($num > 0)
- {
+ if ($num > 0) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$projecttmp = new Project($db);
$i = 0;
- while ($i < $num)
- {
+ while ($i < $num) {
$obj = $db->fetch_object($result);
$projecttmp->fetch($obj->id);
// To verify role of users
$userAccess = $projecttmp->restrictedProjectArea($user);
- if ($user->rights->projet->lire && $userAccess > 0)
- {
+ if ($user->rights->projet->lire && $userAccess > 0) {
print '';
// Ref
@@ -791,8 +746,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
print '| '.dol_print_date($db->jdate($obj->de), "day").' | ';
// Opp amount
print '';
- if ($obj->opp_status_code)
- {
+ if ($obj->opp_status_code) {
print price($obj->opp_amount, 1, '', 1, -1, -1, '');
}
print ' | ';
@@ -889,8 +843,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "t.lastname";
- if (!empty($conf->clicktodial->enabled))
- {
+ if (!empty($conf->clicktodial->enabled)) {
$user->fetch_clicktodial(); // lecture des infos de clicktodial du user
}
@@ -917,10 +870,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'),
);
// Extra fields
- if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label']))
- {
- foreach ($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val)
- {
+ if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) {
+ foreach ($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) {
$arrayfields["ef.".$key] = array(
'label'=>$extrafields->attributes[$contactstatic->table_element]['label'][$key],
@@ -933,8 +884,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Initialize array of search criterias
$search = array();
- foreach ($arrayfields as $key => $val)
- {
+ foreach ($arrayfields as $key => $val) {
$queryName = 'search_'.substr($key, 2);
if (GETPOST($queryName, 'alpha')) {
$search[substr($key, 2)] = GETPOST($queryName, 'alpha');
@@ -943,8 +893,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
$search_array_options = $extrafields->getOptionalsFromPost($contactstatic->table_element, '', 'search_');
// Purge search criteria
- if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
- {
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_status = '';
$search_name = '';
$search_roles = array();
@@ -953,8 +902,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
$search = array();
$search_array_options = array();
- foreach ($contactstatic->fields as $key => $val)
- {
+ foreach ($contactstatic->fields as $key => $val) {
$search[$key] = '';
}
}
@@ -963,8 +911,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
$arrayfields = dol_sort_array($arrayfields, 'position');
$newcardbutton = '';
- if ($user->rights->societe->contact->creer)
- {
+ if ($user->rights->societe->contact->creer) {
$addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
$newcardbutton .= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage));
}
@@ -1030,14 +977,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Fields title search
// --------------------------------------------------------------------
print '
';
- foreach ($contactstatic->fields as $key => $val)
- {
+ foreach ($contactstatic->fields as $key => $val) {
$align = '';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align .= ($align ? ' ' : '').'center';
if (in_array($val['type'], array('timestamp'))) $align .= ($align ? ' ' : '').'nowrap';
if ($key == 'status' || $key == 'statut') $align .= ($align ? ' ' : '').'center';
- if (!empty($arrayfields['t.'.$key]['checked']) || !empty($arrayfields['sc.'.$key]['checked']))
- {
+ if (!empty($arrayfields['t.'.$key]['checked']) || !empty($arrayfields['sc.'.$key]['checked'])) {
print '| ';
if (in_array($key, array('statut'))) {
print $form->selectarray('search_status', array('-1'=>'', '0'=>$contactstatic->LibStatut(0, 1), '1'=>$contactstatic->LibStatut(1, 1)), $search_status);
@@ -1067,8 +1012,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Fields title label
// --------------------------------------------------------------------
print ' |
';
- foreach ($contactstatic->fields as $key => $val)
- {
+ foreach ($contactstatic->fields as $key => $val) {
$align = '';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align .= ($align ? ' ' : '').'center';
if (in_array($val['type'], array('timestamp'))) $align .= ($align ? ' ' : '').'nowrap';
@@ -1091,12 +1035,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
$i = -1;
- if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
- {
+ if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x'))) {
$i = 0;
- while ($i < $num)
- {
+ while ($i < $num) {
$obj = $db->fetch_object($result);
$contactstatic->id = $obj->rowid;
@@ -1129,10 +1071,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
setEventMessages(null, $contactstatic->errors, 'errors');
}
- if (is_array($contactstatic->array_options))
- {
- foreach ($contactstatic->array_options as $key => $val)
- {
+ if (is_array($contactstatic->array_options)) {
+ foreach ($contactstatic->array_options as $key => $val) {
$obj->$key = $val;
}
}
@@ -1140,16 +1080,14 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
print '
';
// ID
- if (!empty($arrayfields['t.rowid']['checked']))
- {
+ if (!empty($arrayfields['t.rowid']['checked'])) {
print '| ';
print $contactstatic->id;
print ' | ';
}
// Photo - Name
- if (!empty($arrayfields['t.name']['checked']))
- {
+ if (!empty($arrayfields['t.name']['checked'])) {
print '';
print $form->showphoto('contact', $contactstatic, 0, 0, 0, 'photorefnoborder valignmiddle marginrightonly', 'small', 1, 0, 1);
print $contactstatic->getNomUrl(0, '', 0, '&backtopage='.urlencode($backtopage));
@@ -1157,32 +1095,28 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
}
// Job position
- if (!empty($arrayfields['t.poste']['checked']))
- {
+ if (!empty($arrayfields['t.poste']['checked'])) {
print ' | ';
if ($obj->poste) print $obj->poste;
print ' | ';
}
// Address - Phone - Email
- if (!empty($arrayfields['t.address']['checked']))
- {
+ if (!empty($arrayfields['t.address']['checked'])) {
print '';
print $contactstatic->getBannerAddress('contact', $object);
print ' | ';
}
// Role
- if (!empty($arrayfields['sc.role']['checked']))
- {
+ if (!empty($arrayfields['sc.role']['checked'])) {
print '';
print $formcompany->showRoles("roles", $contactstatic, 'view');
print ' | ';
}
// Status
- if (!empty($arrayfields['t.statut']['checked']))
- {
+ if (!empty($arrayfields['t.statut']['checked'])) {
print ''.$contactstatic->getLibStatut(5).' | ';
}
@@ -1194,16 +1128,14 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
print '';
// Add to agenda
- if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
- {
+ if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
print '';
print img_object($langs->trans("Event"), "action");
print ' ';
}
// Edit
- if ($user->rights->societe->contact->creer)
- {
+ if ($user->rights->societe->contact->creer) {
print '';
print img_edit();
print '';
@@ -1288,8 +1220,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$search_end = $end_year.'-'.$end_month.'-'.$end_day.' 23:59:59';
$tms_end = strtotime($search_end);
}
- if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
- {
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
$search_start = '';
$tms_start = '';
$search_end = '';
@@ -1316,8 +1247,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql = '';
- if (!empty($conf->agenda->enabled))
- {
+ if (!empty($conf->agenda->enabled)) {
// Recherche histo sur actioncomm
if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,";
@@ -1370,32 +1300,25 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql .= " AND a.fk_soc = ".$filterobj->id;
elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { /* Nothing */ }
elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql .= " AND a.fk_project = ".$filterobj->id;
- elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
- {
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
- } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
- {
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
- } elseif (is_object($filterobj) && get_class($filterobj) == 'Product')
- {
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
- } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket')
- {
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
- } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM')
- {
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
- } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat')
- {
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
- } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element)
- {
+ } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element) {
// Generic case
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? '@'.$module : '')."'";
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
@@ -1445,18 +1368,15 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
//TODO Add limit in nb of results
- if ($sql)
- {
+ if ($sql) {
$sql .= $db->order($sortfield_new, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
- while ($i < $num)
- {
+ while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->type == 'action') {
@@ -1527,8 +1447,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
}
- if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email)))
- {
+ if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email))) {
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@@ -1540,13 +1459,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$actionstatic = new ActionComm($db);
$userstatic = new User($db);
+ $userlinkcache = array();
$contactstatic = new Contact($db);
+ $elementlinkcache = array();
$out .= ' |