-
- Date et signature
|
+
+ Date et signature
|
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php
index bcda35459f6..01ebd673041 100644
--- a/htdocs/core/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/core/modules/dons/html_cerfafr.modules.php
@@ -3,7 +3,7 @@
* Copyright (C) 2005-2006 Laurent Destailleur
* Copyright (C) 2012 Regis Houssin
* Copyright (C) 2012 Marcos García
- * Copyright (C) 2014-2015 Alexandre Spangaro
+ * Copyright (C) 2014-2020 Alexandre Spangaro
* Copyright (C) 2015 Benoit Bruchard
*
* This program is free software; you can redistribute it and/or modify
@@ -46,7 +46,7 @@ class html_cerfafr extends ModeleDon
$this->db = $db;
$this->name = "cerfafr";
- $this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03';
+ $this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*04';
// Dimension page for size A4
$this->type = 'html';
@@ -150,11 +150,11 @@ class html_cerfafr extends ModeleDon
/*
if (empty($don->societe))
{
- $CodeDon = '| 200 du CGI | 238 bis du CGI | 885-0 V bis A du CGI | ';
+ $CodeDon = ' 200 du CGI | 238 bis du CGI | 978 du CGI | ';
}
else
{
- $CodeDon = ' 200 du CGI | 238 bis du CGI | 885-0 V bis A du CGI | ';
+ $CodeDon = ' 200 du CGI | 238 bis du CGI | 978 du CGI | ';
}
*/
@@ -204,7 +204,7 @@ class html_cerfafr extends ModeleDon
$form = str_replace('__ModePaiement__', $ModePaiement, $form);
$frencharticle='';
- if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)';
+ if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 978 du code général des impôts (CGI)';
$form = str_replace('__FrenchArticle__', $frencharticle, $form);
$frencheligibility='';
@@ -237,18 +237,18 @@ class html_cerfafr extends ModeleDon
}
$form = str_replace('__ARTICLE238__', $art238, $form);
- $art885='';
+ $art978='';
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
- if ($conf->global->DONATION_ART885 >= 1)
+ if ($conf->global->DONATION_ART978 >= 1)
{
- $art885='885-0 V bis du CGI';
+ $art978='978 du CGI';
}
else
{
- $art885='885-0 V bis du CGI';
+ $art978='978 du CGI';
}
}
- $form = str_replace('__ARTICLE885__', $art885, $form);
+ $form = str_replace('__ARTICLE978__', $art978, $form);
// Save file on disk
dol_syslog("html_cerfafr::write_file $file");
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index 9d66ae32e5f..ffba2571d23 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -39,9 +39,9 @@ class MailingTargets // This can't be abstract as it is used for some method
/**
* @var string Error code (or message)
*/
- public $error='';
+ public $error = '';
- public $tooltip='';
+ public $tooltip = '';
/**
@@ -64,12 +64,12 @@ class MailingTargets // This can't be abstract as it is used for some method
global $langs, $form;
$langs->load("mails");
- $transstring="MailingModuleDesc".$this->name;
- $s='';
+ $transstring = "MailingModuleDesc".$this->name;
+ $s = '';
- if ($langs->trans($this->name) != $this->name) $s=$langs->trans($this->name);
- elseif ($langs->trans($transstring) != $transstring) $s=$langs->trans($transstring);
- else $s=$this->desc;
+ if ($langs->trans($this->name) != $this->name) $s = $langs->trans($this->name);
+ elseif ($langs->trans($transstring) != $transstring) $s = $langs->trans($transstring);
+ else $s = $this->desc;
if ($this->tooltip && is_object($form)) $s .= ' '.$form->textwithpicto('', $langs->trans($this->tooltip), 1, 1);
return $s;
@@ -93,7 +93,7 @@ class MailingTargets // This can't be abstract as it is used for some method
*/
public function getNbOfRecipients($sql)
{
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
$obj = $this->db->fetch_object($result);
@@ -101,7 +101,7 @@ class MailingTargets // This can't be abstract as it is used for some method
}
else
{
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
return -1;
}
}
@@ -130,18 +130,18 @@ class MailingTargets // This can't be abstract as it is used for some method
// Mise a jour nombre de destinataire dans table des mailings
$sql = "SELECT COUNT(*) nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " WHERE fk_mailing = ".$mailing_id;
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
- $obj=$this->db->fetch_object($result);
- $nb=$obj->nb;
+ $obj = $this->db->fetch_object($result);
+ $nb = $obj->nb;
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing";
$sql .= " SET nbemail = ".$nb." WHERE rowid = ".$mailing_id;
if (!$this->db->query($sql))
{
dol_syslog($this->db->error());
- $this->error=$this->db->error();
+ $this->error = $this->db->error();
return -1;
}
}
@@ -169,26 +169,26 @@ class MailingTargets // This can't be abstract as it is used for some method
$num = count($cibles);
foreach ($cibles as $targetarray)
{
- if (! empty($targetarray['email'])) // avoid empty email address
+ if (!empty($targetarray['email'])) // avoid empty email address
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_cibles";
- $sql.= " (fk_mailing,";
- $sql.= " fk_contact,";
- $sql.= " lastname, firstname, email, other, source_url, source_id,";
- $sql.= " tag,";
- $sql.= " source_type)";
- $sql.= " VALUES (".$mailing_id.",";
- $sql.= (empty($targetarray['fk_contact']) ? '0' : "'".$targetarray['fk_contact']."'") .",";
- $sql.= "'".$this->db->escape($targetarray['lastname'])."',";
- $sql.= "'".$this->db->escape($targetarray['firstname'])."',";
- $sql.= "'".$this->db->escape($targetarray['email'])."',";
- $sql.= "'".$this->db->escape($targetarray['other'])."',";
- $sql.= "'".$this->db->escape($targetarray['source_url'])."',";
- $sql.= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
+ $sql .= " (fk_mailing,";
+ $sql .= " fk_contact,";
+ $sql .= " lastname, firstname, email, other, source_url, source_id,";
+ $sql .= " tag,";
+ $sql .= " source_type)";
+ $sql .= " VALUES (".$mailing_id.",";
+ $sql .= (empty($targetarray['fk_contact']) ? '0' : "'".$targetarray['fk_contact']."'").",";
+ $sql .= "'".$this->db->escape($targetarray['lastname'])."',";
+ $sql .= "'".$this->db->escape($targetarray['firstname'])."',";
+ $sql .= "'".$this->db->escape($targetarray['email'])."',";
+ $sql .= "'".$this->db->escape($targetarray['other'])."',";
+ $sql .= "'".$this->db->escape($targetarray['source_url'])."',";
+ $sql .= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
$sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['lastname'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
$sql .= "'".$this->db->escape($targetarray['source_type'])."')";
dol_syslog(__METHOD__, LOG_DEBUG);
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
$j++;
@@ -199,7 +199,7 @@ class MailingTargets // This can't be abstract as it is used for some method
{
// Si erreur autre que doublon
dol_syslog($this->db->error().' : '.$targetarray['email']);
- $this->error=$this->db->error().' : '.$targetarray['email'];
+ $this->error = $this->db->error().' : '.$targetarray['email'];
$this->db->rollback();
return -1;
}
@@ -232,8 +232,8 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= " WHERE fk_mailing=".$mailing_id." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
- $result=$this->db->query($sql);
- if (! $result)
+ $result = $this->db->query($sql);
+ if (!$result)
{
dol_print_error($this->db);
}
@@ -258,7 +258,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " WHERE fk_mailing = ".$mailing_id;
- if (! $this->db->query($sql))
+ if (!$this->db->query($sql))
{
dol_syslog($this->db->error());
}
diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php
index 42b4a8ef2b2..f4999f309c2 100644
--- a/htdocs/core/modules/modDon.class.php
+++ b/htdocs/core/modules/modDon.class.php
@@ -91,10 +91,10 @@ class modDon extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
- $this->const[$r][0] = "DONATION_ART885";
+ $this->const[$r][0] = "DONATION_ART978";
$this->const[$r][1] = "yesno";
$this->const[$r][2] = "0";
- $this->const[$r][3] = 'Option Française - Eligibilité Art885-0 V bis du CGI';
+ $this->const[$r][3] = 'Option Française - Eligibilité Art978 du CGI';
$this->const[$r][4] = 0;
$r++;
diff --git a/htdocs/core/modules/oauth/github_oauthcallback.php b/htdocs/core/modules/oauth/github_oauthcallback.php
index e84fd023c78..4320481abb1 100644
--- a/htdocs/core/modules/oauth/github_oauthcallback.php
+++ b/htdocs/core/modules/oauth/github_oauthcallback.php
@@ -29,8 +29,8 @@ use OAuth\Common\Consumer\Credentials;
use OAuth\OAuth2\Service\GitHub;
// Define $urlwithroot
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
-$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
@@ -70,8 +70,8 @@ $credentials = new Credentials(
$currentUri->getAbsoluteUri()
);
-$requestedpermissionsarray=array();
-if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back
+$requestedpermissionsarray = array();
+if (GETPOST('state')) $requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back
if ($action != 'delete' && empty($requestedpermissionsarray))
{
print 'Error, parameter state is not defined';
@@ -99,11 +99,11 @@ if ($action == 'delete')
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
- header('Location: ' . $backtourl);
+ header('Location: '.$backtourl);
exit();
}
-if (! empty($_GET['code'])) // We are coming from oauth provider page
+if (!empty($_GET['code'])) // We are coming from oauth provider page
{
// We should have
//$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16))
@@ -132,12 +132,12 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
// has not the ending parameter to true like the Google class constructor.
- setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
+ setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
- header('Location: ' . $backtourl);
+ header('Location: '.$backtourl);
exit();
} catch (Exception $e) {
print $e->getMessage();
@@ -145,7 +145,7 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
}
else // If entry on page with no parameter, we arrive here
{
- $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
+ $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
// This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor).
@@ -155,11 +155,11 @@ else // If entry on page with no parameter, we arrive here
}
else
{
- $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
+ $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
}
// we go on oauth provider authorization page
- header('Location: ' . $url);
+ header('Location: '.$url);
exit();
}
diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php
index 4a313b6736b..68aba389f31 100644
--- a/htdocs/core/modules/oauth/google_oauthcallback.php
+++ b/htdocs/core/modules/oauth/google_oauthcallback.php
@@ -29,8 +29,8 @@ use OAuth\Common\Consumer\Credentials;
use OAuth\OAuth2\Service\Google;
// Define $urlwithroot
-$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
-$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
@@ -70,8 +70,8 @@ $credentials = new Credentials(
$currentUri->getAbsoluteUri()
);
-$requestedpermissionsarray=array();
-if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back
+$requestedpermissionsarray = array();
+if (GETPOST('state')) $requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back
if ($action != 'delete' && empty($requestedpermissionsarray))
{
print 'Error, parameter state is not defined';
@@ -105,11 +105,11 @@ if ($action == 'delete')
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
- header('Location: ' . $backtourl);
+ header('Location: '.$backtourl);
exit();
}
-if (! empty($_GET['code'])) // We are coming from oauth provider page
+if (!empty($_GET['code'])) // We are coming from oauth provider page
{
dol_syslog("We are coming from the oauth provider page");
//llxHeader('',$langs->trans("OAuthSetup"));
@@ -130,12 +130,12 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
$token = $apiService->requestAccessToken($_GET['code'], $state);
- setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
+ setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
- header('Location: ' . $backtourl);
+ header('Location: '.$backtourl);
exit();
} catch (Exception $e) {
print $e->getMessage();
@@ -143,7 +143,7 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
}
else // If entry on page with no parameter, we arrive here
{
- $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
+ $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
// This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor).
@@ -153,11 +153,11 @@ else // If entry on page with no parameter, we arrive here
}
else
{
- $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
+ $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
}
// we go on oauth provider authorization page
- header('Location: ' . $url);
+ header('Location: '.$url);
exit();
}
diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php
index 0ee3cdb73ab..b51fd0a20b7 100644
--- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php
+++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php
@@ -26,7 +26,7 @@
* \ingroup agenda
* \brief Trigger file for company - contactroles
*/
-require_once DOL_DOCUMENT_ROOT . '/core/triggers/dolibarrtriggers.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
/**
* Class of triggered functions for agenda module
@@ -71,23 +71,23 @@ class InterfaceContactRoles extends DolibarrTriggers
if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE'
|| $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE'
|| $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE') {
- dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
+ dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$socid = (property_exists($object, 'socid') ? $object->socid : $object->fk_soc);
- if (! empty($socid) && $socid > 0) {
- require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
+ if (!empty($socid) && $socid > 0) {
+ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$contactdefault = new Contact($this->db);
$contactdefault->socid = $socid;
$TContact = $contactdefault->getContactRoles($object->element);
- if (is_array($TContact) && ! empty($TContact)) {
+ if (is_array($TContact) && !empty($TContact)) {
$TContactAlreadyLinked = array();
if ($object->id > 0) {
$cloneFrom = dol_clone($object, 1);
- if (! empty($cloneFrom->id)) {
- $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(- 1, 'external'), $cloneFrom->liste_contact(- 1, 'internal'));
+ if (!empty($cloneFrom->id)) {
+ $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal'));
}
}
@@ -102,7 +102,7 @@ class InterfaceContactRoles extends DolibarrTriggers
foreach ($TContact as $infos) {
$res = $object->add_contact($infos['fk_socpeople'], $infos['type_contact']);
if ($res > 0)
- $nb ++;
+ $nb++;
}
if ($nb > 0) {
diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php
index 9387c1a099d..e8e7fa4f5b9 100644
--- a/htdocs/don/admin/donation.php
+++ b/htdocs/don/admin/donation.php
@@ -2,9 +2,9 @@
/* Copyright (C) 2005-2010 Laurent Destailleur
* Copyright (C) 2012-2015 Juanjo Menent
* Copyright (C) 2013-2017 Philippe Grand
- * Copyright (C) 2015-2017 Alexandre Spangaro
+ * Copyright (C) 2015-2020 Alexandre Spangaro
* Copyright (C) 2015 Benoit Bruchard
- * Copyright (C) 2019 Thibault FOUCART
+ * Copyright (C) 2019 Thibault FOUCART
*
* 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
@@ -431,13 +431,13 @@ if (preg_match('/fr/i', $conf->global->MAIN_INFO_SOCIETE_COUNTRY))
print ' | ';
print '';
- print '| '.$langs->trans("DONATION_ART885").' | ';
+ print ''.$langs->trans("DONATION_ART978").' | ';
print '';
if ($conf->use_javascript_ajax) {
- print ajax_constantonoff('DONATION_ART885');
+ print ajax_constantonoff('DONATION_ART978');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
- print $form->selectarray("DONATION_ART885", $arrval, $conf->global->DONATION_ART885);
+ print $form->selectarray("DONATION_ART978", $arrval, $conf->global->DONATION_ART978);
}
print ' | ';
print " \n";
diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php
index 4992c9f8495..b3ab7e2d360 100644
--- a/htdocs/don/payment/payment.php
+++ b/htdocs/don/payment/payment.php
@@ -29,12 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("bills");
-$chid=GETPOST("rowid");
-$action=GETPOST('action', 'aZ09');
+$chid = GETPOST("rowid");
+$action = GETPOST('action', 'aZ09');
$amounts = array();
// Security check
-$socid=0;
+$socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
}
@@ -48,7 +48,7 @@ $object = new Don($db);
if ($action == 'add_payment')
{
- $error=0;
+ $error = 0;
if ($_POST["cancel"])
{
@@ -59,7 +59,7 @@ if ($action == 'add_payment')
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
- if (! $_POST["paymenttype"] > 0)
+ if (!$_POST["paymenttype"] > 0)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
$error++;
@@ -69,13 +69,13 @@ if ($action == 'add_payment')
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$error++;
}
- if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
+ if (!empty($conf->banque->enabled) && !$_POST["accountid"] > 0)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
$error++;
}
- if (! $error)
+ if (!$error)
{
$paymentid = 0;
@@ -92,11 +92,11 @@ if ($action == 'add_payment')
if (count($amounts) <= 0)
{
$error++;
- $errmsg='ErrorNoPaymentDefined';
+ $errmsg = 'ErrorNoPaymentDefined';
setEventMessages($errmsg, null, 'errors');
}
- if (! $error)
+ if (!$error)
{
$db->begin();
@@ -104,34 +104,34 @@ if ($action == 'add_payment')
$payment = new PaymentDonation($db);
$payment->chid = $chid;
$payment->datepaid = $datepaid;
- $payment->amounts = $amounts; // Tableau de montant
+ $payment->amounts = $amounts; // Tableau de montant
$payment->paymenttype = GETPOST("paymenttype", 'int');
$payment->num_payment = GETPOST("num_payment", 'alphanohtml');
$payment->note_public = GETPOST("note_public", 'none');
- if (! $error)
+ if (!$error)
{
$paymentid = $payment->create($user);
if ($paymentid < 0)
{
- $errmsg=$payment->error;
+ $errmsg = $payment->error;
setEventMessages($errmsg, null, 'errors');
$error++;
}
}
- if (! $error)
+ if (!$error)
{
- $result=$payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', '');
- if (! $result > 0)
+ $result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', '');
+ if (!$result > 0)
{
- $errmsg=$payment->error;
+ $errmsg = $payment->error;
setEventMessages($errmsg, null, 'errors');
$error++;
}
}
- if (! $error)
+ if (!$error)
{
$db->commit();
$loc = DOL_URL_ROOT.'/don/card.php?rowid='.$chid;
@@ -153,18 +153,18 @@ if ($action == 'add_payment')
* View
*/
-$form=new Form($db);
+$form = new Form($db);
llxHeader();
$sql = "SELECT sum(p.amount) as total";
-$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
-$sql.= " WHERE p.fk_donation = ".$chid;
+$sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
+$sql .= " WHERE p.fk_donation = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
- $obj=$db->fetch_object($resql);
+ $obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
}
@@ -191,7 +191,7 @@ if ($action == 'create')
print ' | | '.$langs->trans("Date").' | ';
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
- $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0;
+ $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaid) : 0;
print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1, 0, '', '', $object->date, '', 1, $langs->trans("DonationDate"));
print " | ";
print ' ';
@@ -204,7 +204,7 @@ if ($action == 'create')
print '';
print '| '.$langs->trans('AccountToCredit').' | ';
print '';
- $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid") : $object->accountid, "accountid", 0, '', 1); // Show open bank account list
+ $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid") : $object->accountid, "accountid", 0, '', 1); // Show open bank account list
print ' | ';
// Number
@@ -238,8 +238,8 @@ if ($action == 'create')
print ''.$langs->trans("Amount").' | ';
print "\n";
- $total=0;
- $totalrecu=0;
+ $total = 0;
+ $totalrecu = 0;
while ($i < $num)
{
diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php
index a62d033af2d..c7bf959e27e 100644
--- a/htdocs/expensereport/class/expensereport_ik.class.php
+++ b/htdocs/expensereport/class/expensereport_ik.class.php
@@ -32,17 +32,17 @@ class ExpenseReportIk extends CoreObject
/**
* @var string ID to identify managed object
*/
- public $element='expenseik';
+ public $element = 'expenseik';
/**
* @var string Name of table without prefix where object is stored
*/
- public $table_element='expensereport_ik';
+ public $table_element = 'expensereport_ik';
/**
* @var int Field with ID of parent key if this field has a parent
*/
- public $fk_element='fk_expense_ik';
+ public $fk_element = 'fk_expense_ik';
/**
* c_exp_tax_cat Id
@@ -72,10 +72,10 @@ class ExpenseReportIk extends CoreObject
* Attribute object linked with database
* @var array
*/
- public $fields=array(
- 'rowid'=>array('type'=>'integer','index'=>true)
- ,'fk_c_exp_tax_cat'=>array('type'=>'integer','index'=>true)
- ,'fk_range'=>array('type'=>'integer','index'=>true)
+ public $fields = array(
+ 'rowid'=>array('type'=>'integer', 'index'=>true)
+ ,'fk_c_exp_tax_cat'=>array('type'=>'integer', 'index'=>true)
+ ,'fk_range'=>array('type'=>'integer', 'index'=>true)
,'coef'=>array('type'=>'double')
,'ikoffset'=>array('type'=>'double')
);
@@ -109,10 +109,10 @@ class ExpenseReportIk extends CoreObject
$categories = array();
$sql = 'SELECT rowid, label, entity, active';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat';
- $sql.= ' WHERE entity IN ('. getEntity('c_exp_tax_cat').')';
- if ($mode == 1) $sql.= ' AND active = 1';
- elseif ($mode == 2) $sql.= 'AND active = 0';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat';
+ $sql .= ' WHERE entity IN ('.getEntity('c_exp_tax_cat').')';
+ if ($mode == 1) $sql .= ' AND active = 1';
+ elseif ($mode == 2) $sql .= 'AND active = 0';
dol_syslog(get_called_class().'::getTaxCategories sql='.$sql, LOG_DEBUG);
$resql = $db->query($sql);
@@ -144,8 +144,8 @@ class ExpenseReportIk extends CoreObject
$ranges = self::getRangesByCategory($fk_c_exp_tax_cat);
// substract 1 because array start from 0
- if (empty($ranges) || !isset($ranges[$default_range-1])) return false;
- else return $ranges[$default_range-1];
+ if (empty($ranges) || !isset($ranges[$default_range - 1])) return false;
+ else return $ranges[$default_range - 1];
}
/**
@@ -162,10 +162,10 @@ class ExpenseReportIk extends CoreObject
$ranges = array();
$sql = 'SELECT r.rowid FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
- if ($active) $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
- $sql.= ' WHERE r.fk_c_exp_tax_cat = '.$fk_c_exp_tax_cat;
- if ($active) $sql.= ' AND r.active = 1 AND c.active = 1';
- $sql.= ' ORDER BY r.range_ik';
+ if ($active) $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
+ $sql .= ' WHERE r.fk_c_exp_tax_cat = '.$fk_c_exp_tax_cat;
+ if ($active) $sql .= ' AND r.active = 1 AND c.active = 1';
+ $sql .= ' ORDER BY r.range_ik';
dol_syslog(get_called_class().'::getRangesByCategory sql='.$sql, LOG_DEBUG);
$resql = $db->query($sql);
@@ -203,11 +203,11 @@ class ExpenseReportIk extends CoreObject
$ranges = array();
$sql = ' SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, c.label, i.rowid as fk_expense_ik, r.active as range_active, c.active as cat_active';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
- $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)';
- $sql.= ' WHERE r.entity IN (0, '. getEntity('').')';
- $sql.= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
+ $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport_ik i ON (r.rowid = i.fk_range)';
+ $sql .= ' WHERE r.entity IN (0, '.getEntity('').')';
+ $sql .= ' ORDER BY r.fk_c_exp_tax_cat, r.range_ik';
dol_syslog(get_called_class().'::getAllRanges sql='.$sql, LOG_DEBUG);
$resql = $db->query($sql);
@@ -239,14 +239,14 @@ class ExpenseReportIk extends CoreObject
*/
public static function getMaxRangeNumber($default_c_exp_tax_cat = 0)
{
- global $db,$conf;
+ global $db, $conf;
$sql = 'SELECT MAX(counted) as nbRange FROM (';
- $sql.= ' SELECT COUNT(*) as counted';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
- $sql.= ' WHERE r.entity IN (0, '.$conf->entity.')';
+ $sql .= ' SELECT COUNT(*) as counted';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'c_exp_tax_range r';
+ $sql .= ' WHERE r.entity IN (0, '.$conf->entity.')';
if ($default_c_exp_tax_cat > 0) $sql .= ' AND r.fk_c_exp_tax_cat = '.$default_c_exp_tax_cat;
- $sql.= ' GROUP BY r.fk_c_exp_tax_cat';
+ $sql .= ' GROUP BY r.fk_c_exp_tax_cat';
$sql .= ') as counts';
dol_syslog(get_called_class().'::getMaxRangeNumber sql='.$sql, LOG_DEBUG);
diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php
index 08538ac8f61..b98552f681d 100644
--- a/htdocs/expensereport/class/expensereport_rule.class.php
+++ b/htdocs/expensereport/class/expensereport_rule.class.php
@@ -32,17 +32,17 @@ class ExpenseReportRule extends CoreObject
/**
* @var string ID to identify managed object
*/
- public $element='expenserule';
+ public $element = 'expenserule';
/**
* @var string Name of table without prefix where object is stored
*/
- public $table_element='expensereport_rules';
+ public $table_element = 'expensereport_rules';
/**
* @var int Field with ID of parent key if this field has a parent
*/
- public $fk_element='fk_expense_rule';
+ public $fk_element = 'fk_expense_rule';
/**
* date start
@@ -111,8 +111,8 @@ class ExpenseReportRule extends CoreObject
* Attribute object linked with database
* @var array
*/
- public $fields=array(
- 'rowid'=>array('type'=>'integer','index'=>true)
+ public $fields = array(
+ 'rowid'=>array('type'=>'integer', 'index'=>true)
,'dates'=>array('type'=>'date')
,'datee'=>array('type'=>'date')
,'amount'=>array('type'=>'double')
@@ -154,25 +154,25 @@ class ExpenseReportRule extends CoreObject
$rules = array();
$sql = 'SELECT er.rowid';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er';
- $sql.= ' WHERE er.entity IN (0,'. getEntity('').')';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er';
+ $sql .= ' WHERE er.entity IN (0,'.getEntity('').')';
if (!empty($fk_c_type_fees))
{
- $sql.= ' AND er.fk_c_type_fees IN (-1, '.$fk_c_type_fees.')';
+ $sql .= ' AND er.fk_c_type_fees IN (-1, '.$fk_c_type_fees.')';
}
if (!empty($date))
{
$date = dol_print_date($date, '%Y-%m-%d');
- $sql.= ' AND er.dates <= \''.$date.'\'';
- $sql.= ' AND er.datee >= \''.$date.'\'';
+ $sql .= ' AND er.dates <= \''.$date.'\'';
+ $sql .= ' AND er.datee >= \''.$date.'\'';
}
if ($fk_user > 0)
{
- $sql.= ' AND (er.is_for_all = 1';
- $sql.= ' OR er.fk_user = '.$fk_user;
- $sql.= ' OR er.fk_usergroup IN (SELECT ugu.fk_usergroup FROM '.MAIN_DB_PREFIX.'usergroup_user ugu WHERE ugu.fk_user = '.$fk_user.') )';
+ $sql .= ' AND (er.is_for_all = 1';
+ $sql .= ' OR er.fk_user = '.$fk_user;
+ $sql .= ' OR er.fk_usergroup IN (SELECT ugu.fk_usergroup FROM '.MAIN_DB_PREFIX.'usergroup_user ugu WHERE ugu.fk_user = '.$fk_user.') )';
}
- $sql.= ' ORDER BY er.is_for_all, er.fk_usergroup, er.fk_user';
+ $sql .= ' ORDER BY er.is_for_all, er.fk_usergroup, er.fk_user';
dol_syslog("ExpenseReportRule::getAllRule sql=".$sql);
diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php
index ad2c981b8b9..6543747d1f7 100644
--- a/htdocs/exports/export.php
+++ b/htdocs/exports/export.php
@@ -411,7 +411,7 @@ if ($step == 4 && $action == 'submitFormField')
$newcode = (string) preg_replace('/\./', '_', $code);
//print 'xxx'.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n ";
$filterqualified = 1;
- if (! GETPOSTISSET($newcode) || GETPOST($newcode, 'restricthtml') == '') $filterqualified = 0;
+ if (!GETPOSTISSET($newcode) || GETPOST($newcode, 'restricthtml') == '') $filterqualified = 0;
elseif (preg_match('/^List/', $type) && (is_numeric(GETPOST($newcode, 'restricthtml')) && GETPOST($newcode, 'restricthtml') <= 0)) $filterqualified = 0;
if ($filterqualified)
{
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index 246baaadc04..447630e7eb2 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -163,3 +163,4 @@ INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, desc
INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('CANCELED', '50', 'Canceled', 1, 0, NULL);
INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('OTHER', '90', 'Other', 1, 0, NULL);
+DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__;
\ No newline at end of file
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 508087f85d2..d2fd807a706 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -164,6 +164,8 @@ OpportunityProbability=Lead probability
OpportunityProbabilityShort=Lead probab.
OpportunityAmount=Lead amount
OpportunityAmountShort=Lead amount
+OpportunityWeightedAmount=Opportunity weighted amount
+OpportunityWeightedAmountShort=Opp. weighted amount
OpportunityAmountAverageShort=Average lead amount
OpportunityAmountWeigthedShort=Weighted lead amount
WonLostExcluded=Won/Lost excluded
diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang
index e1de5b386a1..bd8c524e8f2 100644
--- a/htdocs/langs/fr_FR/projects.lang
+++ b/htdocs/langs/fr_FR/projects.lang
@@ -163,6 +163,8 @@ OpportunityProbability=Probabilité d'opportunité
OpportunityProbabilityShort=Prob. opp.
OpportunityAmount=Montant opportunité
OpportunityAmountShort=Montant opportunité
+OpportunityWeightedAmount=Montant pondéré opportunité
+OpportunityWeightedAmountShort=Montant pondéré opp.
OpportunityAmountAverageShort=montant moyen des opportunités
OpportunityAmountWeigthedShort=Montant pondéré des opportunités
WonLostExcluded=hors opportunités remportées/perdues
diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php
index c8654a14d28..b6aa0399447 100644
--- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php
@@ -18,19 +18,19 @@ dol_include_once("/mymodule/class/myobject.class.php");
class mailing_mailinglist_mymodule_myobject extends MailingTargets
{
// CHANGE THIS: Put here a name not already used
- public $name='mailinglist_mymodule_myobject';
+ public $name = 'mailinglist_mymodule_myobject';
// CHANGE THIS: Put here a description of your selector module
- public $desc='My object emailing target selector';
+ public $desc = 'My object emailing target selector';
// CHANGE THIS: Set to 1 if selector is available for admin users only
- public $require_admin=0;
+ public $require_admin = 0;
- public $enabled=0;
- public $require_module=array();
+ public $enabled = 0;
+ public $require_module = array();
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
- public $picto='mymodule@mymodule';
+ public $picto = 'mymodule@mymodule';
/**
* @var DoliDB Database handler.
@@ -47,10 +47,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
{
global $conf;
- $this->db=$db;
+ $this->db = $db;
if (is_array($conf->modules))
{
- $this->enabled=in_array('mymodule', $conf->modules)?1:0;
+ $this->enabled = in_array('mymodule', $conf->modules) ? 1 : 0;
}
}
@@ -65,20 +65,20 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
global $langs;
$langs->load("members");
- $form=new Form($this->db);
+ $form = new Form($this->db);
- $arraystatus=array(1=>'Option 1', 2=>'Option 2');
+ $arraystatus = array(1=>'Option 1', 2=>'Option 2');
- $s='';
- $s.=$langs->trans("Status").': ';
- $s.='';
+ $s .= ' ';
return $s;
}
@@ -110,13 +110,13 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
$j = 0;
$sql = " select rowid as id, email, firstname, lastname, plan, partner";
- $sql.= " from ".MAIN_DB_PREFIX."myobject";
- $sql.= " where email IS NOT NULL AND email != ''";
- if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') $sql.= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'";
- $sql.= " ORDER BY email";
+ $sql .= " from ".MAIN_DB_PREFIX."myobject";
+ $sql .= " where email IS NOT NULL AND email != ''";
+ if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') $sql .= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'";
+ $sql .= " ORDER BY email";
// Stocke destinataires dans target
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
@@ -150,7 +150,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
else
{
dol_syslog($this->db->error());
- $this->error=$this->db->error();
+ $this->error = $this->db->error();
return -1;
}
@@ -197,7 +197,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
*/
public function getNbOfRecipients($filter = 1, $option = '')
{
- $a=parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''");
+ $a = parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''");
if ($a < 0) return -1;
return $a;
diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php
index 73ab40c75b8..a50e22315d5 100644
--- a/htdocs/product/admin/dynamic_prices.php
+++ b/htdocs/product/admin/dynamic_prices.php
@@ -63,9 +63,9 @@ if ($action == 'edit_updater') {
if (!empty($action) && empty($cancel)) {
//Global variable actions
if ($action == 'create_variable' || $action == 'edit_variable') {
- $price_globals->code = GETPOSTISSET('code')?GETPOST('code', 'alpha'):$price_globals->code;
- $price_globals->description = GETPOSTISSET('description')?GETPOST('description', 'alpha'):$price_globals->description;
- $price_globals->value = GETPOSTISSET('value')?GETPOST('value', 'int'):$price_globals->value;
+ $price_globals->code = GETPOSTISSET('code') ?GETPOST('code', 'alpha') : $price_globals->code;
+ $price_globals->description = GETPOSTISSET('description') ?GETPOST('description', 'alpha') : $price_globals->description;
+ $price_globals->value = GETPOSTISSET('value') ?GETPOST('value', 'int') : $price_globals->value;
//Check if record already exists only when saving
if (!empty($save)) {
foreach ($price_globals->listGlobalVariables() as $entry) {
@@ -101,11 +101,11 @@ if (!empty($action) && empty($cancel)) {
//Updaters actions
if ($action == 'create_updater' || $action == 'edit_updater') {
- $price_updaters->type = GETPOSTISSET('type')?GETPOST('type', 'int'):$price_updaters->type;
- $price_updaters->description = GETPOSTISSET('description')?GETPOST('description', 'alpha'):$price_updaters->description;
- $price_updaters->parameters = GETPOSTISSET('parameters')?GETPOST('parameters'):$price_updaters->parameters;
- $price_updaters->fk_variable = GETPOSTISSET('fk_variable')?GETPOST('fk_variable', 'int'):$price_updaters->fk_variable;
- $price_updaters->update_interval = GETPOSTISSET('update_interval')?GETPOST('update_interval', 'int'):$price_updaters->update_interval;
+ $price_updaters->type = GETPOSTISSET('type') ?GETPOST('type', 'int') : $price_updaters->type;
+ $price_updaters->description = GETPOSTISSET('description') ?GETPOST('description', 'alpha') : $price_updaters->description;
+ $price_updaters->parameters = GETPOSTISSET('parameters') ?GETPOST('parameters') : $price_updaters->parameters;
+ $price_updaters->fk_variable = GETPOSTISSET('fk_variable') ?GETPOST('fk_variable', 'int') : $price_updaters->fk_variable;
+ $price_updaters->update_interval = GETPOSTISSET('update_interval') ?GETPOST('update_interval', 'int') : $price_updaters->update_interval;
}
if ($action == 'create_updater' && !empty($save)) {
//Verify if process() works
@@ -150,7 +150,7 @@ $form = new Form($db);
llxHeader("", "", $langs->trans("CardProduct".$product->type));
-$linkback=''.$langs->trans("BackToModuleList").'';
+$linkback = ''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("DynamicPriceConfiguration"), $linkback, 'title_setup');
print ''.$langs->trans("DynamicPriceDesc").' ';
@@ -169,8 +169,8 @@ if ($action != 'create_updater' && $action != 'edit_updater')
print ' | '; //Space for buttons
print '';
- $arrayglobalvars=$price_globals->listGlobalVariables();
- if (! empty($arrayglobalvars))
+ $arrayglobalvars = $price_globals->listGlobalVariables();
+ if (!empty($arrayglobalvars))
{
foreach ($arrayglobalvars as $i=>$entry) {
$var = !$var;
@@ -215,17 +215,17 @@ if ($action == 'create_variable' || $action == 'edit_variable') {
//Code
print '';
print '| '.$langs->trans("Variable").' | ';
- print ' | ';
+ print ' | ';
print ' ';
//Description
print '';
print '| '.$langs->trans("Description").' | ';
- print ' | ';
+ print ' | ';
print ' ';
//Value
print '';
print '| '.$langs->trans("Value").' | ';
- print ' | ';
+ print ' | ';
print ' ';
print ' ';
@@ -254,7 +254,7 @@ if ($action != 'create_variable' && $action != 'edit_variable')
print '';
$arraypriceupdaters = $price_updaters->listUpdaters();
- if (! empty($arraypriceupdaters))
+ if (!empty($arraypriceupdaters))
{
foreach ($arraypriceupdaters as $i=>$entry) {
$code = "";
@@ -308,19 +308,19 @@ if ($action == 'create_updater' || $action == 'edit_updater') {
print ''.$langs->trans("VariableToUpdate").' | ';
$globals_list = array();
foreach ($price_globals->listGlobalVariables() as $entry) {
- $globals_list[$entry->id]=$entry->code;
+ $globals_list[$entry->id] = $entry->code;
}
- print $form->selectarray('fk_variable', $globals_list, (empty($price_updaters->fk_variable)?0:$price_updaters->fk_variable));
+ print $form->selectarray('fk_variable', $globals_list, (empty($price_updaters->fk_variable) ? 0 : $price_updaters->fk_variable));
print ' | ';
//Description
print '';
print '| '.$langs->trans("Description").' | ';
- print ' | ';
+ print ' | ';
print ' ';
//Type
print '';
print '| '.$langs->trans("Type").' | ';
- $type = empty($price_updaters->type)?0:$price_updaters->type;
+ $type = empty($price_updaters->type) ? 0 : $price_updaters->type;
$type_list = array();
foreach ($price_updaters->types as $val) {
$type_list[$val] = $langs->trans("GlobalVariableUpdaterType".$val);
@@ -342,14 +342,14 @@ if ($action == 'create_updater' || $action == 'edit_updater') {
$help = $langs->trans("GlobalVariableUpdaterHelp".$type).' '.$langs->trans("GlobalVariableUpdaterHelpFormat".$type).'';
print ' | '.$form->textwithpicto($langs->trans("Parameters"), $help, 1).' | ';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('parameters', empty($price_updaters->parameters)?'':$price_updaters->parameters, '', 300, '', '', false, false, false, ROWS_8, '90%');
+ $doleditor = new DolEditor('parameters', empty($price_updaters->parameters) ? '' : $price_updaters->parameters, '', 300, '', '', false, false, false, ROWS_8, '90%');
$doleditor->Create();
print ' | ';
print '';
//Interval
print '';
print '| '.$langs->trans("UpdateInterval").' | ';
- print ' | ';
+ print ' | ';
print ' ';
print ' ';
diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php
index fd8cb125c22..2a2eaa86d23 100644
--- a/htdocs/product/class/propalmergepdfproduct.class.php
+++ b/htdocs/product/class/propalmergepdfproduct.class.php
@@ -34,22 +34,22 @@ class Propalmergepdfproduct extends CommonObject
/**
* @var string ID to identify managed object
*/
- public $element='propal_merge_pdf_product';
+ public $element = 'propal_merge_pdf_product';
/**
* @var string Name of table without prefix where object is stored
*/
- public $table_element='propal_merge_pdf_product';
+ public $table_element = 'propal_merge_pdf_product';
public $fk_product;
public $file_name;
public $fk_user_author;
public $fk_user_mod;
- public $datec='';
- public $tms='';
+ public $datec = '';
+ public $tms = '';
public $lang;
- public $lines=array();
+ public $lines = array();
@@ -75,16 +75,16 @@ class Propalmergepdfproduct extends CommonObject
public function create($user, $notrigger = 0)
{
global $conf, $langs;
- $error=0;
+ $error = 0;
// Clean parameters
- if (isset($this->fk_product)) $this->fk_product=trim($this->fk_product);
- if (isset($this->file_name)) $this->file_name=trim($this->file_name);
- if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author);
- if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);
- if (isset($this->lang)) $this->lang=trim($this->lang);
- if (isset($this->import_key)) $this->import_key=trim($this->import_key);
+ if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
+ if (isset($this->file_name)) $this->file_name = trim($this->file_name);
+ if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author);
+ if (isset($this->fk_user_mod)) $this->fk_user_mod = trim($this->fk_user_mod);
+ if (isset($this->lang)) $this->lang = trim($this->lang);
+ if (isset($this->import_key)) $this->import_key = trim($this->import_key);
@@ -94,41 +94,41 @@ class Propalmergepdfproduct extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_merge_pdf_product(";
- $sql.= "fk_product,";
- $sql.= "file_name,";
+ $sql .= "fk_product,";
+ $sql .= "file_name,";
if ($conf->global->MAIN_MULTILANGS) {
- $sql.= "lang,";
+ $sql .= "lang,";
}
- $sql.= "fk_user_author,";
- $sql.= "fk_user_mod,";
- $sql.= "datec";
+ $sql .= "fk_user_author,";
+ $sql .= "fk_user_mod,";
+ $sql .= "datec";
- $sql.= ") VALUES (";
+ $sql .= ") VALUES (";
- $sql.= " ".(! isset($this->fk_product)?'NULL':"'".$this->db->escape($this->fk_product)."'").",";
- $sql.= " ".(! isset($this->file_name)?'NULL':"'".$this->db->escape($this->file_name)."'").",";
+ $sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").",";
+ $sql .= " ".(!isset($this->file_name) ? 'NULL' : "'".$this->db->escape($this->file_name)."'").",";
if ($conf->global->MAIN_MULTILANGS) {
- $sql.= " ".(! isset($this->lang)?'NULL':"'".$this->db->escape($this->lang)."'").",";
+ $sql .= " ".(!isset($this->lang) ? 'NULL' : "'".$this->db->escape($this->lang)."'").",";
}
- $sql.= " ".$user->id.",";
- $sql.= " ".$user->id.",";
- $sql.= " '".$this->db->idate(dol_now())."'";
+ $sql .= " ".$user->id.",";
+ $sql .= " ".$user->id.",";
+ $sql .= " '".$this->db->idate(dol_now())."'";
- $sql.= ")";
+ $sql .= ")";
$this->db->begin();
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql=$this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ $resql = $this->db->query($sql);
+ if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
- if (! $error)
+ if (!$error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."propal_merge_pdf_product");
- if (! $notrigger)
+ if (!$notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@@ -145,13 +145,13 @@ class Propalmergepdfproduct extends CommonObject
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -169,33 +169,33 @@ class Propalmergepdfproduct extends CommonObject
*/
public function fetch($id)
{
- global $langs,$conf;
+ global $langs, $conf;
$sql = "SELECT";
- $sql.= " t.rowid,";
+ $sql .= " t.rowid,";
- $sql.= " t.fk_product,";
- $sql.= " t.file_name,";
- $sql.= " t.lang,";
- $sql.= " t.fk_user_author,";
- $sql.= " t.fk_user_mod,";
- $sql.= " t.datec,";
- $sql.= " t.tms,";
- $sql.= " t.import_key";
+ $sql .= " t.fk_product,";
+ $sql .= " t.file_name,";
+ $sql .= " t.lang,";
+ $sql .= " t.fk_user_author,";
+ $sql .= " t.fk_user_mod,";
+ $sql .= " t.datec,";
+ $sql .= " t.tms,";
+ $sql .= " t.import_key";
- $sql.= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t";
- $sql.= " WHERE t.rowid = ".$id;
+ $sql .= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t";
+ $sql .= " WHERE t.rowid = ".$id;
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
+ $this->id = $obj->rowid;
$this->fk_product = $obj->fk_product;
$this->file_name = $obj->file_name;
@@ -214,7 +214,7 @@ class Propalmergepdfproduct extends CommonObject
}
else
{
- $this->error="Error ".$this->db->lasterror();
+ $this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
@@ -231,37 +231,37 @@ class Propalmergepdfproduct extends CommonObject
public function fetch_by_product($product_id, $lang = '')
{
// phpcs:enable
- global $langs,$conf;
+ global $langs, $conf;
$sql = "SELECT";
- $sql.= " t.rowid,";
+ $sql .= " t.rowid,";
- $sql.= " t.fk_product,";
- $sql.= " t.file_name,";
- $sql.= " t.lang,";
- $sql.= " t.fk_user_author,";
- $sql.= " t.fk_user_mod,";
- $sql.= " t.datec,";
- $sql.= " t.tms,";
- $sql.= " t.import_key";
+ $sql .= " t.fk_product,";
+ $sql .= " t.file_name,";
+ $sql .= " t.lang,";
+ $sql .= " t.fk_user_author,";
+ $sql .= " t.fk_user_mod,";
+ $sql .= " t.datec,";
+ $sql .= " t.tms,";
+ $sql .= " t.import_key";
- $sql.= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t";
- $sql.= " WHERE t.fk_product = ".$product_id;
+ $sql .= " FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product as t";
+ $sql .= " WHERE t.fk_product = ".$product_id;
if ($conf->global->MAIN_MULTILANGS && !empty($lang)) {
- $sql.= " AND t.lang = '".$lang."'";
+ $sql .= " AND t.lang = '".$lang."'";
}
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
- while($obj = $this->db->fetch_object($resql)) {
+ while ($obj = $this->db->fetch_object($resql)) {
$line = new PropalmergepdfproductLine();
- $line->id = $obj->rowid;
+ $line->id = $obj->rowid;
$line->fk_product = $obj->fk_product;
$line->file_name = $obj->file_name;
@@ -276,9 +276,9 @@ class Propalmergepdfproduct extends CommonObject
if ($conf->global->MAIN_MULTILANGS) {
- $this->lines[$obj->file_name.'_'.$obj->lang]=$line;
- }else {
- $this->lines[$obj->file_name]=$line;
+ $this->lines[$obj->file_name.'_'.$obj->lang] = $line;
+ } else {
+ $this->lines[$obj->file_name] = $line;
}
}
}
@@ -288,7 +288,7 @@ class Propalmergepdfproduct extends CommonObject
}
else
{
- $this->error="Error ".$this->db->lasterror();
+ $this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch_by_product ".$this->error, LOG_ERR);
return -1;
}
@@ -305,14 +305,14 @@ class Propalmergepdfproduct extends CommonObject
public function update($user = 0, $notrigger = 0)
{
global $conf, $langs;
- $error=0;
+ $error = 0;
// Clean parameters
- if (isset($this->fk_product)) $this->fk_product=trim($this->fk_product);
- if (isset($this->file_name)) $this->file_name=trim($this->file_name);
- if (isset($this->fk_user_mod)) $this->fk_user_mod=trim($this->fk_user_mod);
- if (isset($this->lang)) $this->lang=trim($this->lang);
+ if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
+ if (isset($this->file_name)) $this->file_name = trim($this->file_name);
+ if (isset($this->fk_user_mod)) $this->fk_user_mod = trim($this->fk_user_mod);
+ if (isset($this->lang)) $this->lang = trim($this->lang);
// Check parameters
// Put here code to add a control on parameters values
@@ -320,21 +320,21 @@ class Propalmergepdfproduct extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."propal_merge_pdf_product SET";
- $sql.= " fk_product=".(isset($this->fk_product)?$this->fk_product:"null").",";
- $sql.= " file_name=".(isset($this->file_name)?"'".$this->db->escape($this->file_name)."'":"null").",";
+ $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").",";
+ $sql .= " file_name=".(isset($this->file_name) ? "'".$this->db->escape($this->file_name)."'" : "null").",";
if ($conf->global->MAIN_MULTILANGS) {
- $sql.= " lang=".(isset($this->lang)?"'".$this->db->escape($this->lang)."'":"null").",";
+ $sql .= " lang=".(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").",";
}
- $sql.= " fk_user_mod=".$user->id;
+ $sql .= " fk_user_mod=".$user->id;
- $sql.= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
//if (! $error)
//{
@@ -355,13 +355,13 @@ class Propalmergepdfproduct extends CommonObject
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -381,13 +381,13 @@ class Propalmergepdfproduct extends CommonObject
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
- $error=0;
+ $error = 0;
$this->db->begin();
- if (! $error)
+ if (!$error)
{
- if (! $notrigger)
+ if (!$notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@@ -401,26 +401,26 @@ class Propalmergepdfproduct extends CommonObject
}
}
- if (! $error)
+ if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
- $sql.= " WHERE rowid=".$this->id;
+ $sql .= " WHERE rowid=".$this->id;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
}
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -443,7 +443,7 @@ class Propalmergepdfproduct extends CommonObject
{
// phpcs:enable
global $conf, $langs;
- $error=0;
+ $error = 0;
$this->db->begin();
@@ -463,30 +463,30 @@ class Propalmergepdfproduct extends CommonObject
// }
//}
- if (! $error)
+ if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
- $sql.= " WHERE fk_product=".$product_id;
+ $sql .= " WHERE fk_product=".$product_id;
if ($conf->global->MAIN_MULTILANGS && !empty($lang_id)) {
- $sql.= " AND lang='".$lang_id."'";
+ $sql .= " AND lang='".$lang_id."'";
}
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
}
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -506,7 +506,7 @@ class Propalmergepdfproduct extends CommonObject
{
// phpcs:enable
global $conf, $langs;
- $error=0;
+ $error = 0;
$this->db->begin();
@@ -526,26 +526,26 @@ class Propalmergepdfproduct extends CommonObject
// }
//}
- if (! $error)
+ if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product";
- $sql.= " WHERE fk_product=".$this->fk_product." AND file_name='".$this->db->escape($this->file_name)."'";
+ $sql .= " WHERE fk_product=".$this->fk_product." AND file_name='".$this->db->escape($this->file_name)."'";
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+ if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
}
// Commit or rollback
if ($error)
{
- foreach($this->errors as $errmsg)
+ foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
- $this->error.=($this->error?', '.$errmsg:$errmsg);
+ $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
else
{
@@ -565,40 +565,40 @@ class Propalmergepdfproduct extends CommonObject
*/
public function createFromClone(User $user, $fromid)
{
- $error=0;
+ $error = 0;
- $object=new Propalmergepdfproduct($this->db);
+ $object = new Propalmergepdfproduct($this->db);
$this->db->begin();
// Load source object
$object->fetch($fromid);
- $object->id=0;
- $object->statut=0;
+ $object->id = 0;
+ $object->statut = 0;
// Clear fields
// ...
// Create clone
- $object->context['createfromclone']='createfromclone';
- $result=$object->create($user);
+ $object->context['createfromclone'] = 'createfromclone';
+ $result = $object->create($user);
// Other options
if ($result < 0)
{
- $this->error=$object->error;
- $this->errors=array_merge($this->errors, $object->errors);
+ $this->error = $object->error;
+ $this->errors = array_merge($this->errors, $object->errors);
$error++;
}
- if (! $error)
+ if (!$error)
{
}
unset($object->context['createfromclone']);
// End
- if (! $error)
+ if (!$error)
{
$this->db->commit();
return $object->id;
@@ -619,15 +619,15 @@ class Propalmergepdfproduct extends CommonObject
*/
public function initAsSpecimen()
{
- $this->id=0;
+ $this->id = 0;
- $this->fk_product='';
- $this->file_name='';
- $this->fk_user_author='';
- $this->fk_user_mod='';
- $this->datec='';
- $this->tms='';
- $this->import_key='';
+ $this->fk_product = '';
+ $this->file_name = '';
+ $this->fk_user_author = '';
+ $this->fk_user_mod = '';
+ $this->datec = '';
+ $this->tms = '';
+ $this->import_key = '';
}
}
@@ -659,8 +659,8 @@ class PropalmergepdfproductLine
*/
public $fk_user_mod;
- public $datec='';
- public $tms='';
+ public $datec = '';
+ public $tms = '';
public $import_key;
/**
diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php
index ae7a519e004..4b0c61073cf 100644
--- a/htdocs/product/dynamic_price/class/price_parser.class.php
+++ b/htdocs/product/dynamic_price/class/price_parser.class.php
@@ -273,11 +273,14 @@ class PriceParser
//Get the supplier min price
$productFournisseur = new ProductFournisseur($this->db);
$res = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0);
- if ($res < 1) {
+ if ($res < 0) {
$this->error_parser = array(25, null);
return -1;
+ } elseif($res == 0){
+ $supplier_min_price = 0;
+ } else {
+ $supplier_min_price = $productFournisseur->fourn_unitprice;
}
- $supplier_min_price = $productFournisseur->fourn_unitprice;
//Accessible values by expressions
$extra_values = array_merge($extra_values, array(
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 64871b12d17..aab0d428191 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -376,8 +376,8 @@ class MouvementStock extends CommonObject
if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after
{
$fk_project = 0;
- if (!empty($this->origin)) { // This is set by caller for tracking reason
- $origintype = $this->origin->element;
+ if(!empty($this->origin)) { // This is set by caller for tracking reason
+ $origintype = empty($this->origin->origin_type)?$this->origin->element:$this->origin->origin_type;
$fk_origin = $this->origin->id;
if ($origintype == 'project') $fk_project = $fk_origin;
else
@@ -981,10 +981,14 @@ class MouvementStock extends CommonObject
default:
if ($origintype)
{
- $result = dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php');
+ // Separate originetype with "@" : left part is class name, right part is module name
+ $origintype_array = explode('@', $origintype);
+ $classname = ucfirst($origintype_array[0]);
+ $modulename = empty($origintype_array[1]) ? $classname : empty($origintype_array[1]);
+ $result=dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php');
if ($result)
{
- $classname = ucfirst($origintype);
+ $classname = ucfirst($classname);
$origin = new $classname($this->db);
}
}
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 91b346f2066..7baefc6964e 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -1048,6 +1048,11 @@ elseif ($object->id > 0)
}*/
if (strcmp($object->opp_amount, '')) print price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
print ' |
';
+
+ // Opportunity Weighted Amount
+ print '