| '.$langs->trans('Discount').' | ';
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
@@ -225,7 +225,7 @@ if ($id > 0 || ! empty($ref))
print '';
dol_fiche_end();
-
+
print ' ';
// Contacts lines
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index 132ab187777..351bdc74a46 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -107,7 +107,7 @@ if ($object->id)
// Contract card
- $linkback = ''.$langs->trans("BackToList").'';
+ $linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='';
@@ -170,7 +170,7 @@ if ($object->id)
print '';
print ' ';
-
+
print ' ';
print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' | ';
print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' | ';
@@ -179,7 +179,7 @@ if ($object->id)
print '';
dol_fiche_end();
-
+
$modulepart = 'contract';
$permission = $user->rights->contrat->creer;
$permtoedit = $user->rights->contrat->creer;
diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php
index 95ab0b9ca25..7f5d0c103fa 100644
--- a/htdocs/contrat/info.php
+++ b/htdocs/contrat/info.php
@@ -62,7 +62,7 @@ dol_fiche_head($head, 'info', $langs->trans("Contract"), -1, 'contract');
// Contract card
-$linkback = ''.$langs->trans("BackToList").'';
+$linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='';
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 64f2b6b94f2..36b59309298 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -323,16 +323,17 @@ if ($resql)
}
$param='';
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
- if ($sall != '') $param.='&sall='.$sall;
- if ($search_contract != '') $param.='&search_contract='.$search_contract;
- if ($search_name != '') $param.='&search_name='.$search_name;
- if ($search_email != '') $param.='&search_email='.$search_email;
- if ($search_ref_supplier != '') $param.='&search_ref_supplier='.$search_ref_supplier;
- if ($search_sale != '') $param.='&search_sale=' .$search_sale;
- if ($show_files) $param.='&show_files=' .$show_files;
- if ($optioncss != '') $param.='&optioncss='.$optioncss;
+ if ($sall != '') $param.='&sall='.urlencode($sall);
+ if ($search_contract != '') $param.='&search_contract='.urlencode($search_contract);
+ if ($search_name != '') $param.='&search_name='.urlencode($search_name);
+ if ($search_email != '') $param.='&search_email='.urlencode($search_email);
+ if ($search_ref_customer != '') $param.='&search_ref_customer='.urlencode($search_ref_customer);
+ if ($search_ref_supplier != '') $param.='&search_ref_supplier='.urlencode($search_ref_supplier);
+ if ($search_sale != '') $param.='&search_sale=' .urlencode($search_sale);
+ if ($show_files) $param.='&show_files=' .urlencode($show_files);
+ if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
@@ -600,6 +601,11 @@ if ($resql)
$contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier;
+ if ($obj->socid > 0)
+ {
+ $result=$socstatic->fetch($obj->socid);
+ }
+
print '';
if (! empty($arrayfields['c.ref']['checked']))
{
@@ -631,7 +637,13 @@ if ($resql)
}
if (! empty($arrayfields['s.nom']['checked']))
{
- print '| '.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.' | ';
+ print '';
+ //print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'';
+ if ($obj->socid > 0)
+ {
+ print $socstatic->getNomUrl(1, '');
+ }
+ print ' | ';
}
if (! empty($arrayfields['s.email']['checked']))
{
@@ -683,7 +695,6 @@ if ($resql)
print '';
if ($obj->socid > 0)
{
- $result=$socstatic->fetch($obj->socid);
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative=count($listsalesrepresentatives);
diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php
index 7d4927d19b8..ff0df34de67 100644
--- a/htdocs/contrat/note.php
+++ b/htdocs/contrat/note.php
@@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref))
// Contract card
- $linkback = ''.$langs->trans("BackToList").'';
+ $linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='';
@@ -139,7 +139,7 @@ if ($id > 0 || ! empty($ref))
print '';
-
+
// Ligne info remises tiers
print '| '.$langs->trans('Discount').' | ';
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
@@ -161,9 +161,9 @@ if ($id > 0 || ! empty($ref))
print ' | ';
print " ";
-
+
print '';
-
+
//print ' ';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index 6bbde52cb58..dce39a950aa 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -450,8 +450,9 @@ abstract class CommonInvoice extends CommonObject
$sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage';
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
- if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement;
- else $sqltemp.= " WHERE c.code='".$this->db->escape($cond_reglement)."'";
+ $sqltemp.= " WHERE c.entity = " . getEntity('c_payment_term');
+ if (is_numeric($cond_reglement)) $sqltemp.= " AND c.rowid=".$cond_reglement;
+ else $sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'";
dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG);
$resqltemp=$this->db->query($sqltemp);
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index f33ab83ee29..0151833f13b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2737,7 +2737,8 @@ class Form
$sql = "SELECT rowid, code, libelle as label";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
- $sql.= " WHERE active > 0";
+ $sql.= " WHERE entity = " . getEntity('c_payment_term');
+ $sql.= " AND active > 0";
$sql.= " ORDER BY sortorder";
$resql = $this->db->query($sql);
@@ -2951,7 +2952,8 @@ class Form
$sql = "SELECT id, code, libelle as label, type, active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
- //if ($active >= 0) $sql.= " WHERE active = ".$active;
+ $sql.= " WHERE entity = " . getEntity('c_paiement');
+ //if ($active >= 0) $sql.= " AND active = ".$active;
$resql = $this->db->query($sql);
if ($resql)
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index 169aec16307..66bde287ad1 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -151,7 +151,7 @@ class Translate
$this->load($domain);
}
}
-
+
/**
* Load translation key-value for a particular file, into a memory array.
* If data for file already loaded, do nothing.
@@ -177,7 +177,7 @@ class Translate
global $conf,$db;
//dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
-
+
// Check parameters
if (empty($domain))
{
@@ -185,8 +185,8 @@ class Translate
return -1;
}
if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys
-
-
+
+
// Load $this->tab_translate[] from database
if (empty($loadfromfileonly) && count($this->tab_translate) == 0) $this->loadFromDatabase($db); // Nothing was loaded yet, so we load database.
@@ -278,14 +278,14 @@ class Translate
* and split the rest until a line feed.
* This is more efficient than fgets + explode + trim by a factor of ~2.
*/
- while ($line = fscanf($fp, "%[^= ]%*[ =]%[^\n]"))
+ while ($line = fscanf($fp, "%[^= ]%*[ =]%[^\n]"))
{
- if (isset($line[1]))
+ if (isset($line[1]))
{
list($key, $value) = $line;
//if ($domain == 'orders') print "Domain=$domain, found a string for $tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]." ";
//if ($key == 'Order') print "Domain=$domain, found a string for key=$key=$tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]." ";
- if (empty($this->tab_translate[$key]))
+ if (empty($this->tab_translate[$key]))
{ // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries)
$value = preg_replace('/\\n/', "\n", $value); // Parse and render carriage returns
if ($key == 'DIRECTION') { // This is to declare direction of language
@@ -375,8 +375,8 @@ class Translate
if (! empty($tmparray2[1])) $this->tab_translate[$tmparray2[0]]=$tmparray2[1];
}
}
- }
-
+ }
+
// Check to be sure that SeparatorDecimal differs from SeparatorThousand
if (! empty($this->tab_translate["SeparatorDecimal"]) && ! empty($this->tab_translate["SeparatorThousand"])
&& $this->tab_translate["SeparatorDecimal"] == $this->tab_translate["SeparatorThousand"]) $this->tab_translate["SeparatorThousand"]='';
@@ -401,7 +401,7 @@ class Translate
global $conf;
$domain='database';
-
+
// Check parameters
if (empty($db)) return 0; // Database handler can't be used
@@ -418,7 +418,7 @@ class Translate
}
$this->_tab_loaded[$newdomain] = 1; // We want to be sure this function is called once only.
-
+
$fileread=0;
$langofdir=(empty($forcelangdir)?$this->defaultlang:$forcelangdir);
@@ -467,24 +467,24 @@ class Translate
if (! $found && ! empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
{
// Overwrite translation with database read
- $sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
+ $sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
$resql=$db->query($sql);
-
+
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
if ($usecachekey) $tabtranslatedomain=array(); // To save lang content in cache
-
+
$i = 0;
while ($i < $num) // Ex: Need 225ms for all fgets on all lang file for Third party page. Same speed than file_get_contents
{
$obj=$db->fetch_object($resql);
-
+
$key=$obj->transkey;
$value=$obj->transvalue;
-
+
//print "Domain=$domain, found a string for $tab[0] with value $tab[1] ";
if (empty($this->tab_translate[$key])) // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries)
{
@@ -493,12 +493,12 @@ class Translate
$this->tab_translate[$key]=$value;
if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache
}
-
+
$i++;
}
-
+
$fileread=1;
-
+
// TODO Move cache write out of loop on dirs
// To save lang content for usecachekey into cache
if ($usecachekey && count($tabtranslatedomain))
@@ -524,9 +524,9 @@ class Translate
return 1;
}
-
-
-
+
+
+
/**
* Return translated value of key for special keys ("Currency...", "Civility...", ...).
* Search in lang file, then into database. Key must be any complete entry into lang file: CurrencyEUR, ...
@@ -559,7 +559,7 @@ class Translate
}
elseif (preg_match('/^PaymentTypeShort([0-9A-Z]+)$/i',$key,$reg))
{
- $newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle');
+ $newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle','',getEntity('c_paiement'));
}
elseif (preg_match('/^OppStatusShort([0-9A-Z]+)$/i',$key,$reg))
{
@@ -611,8 +611,8 @@ class Translate
$str=preg_replace('/'.preg_quote($tmparray2[0]).'/',$tmparray2[1],$str);
}
}
-
- if (! preg_match('/^Format/',$key))
+
+ if (! preg_match('/^Format/',$key))
{
//print $str;
$str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
@@ -690,9 +690,9 @@ class Translate
$tmparray2=explode(':',$tmp);
$str=preg_replace('/'.preg_quote($tmparray2[0]).'/',$tmparray2[1],$str);
}
- }
+ }
- if (! preg_match('/^Format/',$key))
+ if (! preg_match('/^Format/',$key))
{
//print $str;
$str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
@@ -867,10 +867,11 @@ class Translate
* @param string $fieldkey Field for key
* @param string $fieldlabel Field for label
* @param string $keyforselect Use another value than the translation key for the where into select
+ * @param int $entity Field for filter by entity
* @return string Label in UTF8 (but without entities)
* @see dol_getIdFromCode
*/
- function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel,$keyforselect='')
+ function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel,$keyforselect='',$entity=null)
{
// If key empty
if ($key == '') return '';
@@ -893,6 +894,8 @@ class Translate
$sql = "SELECT ".$fieldlabel." as label";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".($keyforselect?$keyforselect:$key)."'";
+ if (! is_null($entity))
+ $sql.= " AND entity = " . (int) $entity;
dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
@@ -930,7 +933,7 @@ class Translate
}
/**
- * Return a currency code into its symbol.
+ * Return a currency code into its symbol.
* If mb_convert_encoding is not available, return currency code.
*
* @param string $currency_code Currency code
diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php
index c88a0b7afed..28f97bd1805 100644
--- a/htdocs/core/lib/bank.lib.php
+++ b/htdocs/core/lib/bank.lib.php
@@ -42,7 +42,7 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'bankname';
$h++;
- $head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries.php?id=" . $object->id;
+ $head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries_list.php?id=" . $object->id;
$head[$h][1] = $langs->trans("BankTransactions");
$head[$h][2] = 'journal';
$h++;
@@ -95,7 +95,7 @@ function bank_prepare_head(Account $object)
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;*/
-
+
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank', 'remove');
return $head;
@@ -146,9 +146,9 @@ function bank_admin_prepare_head($object)
* @return array Array of tabs to shoc
*/
function various_payment_prepare_head($object) {
-
+
global $db, $langs, $conf;
-
+
$h = 0;
$head = array();
@@ -178,7 +178,7 @@ function various_payment_prepare_head($object) {
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
-
+
complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment', 'remove');
return $head;
@@ -247,7 +247,7 @@ function checkBanForAccount($account)
$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789");
// Separation du rib en 3 groupes de 7 + 1 groupe de 2.
// Multiplication de chaque groupe par les coef du tableau
-
+
for ($i = 0, $s = 0; $i < 3; $i++) {
$code = substr($rib, 7 * $i, 7);
$s += (0 + (int) $code) * $coef[$i];
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 5b0b49878ae..d6d979b687d 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -102,18 +102,20 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
/**
* Get list of entity id to use.
*
- * @param string $element Current element
- * 'societe', 'socpeople', 'actioncomm', 'agenda', 'resource',
- * 'product', 'productprice', 'stock',
- * 'propal', 'supplier_proposal', 'facture', 'facture_fourn',
- * 'categorie', 'bank_account', 'bank_account', 'adherent', 'user',
- * 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
- * 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
- * 'email_template', 'event',
- * @param int $shared 1=Return id of current entity + shared entities (default), 0=Return id of current entity only
+ * @param string $element Current element
+ * 'societe', 'socpeople', 'actioncomm', 'agenda', 'resource',
+ * 'product', 'productprice', 'stock',
+ * 'propal', 'supplier_proposal', 'facture', 'facture_fourn',
+ * 'categorie', 'bank_account', 'bank_account', 'adherent', 'user',
+ * 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
+ * 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
+ * 'email_template', 'event',
+ * @param int $shared 0=Return id of current entity only,
+ * 1=Return id of current entity + shared entities (default)
+ * @param int $forceentity Entity id
* @return mixed Entity id(s) to use
*/
-function getEntity($element, $shared=1)
+function getEntity($element, $shared=1, $forceentity=null)
{
global $conf, $mc;
@@ -124,7 +126,7 @@ function getEntity($element, $shared=1)
if (is_object($mc))
{
- return $mc->getEntity($element, $shared);
+ return $mc->getEntity($element, $shared, $forceentity);
}
else
{
@@ -5952,15 +5954,16 @@ function dol_osencode($str)
* Return an id or code from a code or id.
* Store also Code-Id into a cache to speed up next request on same key.
*
- * @param DoliDB $db Database handler
- * @param string $key Code or Id to get Id or Code
- * @param string $tablename Table name without prefix
- * @param string $fieldkey Field for search ('code' or 'id')
- * @param string $fieldid Field to get ('id' or 'code')
- * @return int <0 if KO, Id of code if OK
+ * @param DoliDB $db Database handler
+ * @param string $key Code or Id to get Id or Code
+ * @param string $tablename Table name without prefix
+ * @param string $fieldkey Field for code
+ * @param string $fieldid Field for id
+ * @param int $entityfilter Filter by entity
+ * @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey
*/
-function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
+function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id',$entityfilter=0)
{
global $cache_codes;
@@ -5976,6 +5979,8 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
$sql = "SELECT ".$fieldid." as valuetoget";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$db->escape($key)."'";
+ if (! empty($entityfilter))
+ $sql.= " AND entity IN (" . getEntity($tablename) . ")";
dol_syslog('dol_getIdFromCode', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index c02fbbbb220..8635c9f3a1b 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -308,6 +308,10 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
{
if (! $user->rights->ftp->write) $deleteok=0;
}
+ else if ($feature == 'salaries')
+ {
+ if (! $user->rights->salaries->delete) $deleteok=0;
+ }
else if (! empty($feature2)) // This should be used for future changes
{
foreach($feature2 as $subfeature)
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 6a02f67c6d4..33039b390fd 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -14,7 +14,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__);
-insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
+insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
@@ -224,7 +224,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 52, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 53, __ENTITY__);
@@ -283,10 +283,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__);
-- Bank
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/list.php?leftmenu=bank&mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries_list.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
-- Bank - Categories
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 9119afc7696..ebd64b36a3c 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -339,7 +339,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$numr = $db->num_rows($resql);
$i = 0;
- if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
+ if ($numr > 0) $newmenu->add('/compta/bank/list.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr)
{
@@ -347,7 +347,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{
- $newmenu->add('/compta/bank/bankentries.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
+ $newmenu->add('/compta/bank/bankentries_list.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}
$i++;
}
diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php
index bd762083d2f..55941fe7c10 100644
--- a/htdocs/core/menus/standard/auguria_menu.php
+++ b/htdocs/core/menus/standard/auguria_menu.php
@@ -163,13 +163,13 @@ class MenuManager
$canonurl=preg_replace('/\?.*$/','',$val['url']);
print '';
-
+
// Add font-awesome
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '';
-
+
print $val['titre'];
print ''."\n";
-
+
// Search submenu fot this mainmenu entry
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
@@ -183,7 +183,7 @@ class MenuManager
//var_dump($canonnexturl);
print ''."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
- || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false))
+ || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{
// We add sub entry
print str_pad('',1).'- '; // ui-btn to highlight on clic
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 013b6ea74ae..f79ac461828 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -201,7 +201,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"';
$idsel='bank';
- $menu->add('/compta/bank/index.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname);
+ $menu->add('/compta/bank/list.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname);
}
// Projects
@@ -977,7 +977,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
if (! empty($conf->banque->enabled))
{
- if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 51);
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 51);
}
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
{
@@ -1146,11 +1146,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Bank-Caisse
if (! empty($conf->banque->enabled))
{
- $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank');
+ $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank');
$newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
- $newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank');
- $newmenu->add("/compta/bank/bankentries.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
+ $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank');
+ $newmenu->add("/compta/bank/bankentries_list.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/transfer.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer);
@@ -1498,7 +1498,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$numr = $db->num_rows($resql);
$i = 0;
- if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
+ if ($numr > 0) $newmenu->add('/compta/bank/list.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr)
{
@@ -1506,7 +1506,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{
- $newmenu->add('/compta/bank/bankentries.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
+ $newmenu->add('/compta/bank/bankentries_list.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}
$i++;
}
diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php
index d8f90cb912f..51442d54e51 100644
--- a/htdocs/core/menus/standard/eldy_menu.php
+++ b/htdocs/core/menus/standard/eldy_menu.php
@@ -177,7 +177,7 @@ class MenuManager
print $val['titre'];
print ''."\n";
-
+
// Search submenu fot this mainmenu entry
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
@@ -193,7 +193,7 @@ class MenuManager
//var_dump($canonnexturl);
print '
'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
- || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false))
+ || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{
// We add sub entry
print str_pad('',1).'- '; // ui-btn to highlight on clic
diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php
index dafc0486145..9de1ee345c2 100644
--- a/htdocs/core/menus/standard/empty.php
+++ b/htdocs/core/menus/standard/empty.php
@@ -199,7 +199,7 @@ class MenuManager
//var_dump($canonnexturl);
print '
'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
- || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false))
+ || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{
// We add sub entry
print str_pad('',1).'- '; // ui-btn to highlight on clic
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index bdf8effe23c..b11389905a4 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -406,7 +406,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
if (! $err) $err+=$this->insert_module_parts();
// Insert constant defined by modules (into llx_const)
- if (! $err) $err+=$this->insert_const();
+ if (! $err && ! preg_match('/newboxdefonly/',$options)) $err+=$this->insert_const(); // Test on newboxdefonly to avoid to erase value during upgrade
// Insert boxes def into llx_boxes_def and boxes setup (into llx_boxes)
if (! $err && ! preg_match('/noboxes/',$options)) $err+=$this->insert_boxes($options);
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index ef4dd5ff6fc..3617a130c68 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -820,7 +820,7 @@ class pdf_crabe extends ModelePDFFactures
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity = " . getEntity('c_paiement');
$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id;
//$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = 1";
$sql.= " ORDER BY p.datep";
diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php
index 6e5206ac7a5..6e3c1660fb2 100644
--- a/htdocs/core/modules/modFacture.class.php
+++ b/htdocs/core/modules/modFacture.class.php
@@ -249,23 +249,23 @@ class modFacture extends DolibarrModules
$this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
- $this->export_sql_start[$r] = 'SELECT DISTINCT ';
- $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
- if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
- $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'facture as f';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON b.rowid = p.fk_bank';
- $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account';
- $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid';
- $this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('facture').')';
- if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
+ $this->export_sql_start[$r]='SELECT DISTINCT ';
+ $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
+ if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
+ $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement AND pt.entity = ' . getEntity('c_paiement');
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON b.rowid = p.fk_bank';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account';
+ $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
+ $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture').')';
+ if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id;
$r++;
}
diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php
index 6af1e138b90..6b84e549d10 100644
--- a/htdocs/core/modules/modSalaries.class.php
+++ b/htdocs/core/modules/modSalaries.class.php
@@ -165,7 +165,7 @@ class modSalaries extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id AND cp.entity = ' . getEntity('c_paiement');
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user').')';
}
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 0861dea4a1d..c01bdca6985 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -284,8 +284,8 @@ class modSociete extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id';
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid AND payterm.entity = ' . getEntity('c_payment_term');
+ $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id AND paymode.entity = ' . getEntity('c_paiement');
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe').')';
if (is_object($user) && empty($user->rights->societe->client->voir)) {
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php
index 54f0e418eb0..336928ce408 100644
--- a/htdocs/core/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement.class.php
@@ -178,69 +178,71 @@ class pdf_paiement
// number of bill
switch ($this->doc_type) {
- case "client":
- $sql = "SELECT p.datep as dp, f.facnumber";
- //$sql .= ", c.libelle as paiement_type, p.num_paiement";
- $sql.= ", c.code as paiement_code, p.num_paiement";
- $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
- $sql.= ", pf.amount as pf_amount";
- if (! empty($conf->banque->enabled))
- $sql.= ", ba.ref as bankaccount";
- $sql.= ", p.rowid as prowid";
- $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,";
- $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,";
- if (! empty($conf->banque->enabled))
- $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
- $sql.= " ".MAIN_DB_PREFIX."societe as s";
- if (! $user->rights->societe->client->voir && ! $socid)
- {
- $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- }
- $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
- if (! empty($conf->banque->enabled))
- $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
- $sql.= " AND f.entity = ".$conf->entity;
- $sql.= " AND p.fk_paiement = c.id ";
- $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
- if (! $user->rights->societe->client->voir && ! $socid)
- {
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- }
- if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
- $sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
- break;
- case "fourn":
- $sql = "SELECT p.datep as dp, f.ref as facnumber";
- //$sql .= ", c.libelle as paiement_type, p.num_paiement";
- $sql.= ", c.code as paiement_code, p.num_paiement";
- $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
- $sql.= ", pf.amount as pf_amount";
- if (! empty($conf->banque->enabled))
- $sql.= ", ba.ref as bankaccount";
- $sql.= ", p.rowid as prowid";
- $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p, ".MAIN_DB_PREFIX."facture_fourn as f,";
- $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,";
- if (! empty($conf->banque->enabled))
- $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
- $sql.= " ".MAIN_DB_PREFIX."societe as s";
- if (! $user->rights->societe->client->voir && ! $socid)
- {
- $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- }
- $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facturefourn = f.rowid AND pf.fk_paiementfourn = p.rowid";
- if (! empty($conf->banque->enabled))
- $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
- $sql.= " AND f.entity = ".$conf->entity;
- $sql.= " AND p.fk_paiement = c.id ";
- $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
- if (! $user->rights->societe->client->voir && ! $socid)
- {
- $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- }
- if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
- $sql.= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC";
- break;
- }
+ case "client":
+ $sql = "SELECT p.datep as dp, f.facnumber";
+ //$sql .= ", c.libelle as paiement_type, p.num_paiement";
+ $sql.= ", c.code as paiement_code, p.num_paiement";
+ $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
+ $sql.= ", pf.amount as pf_amount";
+ if (! empty($conf->banque->enabled))
+ $sql.= ", ba.ref as bankaccount";
+ $sql.= ", p.rowid as prowid";
+ $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,";
+ $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,";
+ if (! empty($conf->banque->enabled))
+ $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
+ $sql.= " ".MAIN_DB_PREFIX."societe as s";
+ if (! $user->rights->societe->client->voir && ! $socid)
+ {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
+ $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
+ if (! empty($conf->banque->enabled))
+ $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
+ $sql.= " AND f.entity = ".$conf->entity;
+ $sql.= " AND p.fk_paiement = c.id ";
+ $sql.= " AND c.entity = " . getEntity('c_paiement');
+ $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
+ if (! $user->rights->societe->client->voir && ! $socid)
+ {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ }
+ if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
+ $sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
+ break;
+ case "fourn":
+ $sql = "SELECT p.datep as dp, f.ref as facnumber";
+ //$sql .= ", c.libelle as paiement_type, p.num_paiement";
+ $sql.= ", c.code as paiement_code, p.num_paiement";
+ $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
+ $sql.= ", pf.amount as pf_amount";
+ if (! empty($conf->banque->enabled))
+ $sql.= ", ba.ref as bankaccount";
+ $sql.= ", p.rowid as prowid";
+ $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p, ".MAIN_DB_PREFIX."facture_fourn as f,";
+ $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,";
+ if (! empty($conf->banque->enabled))
+ $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
+ $sql.= " ".MAIN_DB_PREFIX."societe as s";
+ if (! $user->rights->societe->client->voir && ! $socid)
+ {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
+ $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facturefourn = f.rowid AND pf.fk_paiementfourn = p.rowid";
+ if (! empty($conf->banque->enabled))
+ $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
+ $sql.= " AND f.entity = ".$conf->entity;
+ $sql.= " AND p.fk_paiement = c.id ";
+ $sql.= " AND c.entity = " . getEntity('c_paiement');
+ $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
+ if (! $user->rights->societe->client->voir && ! $socid)
+ {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ }
+ if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
+ $sql.= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC";
+ break;
+ }
dol_syslog(get_class($this)."::write_file", LOG_DEBUG);
$result = $this->db->query($sql);
diff --git a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php
index c7cb11ad31f..0b823e0419e 100644
--- a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php
@@ -39,8 +39,5 @@ class pdf_paiement_fourn extends pdf_paiement
{
parent::__construct($db);
$this->doc_type = "fourn";
- }
-
}
-
-
+}
diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
index b03f6348ebb..53d47ebc608 100644
--- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -933,7 +933,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql.= " cp.code";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity = " . getEntity('c_paiement');
$sql.= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id;
$sql.= " ORDER BY p.datep";
$resql=$this->db->query($sql);
diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index 02498009cd9..6998b7bdb52 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -638,6 +638,7 @@ if (! empty($id) && $action != 'edit')
$sql.= " AND p.fk_donation = d.rowid";
$sql.= " AND d.entity = ".$conf->entity;
$sql.= " AND p.fk_typepayment = c.id";
+ $sql.= " AND c.entity = " . getEntity('c_paiement');
$sql.= " ORDER BY dp";
//print $sql;
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index 695314bb526..0a683fea355 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -39,7 +39,7 @@ class Don extends CommonObject
public $fk_element = 'fk_donation';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $picto = 'generic';
-
+
var $date;
var $amount;
var $societe;
@@ -163,7 +163,7 @@ class Don extends CommonObject
global $conf, $user,$langs;
$now = dol_now();
-
+
// Charge tableau des id de societe socids
$socids = array();
@@ -611,7 +611,7 @@ class Don extends CommonObject
$sql.= " c.code as country_code, c.label as country";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment AND cp.entity = " . getEntity('c_paiement');
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid";
if (! empty($id))
{
diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php
index 9d478c4d7f5..22fbcd6dab4 100644
--- a/htdocs/don/class/paymentdonation.class.php
+++ b/htdocs/don/class/paymentdonation.class.php
@@ -32,7 +32,7 @@ class PaymentDonation extends CommonObject
public $element='payment_donation'; //!< Id that identify managed objects
public $table_element='payment_donation'; //!< Name of table without prefix where object is stored
public $picto = 'payment';
-
+
public $rowid;
public $fk_donation;
@@ -175,6 +175,7 @@ class PaymentDonation extends CommonObject
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."payment_donation as t)";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id";
+ $sql.= " AND pt.entity = " . getEntity('c_paiement');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
@@ -443,7 +444,7 @@ class PaymentDonation extends CommonObject
{
return '';
}
-
+
/**
* Renvoi le libelle d'un statut donne
*
@@ -454,11 +455,11 @@ class PaymentDonation extends CommonObject
function LibStatut($statut,$mode=0)
{
global $langs;
-
+
return '';
}
-
-
+
+
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index ef4bf2a9a70..1500affbcda 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1439,7 +1439,7 @@ else if ($id || $ref)
}
// Shipment card
- $linkback = ''.$langs->trans("BackToList").'';
+ $linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='
';
// Ref customer shipment
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1);
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 6c54c2e6615..014c9de3a19 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1486,14 +1486,15 @@ class Expedition extends CommonObject
/**
* Return clicable link of object (with eventually picto)
*
- * @param int $withpicto Add picto into link
- * @param int $option Where point the link
- * @param int $max Max length to show
- * @param int $short Use short labels
- * @param int $notooltip 1=No tooltip
- * @return string String with URL
+ * @param int $withpicto Add picto into link
+ * @param int $option Where point the link
+ * @param int $max Max length to show
+ * @param int $short Use short labels
+ * @param int $notooltip 1=No tooltip
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0)
+ function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
{
global $langs;
@@ -1506,6 +1507,14 @@ class Expedition extends CommonObject
if ($short) return $url;
+ if ($option !== 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ }
+
$linkclose='';
if (empty($notooltip))
{
diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php
index 7c721d7cf47..01807432343 100644
--- a/htdocs/expedition/contact.php
+++ b/htdocs/expedition/contact.php
@@ -91,7 +91,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
}
else
{
- if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
+ if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
$mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
@@ -160,8 +160,8 @@ if ($id > 0 || ! empty($ref))
// Shipment card
- $linkback = ' '.$langs->trans("BackToList").'';
-
+ $linkback = ' '.$langs->trans("BackToList").'';
+
$morehtmlref=' ';
// Ref customer shipment
$morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1);
@@ -203,11 +203,11 @@ if ($id > 0 || ! empty($ref))
}
}
$morehtmlref.=' ';
-
-
+
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
-
+
+
print ' ';
//print ' ';
print ' ';
@@ -237,23 +237,23 @@ if ($id > 0 || ! empty($ref))
print " | \n";
print ' ';
}
-
+
print " ";
-
+
//print ' ';
//print '';
//print ' ';
//print ' ';
-
-
+
+
//print ' ';
//print ' ';
print '';
-
+
print '';
-
-
+
+
dol_fiche_end();
// Lignes de contacts
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 7a0a7fabfc7..4cdff0bd38c 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -42,9 +42,10 @@ $result = restrictedArea($user, 'expedition',$expeditionid,'');
$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;
-$search_ref_exp = GETPOST("search_ref_exp");
-$search_ref_liv = GETPOST('search_ref_liv');
-$search_company = GETPOST("search_company");
+$search_ref_exp = GETPOST("search_ref_exp", 'alpha');
+$search_ref_liv = GETPOST('search_ref_liv', 'alpha');
+$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
+$search_company = GETPOST("search_company", 'alpha');
$search_town=GETPOST('search_town','alpha');
$search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state"));
@@ -133,6 +134,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
{
$search_ref_exp='';
$search_ref_liv='';
+ $search_ref_customer='';
$search_company='';
$search_town='';
$search_zip="";
@@ -213,6 +215,7 @@ if ($socid)
if ($viewstatut <> '' && $viewstatut >= 0) {
$sql.= " AND e.fk_statut = ".$viewstatut;
}
+if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer);
if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed;
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
@@ -262,13 +265,14 @@ if ($resql)
$expedition = new Expedition($db);
$param='';
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
- if ($sall) $param.= "&sall=".$sall;
- if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp;
- if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv;
- if ($search_company) $param.= "&search_company=".$search_company;
- if ($optioncss != '') $param.='&optioncss='.$optioncss;
+ if ($sall) $param.= "&sall=".urlencode($sall);
+ if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp);
+ if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv);
+ if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer);
+ if ($search_company) $param.= "&search_company=".urlencode($search_company);
+ if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php
index c32ec5c5124..cb123360288 100644
--- a/htdocs/expedition/note.php
+++ b/htdocs/expedition/note.php
@@ -100,9 +100,9 @@ if ($id > 0 || ! empty($ref))
$head=shipping_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Shipment"), -1, 'sending');
-
+
// Shipment card
- $linkback = ''.$langs->trans("BackToList").'';
+ $linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='';
// Ref customer shipment
@@ -145,13 +145,13 @@ if ($id > 0 || ! empty($ref))
}
}
$morehtmlref.=' ';
-
-
+
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
-
+
+
print '';
-
+
$cssclass='titlefield';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index 849053c610c..80274f9b579 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -85,14 +85,14 @@ if (empty($reshook))
$object->fetch($id);
$object->setProject(GETPOST('projectid','int'));
}
-
+
if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes')
{
$object = new Commande($db);
$object->fetch($id);
$result = $object->cloture($user);
}
-
+
// Positionne ref commande client
else if ($action == 'setref_client' && $user->rights->commande->creer) {
$result = $object->set_ref_client($user, GETPOST('ref_client'));
@@ -101,12 +101,12 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
}
-
+
if ($action == 'setdatedelivery' && $user->rights->commande->creer)
{
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int'));
-
+
$object = new Commande($db);
$object->fetch($id);
$result=$object->set_date_livraison($user,$datelivraison);
@@ -131,7 +131,7 @@ if (empty($reshook))
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
-
+
if ($action == 'setavailability' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
@@ -139,7 +139,7 @@ if (empty($reshook))
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
-
+
if ($action == 'setdemandreason' && $user->rights->commande->creer) {
$object = new Commande($db);
$object->fetch($id);
@@ -147,7 +147,7 @@ if (empty($reshook))
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
-
+
if ($action == 'setconditions' && $user->rights->commande->creer)
{
$object = new Commande($db);
@@ -156,7 +156,7 @@ if (empty($reshook))
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
-
+
// shipping method
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
$object = new Commande($db);
@@ -165,7 +165,7 @@ if (empty($reshook))
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
-
+
// warehouse
if ($action == 'setwarehouse' && $user->rights->commande->creer) {
$object = new Commande($db);
@@ -174,14 +174,14 @@ if (empty($reshook))
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
-
+
if ($action == 'update_extras')
{
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++;
-
+
if (! $error)
{
// Actions on extra fields (by external module or standard code)
@@ -197,20 +197,20 @@ if (empty($reshook))
} else if ($reshook < 0)
$error++;
}
-
+
if ($error)
$action = 'edit_extras';
}
-
+
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
{
$object->fetch($id);
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
-
+
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
exit();
}
-
+
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
}
@@ -243,13 +243,13 @@ if ($id > 0 || ! empty($ref))
$author->fetch($object->user_author_id);
$res = $object->fetch_optionals($object->id, $extralabels);
-
+
$head = commande_prepare_head($object);
dol_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), -1, 'order');
-
+
$formconfirm = '';
-
+
// Confirm validation
if ($action == 'cloture')
{
@@ -263,14 +263,14 @@ if ($id > 0 || ! empty($ref))
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
}
-
+
// Print form confirm
print $formconfirm;
-
-
+
+
// Order card
- $linkback = '' . $langs->trans("BackToList") . '';
+ $linkback = '' . $langs->trans("BackToList") . '';
$morehtmlref='';
@@ -320,7 +320,7 @@ if ($id > 0 || ! empty($ref))
print ' ';
print ' ';
print ' ';
-
+
print ' ';
// Discounts for third party
@@ -516,9 +516,9 @@ if ($id > 0 || ! empty($ref))
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
print '';
}
-
+
// TODO How record was recorded OrderMode (llx_c_input_method)
-
+
// Incoterms
if (!empty($conf->incoterm->enabled))
{
@@ -541,7 +541,7 @@ if ($id > 0 || ! empty($ref))
}
print '';
}
-
+
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@@ -561,18 +561,18 @@ if ($id > 0 || ! empty($ref))
print '| ' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' | ';
print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print ' ';
-
+
// Multicurrency Amount VAT
print '| ' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' | ';
print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print ' ';
-
+
// Multicurrency Amount TTC
print '| ' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' | ';
print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print ' ';
}
-
+
// Total HT
print '| '.$langs->trans('AmountHT').' | ';
print ''.price($object->total_ht, 0, '', 1, -1, -1, $conf->currency).' | ';
@@ -593,7 +593,7 @@ if ($id > 0 || ! empty($ref))
print ' | ' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ' | ';
print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
}
-
+
// Total TTC
print '| '.$langs->trans('AmountTTC').' | '.price($object->total_ttc, 0, '', 1, -1, -1, $conf->currency).' | ';
print ' ';
@@ -603,11 +603,11 @@ if ($id > 0 || ! empty($ref))
print '';
print '';
print '';
-
+
print ' ';
-
-
-
+
+
+
/**
* Lines or orders with quantity shipped and remain to ship
* Note: Qty shipped are already available into $object->expeditions[fk_product]
@@ -654,7 +654,7 @@ if ($id > 0 || ! empty($ref))
while ($i < $num)
{
$objp = $db->fetch_object($resql);
-
+
// Show product and description
$type=isset($objp->type)?$objp->type:$objp->product_type;
@@ -866,14 +866,14 @@ if ($id > 0 || ! empty($ref))
{
print $langs->trans("ValidateOrderFirstBeforeShipment");
}
-
+
if (! empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
{
if ($user->rights->expedition->creer)
{
//print load_fiche_titre($langs->trans("CreateShipment"));
print '';
-
+
print ' ";
print "\n";
-
+
print ' ';
$somethingshown=1;
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 1460d97323c..16dd8dbf8b1 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1454,7 +1454,7 @@ else
print ' ';
}
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
print ' ';
@@ -1614,7 +1614,7 @@ else
print $formconfirm;
// Expense report card
- $linkback = ''.$langs->trans("BackToList").'';
+ $linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='';
/*
@@ -1865,6 +1865,7 @@ else
$sql.= " AND p.fk_expensereport = e.rowid";
$sql.= ' AND e.entity IN ('.getEntity('expensereport').')';
$sql.= " AND p.fk_typepayment = c.id";
+ $sql.= " AND c.entity = " . getEntity('c_paiement');
$sql.= " ORDER BY dp";
$resql = $db->query($sql);
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index a53fbfe21b9..63e4a3d351b 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -447,7 +447,8 @@ class ExpenseReport extends CommonObject
$sql.= " d.fk_user_valid, d.fk_user_approve,";
$sql.= " d.fk_statut as status, d.fk_c_paiement,";
$sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
- $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id";
+ $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id AND dp.entity = " . getEntity('c_paiement');
if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'";
else $sql.= " WHERE d.rowid = ".$id;
//$sql.= $restrict;
@@ -828,7 +829,7 @@ class ExpenseReport extends CommonObject
print ' ';
print '| '.$objp->ref_num.' | ';
print ''.dol_print_date($objp->date,'day').' | ';
- print ''.$author->getNomUrl().' | ';
+ print ''.$author->getNomUrl(1).' | ';
print ''.$objp->comments.' | ';
print ''.price($objp->total_ht).' | ';
print ''.price($objp->total_ttc).' | ';
@@ -1525,14 +1526,15 @@ class ExpenseReport extends CommonObject
/**
* Return clicable name (with picto eventually)
*
- * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
- * @param int $max Max length of shown ref
- * @param int $short 1=Return just URL
- * @param string $moretitle Add more text to title tooltip
- * @param int $notooltip 1=Disable tooltip
- * @return string String with URL
+ * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
+ * @param int $max Max length of shown ref
+ * @param int $short 1=Return just URL
+ * @param string $moretitle Add more text to title tooltip
+ * @param int $notooltip 1=Disable tooltip
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- function getNomUrl($withpicto=0,$max=0,$short=0,$moretitle='',$notooltip=0)
+ function getNomUrl($withpicto=0, $max=0, $short=0, $moretitle='', $notooltip=0, $save_lastsearch_value=-1)
{
global $langs, $conf;
@@ -1554,6 +1556,14 @@ class ExpenseReport extends CommonObject
$label.= ' ' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if ($moretitle) $label.=' - '.$moretitle;
+ //if ($option != 'nolink')
+ //{
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ //}
+
$ref=$this->ref;
if (empty($ref)) $ref=$this->id;
diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php
index 4d2bc6b9b48..b836f410245 100644
--- a/htdocs/expensereport/class/paymentexpensereport.class.php
+++ b/htdocs/expensereport/class/paymentexpensereport.class.php
@@ -168,6 +168,7 @@ class PaymentExpenseReport extends CommonObject
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."payment_expensereport as t)";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id";
+ $sql.= " AND pt.entity = " . getEntity('c_paiement');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
@@ -447,7 +448,7 @@ class PaymentExpenseReport extends CommonObject
function LibStatut($statut,$mode=0)
{
global $langs;
-
+
return '';
}
diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php
index 2b8dd3ee0c6..ed588f3f961 100644
--- a/htdocs/expensereport/document.php
+++ b/htdocs/expensereport/document.php
@@ -93,15 +93,15 @@ if ($object->id)
dol_fiche_head($head, 'documents', $langs->trans("ExpenseReport"), -1, 'trip');
- $linkback = ''.$langs->trans("BackToList").'';
-
+ $linkback = ''.$langs->trans("BackToList").'';
+
$morehtmlref='';
$morehtmlref.=' ';
-
-
+
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
-
+
+
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
@@ -112,7 +112,7 @@ if ($object->id)
print '';
print ' ';
-
+
print ' ';
$linkback = ''.$langs->trans("BackToList").'';
@@ -124,8 +124,8 @@ if ($object->id)
print '';
dol_fiche_end();
-
-
+
+
$modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer;
$permtoedit = $user->rights->expensereport->creer;
diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php
index 0c3f687519c..6c2410aaa98 100644
--- a/htdocs/expensereport/info.php
+++ b/htdocs/expensereport/info.php
@@ -56,25 +56,25 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'info', $langs->trans("ExpenseReport"), -1, 'trip');
- $linkback = ''.$langs->trans("BackToList").'';
-
+ $linkback = ''.$langs->trans("BackToList").'';
+
$morehtmlref='';
$morehtmlref.=' ';
-
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
+
print '';
print ' ';
-
+
print ' ';
-
+
print ' | ';
dol_print_object_info($object);
print ' |
';
print ' ';
-
+
dol_fiche_end();
}
diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php
index 8c059b8b284..8376733d634 100644
--- a/htdocs/expensereport/note.php
+++ b/htdocs/expensereport/note.php
@@ -80,22 +80,22 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'note', $langs->trans("ExpenseReport"), -1, 'trip');
- $linkback = ''.$langs->trans("BackToList").'';
-
+ $linkback = ''.$langs->trans("BackToList").'';
+
$morehtmlref='';
$morehtmlref.=' ';
-
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
+
print '';
print ' ';
-
+
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print ' ';
-
+
dol_fiche_end();
}
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 84bcebf8ea1..87ff0adfafa 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -1148,7 +1148,7 @@ else if ($id > 0 || ! empty($ref))
// Intervention card
- $linkback = ''.$langs->trans("BackToList").'';
+ $linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='';
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 1c023415de0..bdbb03492f7 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -655,28 +655,52 @@ class Fichinter extends CommonObject
/**
* Return clicable name (with picto eventually)
*
- * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
- * @param string $option Options
- * @return string String with URL
+ * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
+ * @param string $option Options
+ * @param int $notooltip 1=Disable tooltip
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- function getNomUrl($withpicto=0,$option='')
+ function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
{
global $langs;
$result='';
+
$label = ' ' . $langs->trans("ShowIntervention") . '';
if (! empty($this->ref))
$label .= ' ' . $langs->trans('Ref') . ': '.$this->ref;
- $link = ' ';
+ $picto='intervention';
+ $url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
+
+ //if ($option !== 'nolink')
+ //{
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ //}
+
+ $linkclose='';
+ if (empty($notooltip))
+ {
+ if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ {
+ $label=$langs->trans("ShowIntervention");
+ $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ }
+ $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose.=' class="classfortooltip"';
+ }
+
+ $linkstart = '';
$linkend='';
- $picto='intervention';
-
-
- if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
- if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
+ if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend;
return $result;
}
diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php
index 2b40553a3d9..d7be9c95cec 100644
--- a/htdocs/fichinter/contact.php
+++ b/htdocs/fichinter/contact.php
@@ -126,9 +126,9 @@ if ($id > 0 || ! empty($ref))
// Intervention card
- $linkback = ' '.$langs->trans("BackToList").'';
-
-
+ $linkback = ' '.$langs->trans("BackToList").'';
+
+
$morehtmlref=' ';
// Ref customer
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
@@ -169,13 +169,13 @@ if ($id > 0 || ! empty($ref))
}
}
$morehtmlref.=' ';
-
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
-
+
dol_fiche_end();
-
+
print ' ';
-
+
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_USER)) $hideaddcontactforuser=1;
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_THIPARTY)) $hideaddcontactforthirdparty=1;
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 3d5a3c544e8..33db56a6e78 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -102,9 +102,9 @@ if ($object->id)
// Intervention card
- $linkback = ' '.$langs->trans("BackToList").'';
-
-
+ $linkback = ' '.$langs->trans("BackToList").'';
+
+
$morehtmlref=' ';
// Ref customer
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
@@ -145,13 +145,13 @@ if ($object->id)
}
}
$morehtmlref.=' ';
-
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
-
+
+
print ' ';
print ' ';
-
+
print ' ';
print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' | ';
print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' | ';
@@ -160,7 +160,7 @@ if ($object->id)
print '';
dol_fiche_end();
-
+
$modulepart = 'ficheinter';
$permission = $user->rights->ficheinter->creer;
$permtoedit = $user->rights->ficheinter->creer;
diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php
index a32cda9bb57..c8520a6645f 100644
--- a/htdocs/fichinter/info.php
+++ b/htdocs/fichinter/info.php
@@ -63,7 +63,7 @@ $head = fichinter_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), -1, 'intervention');
// Intervention card
-$linkback = ''.$langs->trans("BackToList").'';
+$linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='';
diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php
index 43a2654d1fd..a5a9675eb43 100644
--- a/htdocs/fichinter/note.php
+++ b/htdocs/fichinter/note.php
@@ -61,14 +61,14 @@ $form = new Form($db);
if ($id > 0 || ! empty($ref))
{
$object->fetch_thirdparty();
-
+
$head = fichinter_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), -1, 'intervention');
// Intervention card
- $linkback = ' '.$langs->trans("BackToList").'';
-
-
+ $linkback = ' '.$langs->trans("BackToList").'';
+
+
$morehtmlref=' ';
// Ref customer
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
@@ -109,17 +109,17 @@ if ($id > 0 || ! empty($ref))
}
}
$morehtmlref.=' ';
-
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
+
print ' ';
print ' ';
-
+
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print ' ';
-
+
dol_fiche_end();
}
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index abd2d85d723..5a855332ff7 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -190,8 +190,8 @@ class CommandeFournisseur extends CommonOrder
$sql.= ', c.fk_incoterms, c.location_incoterms';
$sql.= ', i.libelle as libelle_incoterms';
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (c.fk_mode_reglement = p.id)";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid AND cr.entity = " . getEntity('c_payment_term') . ")";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (c.fk_mode_reglement = p.id AND p.entity = " . getEntity('c_paiement') . ")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
$sql.= " WHERE c.entity = ".$conf->entity;
@@ -594,12 +594,13 @@ class CommandeFournisseur extends CommonOrder
/**
* Return clicable name (with picto eventually)
*
- * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
- * @param string $option On what the link points
- * @param int $notooltip 1=Disable tooltip
- * @return string Chain with URL
+ * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
+ * @param string $option On what the link points
+ * @param int $notooltip 1=Disable tooltip
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string Chain with URL
*/
- public function getNomUrl($withpicto=0,$option='',$notooltip=0)
+ public function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
{
global $langs, $conf;
@@ -619,6 +620,14 @@ class CommandeFournisseur extends CommonOrder
$picto='order';
$url = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$this->id;
+ if ($option !== 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ }
+
$linkclose='';
if (empty($notooltip))
{
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index b040fdcb95d..5e9974b26d5 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -517,8 +517,8 @@ class FactureFournisseur extends CommonInvoice
$sql.= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (t.fk_cond_reglement = cr.rowid)";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (t.fk_mode_reglement = p.id)";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (t.fk_cond_reglement = cr.rowid AND cr.entity = " . getEntity('c_payment_term') . ")";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (t.fk_mode_reglement = p.id AND p.entity = " . getEntity('c_paiement') . ")";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid';
if ($id) $sql.= " WHERE t.rowid=".$id;
if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'";
@@ -1839,15 +1839,16 @@ class FactureFournisseur extends CommonInvoice
/**
* Return clicable name (with picto eventually)
*
- * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
- * @param string $option Where point the link
- * @param int $max Max length of shown ref
- * @param int $short 1=Return just URL
- * @param string $moretitle Add more text to title tooltip
- * @param int $notooltip 1=Disable tooltip
- * @return string String with URL
+ * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
+ * @param string $option Where point the link
+ * @param int $max Max length of shown ref
+ * @param int $short 1=Return just URL
+ * @param string $moretitle Add more text to title tooltip
+ * @param int $notooltip 1=Disable tooltip
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- public function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0)
+ public function getNomUrl($withpicto=0, $option='',$max=0, $short=0, $moretitle='', $notooltip=0, $save_lastsearch_value=-1)
{
global $langs, $conf;
@@ -1858,6 +1859,14 @@ class FactureFournisseur extends CommonInvoice
if ($short) return $url;
+ if ($option !== 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ }
+
$picto='bill';
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php
index 25639bfd3f9..f2d5460a864 100644
--- a/htdocs/fourn/class/paiementfourn.class.php
+++ b/htdocs/fourn/class/paiementfourn.class.php
@@ -37,7 +37,7 @@ class PaiementFourn extends Paiement
public $element='payment_supplier';
public $table_element='paiementfourn';
public $picto = 'payment';
-
+
var $statut; //Status of payment. 0 = unvalidated; 1 = validated
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
// fk_paiement dans llx_paiement_facture est le rowid du paiement
@@ -75,13 +75,14 @@ class PaiementFourn extends Paiement
function fetch($id, $ref='', $fk_bank='')
{
$error=0;
-
+
$sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,';
$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
$sql.= ' p.num_paiement, p.note, b.fk_account';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
$sql.= ' WHERE p.fk_paiement = c.id';
+ $sql.= ' AND c.entity = ' . getEntity('c_paiement');
if ($id > 0)
$sql.= ' AND p.rowid = '.$id;
else if ($ref)
@@ -141,9 +142,9 @@ class PaiementFourn extends Paiement
// Clean parameters
$totalamount = 0;
$totalamount_converted = 0;
-
+
dol_syslog(get_class($this)."::create", LOG_DEBUG);
-
+
if ($way == 'dolibarr')
{
$amounts = &$this->amounts;
@@ -154,13 +155,13 @@ class PaiementFourn extends Paiement
$amounts = &$this->multicurrency_amounts;
$amounts_to_update = &$this->amounts;
}
-
+
foreach ($amounts as $key => $value)
{
$value_converted = Multicurrency::getAmountConversionFromInvoiceRate($key, $value, $way, 'facture_fourn');
$totalamount_converted += $value_converted;
$amounts_to_update[$key] = price2num($value_converted, 'MT');
-
+
$newvalue = price2num($value,'MT');
$amounts[$key] = $newvalue;
$totalamount += $newvalue;
@@ -174,7 +175,7 @@ class PaiementFourn extends Paiement
{
$ref = $this->getNextNumRef('');
$now=dol_now();
-
+
if ($way == 'dolibarr')
{
$total = $totalamount;
@@ -185,7 +186,7 @@ class PaiementFourn extends Paiement
$total = $totalamount_converted; // Maybe use price2num with MT for the converted value
$mtotal = $totalamount;
}
-
+
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
$sql.= 'ref, entity, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
$sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',";
@@ -289,7 +290,7 @@ class PaiementFourn extends Paiement
function delete($notrigger=0)
{
global $conf, $user, $langs;
-
+
$bank_line_id = $this->bank_line;
$this->db->begin();
@@ -358,7 +359,7 @@ class PaiementFourn extends Paiement
return -4;
}
}
-
+
if (! $notrigger)
{
// Appel des triggers
@@ -370,7 +371,7 @@ class PaiementFourn extends Paiement
}
// Fin appel triggers
}
-
+
$this->db->commit();
return 1;
}
@@ -556,7 +557,7 @@ class PaiementFourn extends Paiement
if ($withpicto != 2) $result.=$link.$text.$linkend;
return $result;
}
-
+
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
@@ -580,7 +581,7 @@ class PaiementFourn extends Paiement
$this->facid = 1;
$this->datepaye = $nownotime;
}
-
+
/**
* Return next reference of supplier invoice not already used (or last reference)
* according to numbering module defined into constant SUPPLIER_PAYMENT_ADDON
@@ -712,13 +713,13 @@ class PaiementFourn extends Paiement
/**
* get the right way of payment
- *
+ *
* @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs
*/
function getWay()
{
global $conf;
-
+
$way = 'dolibarr';
if (!empty($conf->multicurrency->enabled))
{
@@ -731,7 +732,7 @@ class PaiementFourn extends Paiement
}
}
}
-
+
return $way;
}
}
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 0e23b62fbb0..ecae12d260f 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -560,7 +560,7 @@ if (empty($reshook))
$res = $line->fetch($lineid);
if (!$res) dol_print_error($db);
}
-
+
$productsupplier = new ProductFournisseur($db);
if ($productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 )
{
@@ -683,7 +683,7 @@ if (empty($reshook))
dol_print_error($db,$object->error);
exit;
}
-
+
}
// Remove a product line
@@ -1792,7 +1792,7 @@ elseif (! empty($object->id))
// Supplier order card
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$morehtmlref=' ';
// Ref supplier
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 820768ac7bd..1115106a9db 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2028,7 +2028,7 @@ else
// Supplier invoice card
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$morehtmlref=' ';
// Ref supplier
@@ -2358,7 +2358,7 @@ else
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity = ' . getEntity('c_paiement');
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid';
$sql.= ' WHERE pf.fk_facturefourn = '.$object->id;
$sql.= ' ORDER BY p.datep, p.tms';
diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php
index 0f56c5f7bae..ffc58195e26 100644
--- a/htdocs/fourn/facture/contact.php
+++ b/htdocs/fourn/facture/contact.php
@@ -135,12 +135,12 @@ if ($id > 0 || ! empty($ref))
$object->fetch_thirdparty();
$alreadypaid=$object->getSommePaiement();
-
+
$head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'bill');
- $linkback = ' ' . $langs->trans("BackToList") . '';
+ $linkback = ' ' . $langs->trans("BackToList") . '';
$morehtmlref=' ';
// Ref supplier
@@ -186,7 +186,7 @@ if ($id > 0 || ! empty($ref))
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
+
print ' ';
print ' ';
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 6926770bd91..77c0559aeca 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -90,10 +90,10 @@ if ($object->id > 0)
{
$head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'bill');
-
+
$totalpaye = $object->getSommePaiement();
- $linkback = ' ' . $langs->trans("BackToList") . '';
+ $linkback = ' ' . $langs->trans("BackToList") . '';
$morehtmlref=' ';
// Ref supplier
@@ -231,7 +231,7 @@ if ($object->id > 0)
print ' ';
print ' ';
-
+
print ' ';
// Nb of files
@@ -241,9 +241,9 @@ if ($object->id > 0)
print ' ';
print ' ';
-
+
dol_fiche_end();
-
+
$modulepart = 'facture_fournisseur';
$permission = $user->rights->fournisseur->facture->creer;
diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php
index 73d6b94a0d6..ffda7e2f4cd 100644
--- a/htdocs/fourn/facture/info.php
+++ b/htdocs/fourn/facture/info.php
@@ -63,7 +63,7 @@ $head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), -1, 'bill');
-$linkback = ' ' . $langs->trans("BackToList") . '';
+$linkback = ' ' . $langs->trans("BackToList") . '';
$morehtmlref=' ';
// Ref supplier
diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php
index 9df425040e1..6afe9f37c8c 100644
--- a/htdocs/fourn/facture/note.php
+++ b/htdocs/fourn/facture/note.php
@@ -76,14 +76,14 @@ if ($object->id > 0)
$object->fetch_thirdparty();
$alreadypaid=$object->getSommePaiement();
-
+
$head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'note', $titre, -1, 'bill');
// Supplier invoice card
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$morehtmlref=' ';
// Ref supplier
@@ -128,7 +128,7 @@ if ($object->id > 0)
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
- dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print ' ';
print ' ';
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index d6fd80e47fe..b469138a7b9 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -745,7 +745,7 @@ if (empty($action))
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id AND c.entity = ' . getEntity('c_paiement');
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
@@ -913,7 +913,7 @@ if (empty($action))
print ' '.$objp->num_paiement.' | ';
print ' ';
- if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).'';
+ if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).'';
else print ' ';
print ' | ';
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 0c11bd1dea1..c957ec67a5b 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -1045,7 +1045,7 @@ else
dol_fiche_head($head, 'card', $langs->trans("CPTitreMenu"), -1, 'holiday');
- $linkback=' '.$langs->trans("BackToList").'';
+ $linkback=' '.$langs->trans("BackToList").'';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref');
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 9486a4a1447..70d00bd2f01 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -819,24 +819,34 @@ class Holiday extends CommonObject
/**
* Return clicable name (with picto eventually)
*
- * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
- * @return string String with URL
+ * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- function getNomUrl($withpicto=0)
+ function getNomUrl($withpicto=0, $save_lastsearch_value=-1)
{
global $langs;
$result='';
+ $picto='holiday';
$label=$langs->trans("Show").': '.$this->ref;
- $link = ' ';
+ $url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;
+
+ //if ($option != 'nolink')
+ //{
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ //}
+
+ $linkstart = '';
$linkend='';
- $picto='holiday';
-
- if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
- if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
+ if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend;
return $result;
}
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index 032fc8efef0..b4440700be7 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -291,9 +291,9 @@ else
}
else
{
- print_liste_field_titre($langs->trans("NoLeaveWithCounterDefined"), $_SERVER["PHP_SELF"], '', '', '', '');
+ print_liste_field_titre('NoLeaveWithCounterDefined', $_SERVER["PHP_SELF"], '', '', '', '');
}
- print_liste_field_titre((empty($user->rights->holiday->define_holiday) ? '' : $langs->trans('Note')), $_SERVER["PHP_SELF"]);
+ print_liste_field_titre((empty($user->rights->holiday->define_holiday) ? '' : 'Note'), $_SERVER["PHP_SELF"]);
print_liste_field_titre('');
print '';
diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php
index c468fcd7272..94d32b3bc49 100644
--- a/htdocs/holiday/document.php
+++ b/htdocs/holiday/document.php
@@ -109,7 +109,7 @@ if ($object->id)
}
- $linkback=' '.$langs->trans("BackToList").'';
+ $linkback=' '.$langs->trans("BackToList").'';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref');
diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php
index 2d97a73667b..2e63793cbfd 100644
--- a/htdocs/holiday/list.php
+++ b/htdocs/holiday/list.php
@@ -313,7 +313,7 @@ if ($id > 0) print ' ';
if ($id > 0) // For user tab
{
$title = $langs->trans("User");
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$head = user_prepare_head($fuser);
dol_fiche_head($head, 'paidholidays', $title, -1, 'user');
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 82ecad62417..0847f1c4262 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -77,7 +77,7 @@ $hexa = GETPOST('hexa');
$importmodelid = GETPOST('importmodelid');
$excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 1);
$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
-$updatekeys = (GETPOST('updatekeys') ? GETPOST('updatekeys') : array());
+$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
$separator = (GETPOST('separator') ? GETPOST('separator') : (! empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)?$conf->global->IMPORT_CSV_SEPARATOR_TO_USE:','));
$enclosure = (GETPOST('enclosure') ? GETPOST('enclosure') : '"');
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index d2845969bb0..ff9f4e0a2f8 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -343,3 +343,12 @@ DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_EXPENSEREPORT_JOURNAL')
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_c_type_fees MODIFY accountancy_code VARCHAR(32) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_c_type_fees MODIFY accountancy_code VARCHAR(32) COLLATE utf8_unicode_ci;
+
+ALTER TABLE llx_c_paiement DROP PRIMARY KEY;
+ALTER TABLE llx_c_paiement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER id;
+ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement;
+ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(id, entity, code);
+
+ALTER TABLE llx_c_payment_term DROP PRIMARY KEY;
+ALTER TABLE llx_c_payment_term ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
+ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(rowid, entity, code);
diff --git a/htdocs/install/mysql/tables/llx_c_paiement.key.sql b/htdocs/install/mysql/tables/llx_c_paiement.key.sql
index 0d6686a774c..ad1930fba2e 100644
--- a/htdocs/install/mysql/tables/llx_c_paiement.key.sql
+++ b/htdocs/install/mysql/tables/llx_c_paiement.key.sql
@@ -1,5 +1,6 @@
-- ========================================================================
--- Copyright (C) 2012 Florian Henry
+-- Copyright (C) 2012 Florian Henry
+-- Copyright (C) 2017 Regis Houssin
--
-- 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
@@ -16,4 +17,4 @@
--
-- ========================================================================
-ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(code);
+ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(id, entity, code);
diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql
index 7db85510608..55cb44fb257 100644
--- a/htdocs/install/mysql/tables/llx_c_paiement.sql
+++ b/htdocs/install/mysql/tables/llx_c_paiement.sql
@@ -1,7 +1,8 @@
-- ========================================================================
--- Copyright (C) 2001-2004 Rodolphe Quiedeville
--- Copyright (C) 2004-2014 Laurent Destailleur
--- Copyright (C) 2014 Alexandre Spangaro
+-- Copyright (C) 2001-2004 Rodolphe Quiedeville
+-- Copyright (C) 2004-2014 Laurent Destailleur
+-- Copyright (C) 2014 Alexandre Spangaro
+-- Copyright (C) 2017 Regis Houssin
--
-- 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
@@ -20,15 +21,13 @@
create table llx_c_paiement
(
- id integer PRIMARY KEY,
+ id integer,
+ entity integer DEFAULT 1 NOT NULL, -- multi company id
code varchar(6) NOT NULL,
libelle varchar(62),
type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other
active tinyint DEFAULT 1 NOT NULL,
accountancy_code varchar(32) NULL,
module varchar(32) NULL,
- position integer NOT NULL DEFAULT 0
+ position integer NOT NULL DEFAULT 0
)ENGINE=innodb;
-
-
-
diff --git a/htdocs/install/mysql/tables/llx_c_payment_term.key.sql b/htdocs/install/mysql/tables/llx_c_payment_term.key.sql
new file mode 100644
index 00000000000..1bd86401945
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_c_payment_term.key.sql
@@ -0,0 +1,20 @@
+-- ========================================================================
+-- Copyright (C) 2012 Florian Henry
+-- Copyright (C) 2017 Regis Houssin
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+--
+-- ========================================================================
+
+ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(rowid, entity, code);
diff --git a/htdocs/install/mysql/tables/llx_c_payment_term.sql b/htdocs/install/mysql/tables/llx_c_payment_term.sql
index d0f07abc5a1..cc7c7a22dea 100644
--- a/htdocs/install/mysql/tables/llx_c_payment_term.sql
+++ b/htdocs/install/mysql/tables/llx_c_payment_term.sql
@@ -1,6 +1,7 @@
-- ============================================================================
--- Copyright (C) 2002-2003 Rodolphe Quiedeville
--- Copyright (C) 2016 Laurent Destailleur
+-- Copyright (C) 2002-2003 Rodolphe Quiedeville
+-- Copyright (C) 2016 Laurent Destailleur
+-- Copyright (C) 2017 Regis Houssin
--
-- 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
@@ -19,15 +20,16 @@
create table llx_c_payment_term
(
- rowid integer PRIMARY KEY,
- code varchar(16),
- sortorder smallint,
- active tinyint DEFAULT 1,
- libelle varchar(255),
- libelle_facture text,
- type_cdr tinyint, -- Type of change date reckoning. 1=Payment at end of current month, 2=the Nth of next month
- nbjour smallint,
- decalage smallint,
- module varchar(32) NULL,
- position integer NOT NULL DEFAULT 0
+ rowid integer,
+ entity integer DEFAULT 1 NOT NULL, -- multi company id
+ code varchar(16),
+ sortorder smallint,
+ active tinyint DEFAULT 1,
+ libelle varchar(255),
+ libelle_facture text,
+ type_cdr tinyint, -- Type of change date reckoning. 1=Payment at end of current month, 2=the Nth of next month
+ nbjour smallint,
+ decalage smallint,
+ module varchar(32) NULL,
+ position integer NOT NULL DEFAULT 0
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql
index 35982525853..f6994810021 100644
--- a/htdocs/install/mysql/tables/llx_holiday.sql
+++ b/htdocs/install/mysql/tables/llx_holiday.sql
@@ -19,7 +19,7 @@
CREATE TABLE llx_holiday
(
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
-ref varchar(30) NOT NULL, -- number
+ref varchar(30) NULL, -- number
ref_ext varchar(255),
entity integer DEFAULT 1 NOT NULL, -- Multi company id
fk_user integer NOT NULL,
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 135d4b83caa..f6a51657799 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -410,15 +410,16 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
migrate_reload_menu($db,$langs,$conf,$versionto);
}
- // Can force activation of some module during migration with paramater 'enablemodules=MAIN_MODULE_XXX,MAIN_MODULE_YYY,...'
+ // Can force activation of some module during migration with parameter 'enablemodules=MAIN_MODULE_XXX,MAIN_MODULE_YYY,...'
+ // In most cases (online install or upgrade) $enablemodules is empty. Can be forced when ran from command line.
if (! $error && $enablemodules)
{
- // Reload modules (this must be always and only into last targeted version)
+ // Reload modules (this must be always done and only into last targeted version)
$listofmodules=array();
$tmplistofmodules=explode(',', $enablemodules);
foreach($tmplistofmodules as $value)
{
- $listofmodules[$value]='newboxdefonly';
+ $listofmodules[$value]='forceactivate';
}
migrate_reload_modules($db,$langs,$conf,$listofmodules,1);
}
@@ -4118,31 +4119,11 @@ function migrate_delete_old_dir($db,$langs,$conf)
*/
function migrate_reload_modules($db,$langs,$conf,$listofmodule=array(),$force=0)
{
+ if (count($listofmodule) == 0) return;
+
dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force);
- // If no info is provided, we reload all modules with mode newboxdefonly.
- if (count($listofmodule) == 0)
- {
- $listofmodule=array(
- 'MAIN_MODULE_AGENDA'=>'newboxdefonly',
- 'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
- 'MAIN_MODULE_PRODUIT'=>'newboxdefonly',
- 'MAIN_MODULE_SERVICE'=>'newboxdefonly',
- 'MAIN_MODULE_COMMANDE'=>'newboxdefonly',
- 'MAIN_MODULE_FACTURE'=>'newboxdefonly',
- 'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly',
- 'MAIN_MODULE_HOLIDAY'=>'newboxdefonly',
- 'MAIN_MODULE_USER'=>'newboxdefonly',
- 'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly',
- 'MAIN_MODULE_DON'=>'newboxdefonly',
- 'MAIN_MODULE_ECM'=>'newboxdefonly',
- 'MAIN_MODULE_PAYBOX'=>'newboxdefonly',
- 'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly',
- 'MAIN_MODULE_SALARIES'=>'newboxdefonly'
- );
- }
-
- foreach($listofmodule as $moduletoreload => $reloadmode)
+ foreach($listofmodule as $moduletoreload => $reloadmode) // reloadmodule can be 'noboxes', 'newboxdefonly', 'forceactivate'
{
if (empty($moduletoreload) || (empty($conf->global->$moduletoreload) && ! $force)) continue; // Discard reload if module not enabled
diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php
index d6ebf7b68aa..84cd7c8899d 100644
--- a/htdocs/livraison/card.php
+++ b/htdocs/livraison/card.php
@@ -44,7 +44,7 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
-
+
$langs->load("sendings");
$langs->load("bills");
@@ -223,7 +223,7 @@ if ($action == 'update_extras_line')
{
$array_options=array();
$num=count($object->lines);
-
+
for ($i = 0; $i < $num; $i++)
{
// Extrafields
@@ -236,7 +236,7 @@ if ($action == 'update_extras_line')
unset($_POST["options_" . $key]);
}
}
-
+
$ret = $object->update_line($object->lines[$i]->id,$array_options[$i]); // extrafields update
if ($ret < 0)
{
@@ -305,7 +305,7 @@ $formfile = new FormFile($db);
if ($action == 'create') // Seems to no be used
{
-
+
}
else
/* *************************************************************************** */
@@ -333,16 +333,16 @@ else
$head=delivery_prepare_head($object);
-
+
print ' \n";
-
+
dol_fiche_end();
//if ($object->statut == 0) // only if draft
// print ' ';
-
+
print '';
-
+
/*
* Boutons actions
@@ -706,7 +706,7 @@ else
{
print ' ';
- if ($object->statut == 0 && $num_prod > 0)
+ if ($object->statut == 0 && $num_prod > 0)
{
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->livraison->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->livraison_advance->validate)))
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 56ffa78f429..837b0af77f5 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -295,13 +295,13 @@ class Livraison extends CommonObject
//Incoterms
$this->fk_incoterms = $obj->fk_incoterms;
- $this->location_incoterms = $obj->location_incoterms;
+ $this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms;
$this->db->free($result);
if ($this->statut == 0) $this->brouillon = 1;
-
-
+
+
// Retrieve all extrafields for delivery
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@@ -524,7 +524,7 @@ class Livraison extends CommonObject
$this->fk_delivery_address = $expedition->fk_delivery_address;
$this->socid = $expedition->socid;
$this->ref_customer = $expedition->ref_customer;
-
+
//Incoterms
$this->fk_incoterms = $expedition->fk_incoterms;
$this->location_incoterms = $expedition->location_incoterms;
@@ -543,26 +543,26 @@ class Livraison extends CommonObject
{
global $conf;
$error = 0;
-
+
if ($id > 0 && !$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{
$livraisonline = new LivraisonLigne($this->db);
$livraisonline->array_options=$array_options;
$livraisonline->id=$id;
$result=$livraisonline->insertExtraFields();
-
+
if ($result < 0)
{
$this->error[]=$livraisonline->error;
$error++;
}
}
-
+
if (! $error) return 1;
else return -1;
}
-
-
+
+
/**
* Add line
*
@@ -696,26 +696,36 @@ class Livraison extends CommonObject
/**
* Return clicable name (with picto eventually)
*
- * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
- * @return string Chaine avec URL
+ * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string Chaine avec URL
*/
- function getNomUrl($withpicto=0)
+ function getNomUrl($withpicto=0, $save_lastsearch_value=-1)
{
global $langs;
$result='';
- $urlOption='';
- $label=$langs->trans("ShowReceiving").': '.$this->ref;
-
-
- $link = ' ';
- $linkend='';
-
$picto='sending';
- if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ $label=$langs->trans("ShowReceiving").': '.$this->ref;
+
+ $url=DOL_URL_ROOT.'/livraison/card.php?id='.$this->id;
+
+ //if ($option !== 'nolink')
+ //{
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ //}
+
+
+ $linkstart = ' ';
+ $linkend='';
+
+ if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
- $result.=$link.$this->ref.$linkend;
+ $result.=$linkstart.$this->ref.$linkend;
return $result;
}
@@ -1052,7 +1062,7 @@ class Livraison extends CommonObject
class LivraisonLigne extends CommonObjectLine
{
var $db;
-
+
// From llx_expeditiondet
var $qty;
var $qty_asked;
@@ -1075,7 +1085,7 @@ class LivraisonLigne extends CommonObjectLine
public $product_ref;
public $product_label;
-
+
public $element='livraisondet';
public $table_element='livraisondet';
diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php
index 1f76d705305..2edf3c34547 100644
--- a/htdocs/loan/card.php
+++ b/htdocs/loan/card.php
@@ -642,6 +642,7 @@ if ($id > 0)
$sql.= " AND p.fk_loan = l.rowid";
$sql.= " AND l.entity = ".$conf->entity;
$sql.= " AND p.fk_typepayment = c.id";
+ $sql.= " AND c.entity = " . getEntity('c_paiement');
$sql.= " ORDER BY dp DESC";
//print $sql;
diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php
index fb6df8fcb6c..c5794b52daf 100644
--- a/htdocs/loan/class/loanschedule.class.php
+++ b/htdocs/loan/class/loanschedule.class.php
@@ -179,6 +179,7 @@ class LoanSchedule extends CommonObject
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX.$this->table_element." as t)";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id";
+ $sql.= " AND pt.entity = " . getEntity('c_paiement');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php
index 52c822e54c1..836acd082e1 100644
--- a/htdocs/loan/class/paymentloan.class.php
+++ b/htdocs/loan/class/paymentloan.class.php
@@ -178,6 +178,7 @@ class PaymentLoan extends CommonObject
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."payment_loan as t)";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id";
+ $sql.= " AND pt.entity = " . getEntity('c_paiement');
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php
index 9175736d5db..605a4272081 100644
--- a/htdocs/margin/tabs/productMargins.php
+++ b/htdocs/margin/tabs/productMargins.php
@@ -95,7 +95,7 @@ if ($id > 0 || ! empty($ref))
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'margin', $titre, -1, $picto);
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php
index bc8928bdc6e..5753760df66 100644
--- a/htdocs/margin/tabs/thirdpartyMargins.php
+++ b/htdocs/margin/tabs/thirdpartyMargins.php
@@ -91,7 +91,7 @@ if ($socid > 0)
dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"), -1, 'company');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index e91a9751b60..ef4dff5ed49 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -268,7 +268,7 @@ class MyObject extends CommonObject
* Return a link to the object card (with optionaly the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
- * @param string $option On what the link point to
+ * @param string $option On what the link point to ('nolink', ...)
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
@@ -289,11 +289,10 @@ class MyObject extends CommonObject
$label.= ' ';
$label.= ' ' . $langs->trans('Ref') . ': ' . $this->ref;
- $url='';
+ $url = dol_buildpath('/mymodule/myobject_card.php',1).'?id='.$this->id;
+
if ($option != 'nolink')
{
- $url = dol_buildpath('/mymodule/myobject_card.php',1).'?id='.$this->id;
-
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 4160b2045fd..144cde98c64 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -308,7 +308,11 @@ if ($action == 'create')
dol_fiche_end();
- print ' ';
+ print ' ';
+ print '';
+ print ' ';
+ print ''; // Cancel for create doe not post form
+ print ' ';
print '';
}
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index f5e6c906e7d..cdf903639c5 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1488,7 +1488,7 @@ else
dol_fiche_head($head, 'card', $titre, -1, $picto);
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 0dd16fd99dc..d2c52ec4255 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3416,12 +3416,13 @@ class Product extends CommonObject
/**
* Return clicable link of object (with eventually picto)
*
- * @param int $withpicto Add picto into link
- * @param string $option Where point the link ('stock', 'composition', 'category', 'supplier', '')
- * @param int $maxlength Maxlength of ref
- * @return string String with URL
+ * @param int $withpicto Add picto into link
+ * @param string $option Where point the link ('stock', 'composition', 'category', 'supplier', '')
+ * @param int $maxlength Maxlength of ref
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- function getNomUrl($withpicto=0,$option='',$maxlength=0)
+ function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_value=-1)
{
global $conf, $langs, $hookmanager;
include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
@@ -3458,7 +3459,6 @@ class Product extends CommonObject
if ($this->nbphoto > 0) $label .= ' ' . $tmpphoto;
}
-
$linkclose='';
if (empty($notooltip))
{
@@ -3469,7 +3469,7 @@ class Product extends CommonObject
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
- $linkclose.=' class="classfortooltip"';
+ $linkclose.= ' class="classfortooltip"';
if (! is_object($hookmanager))
{
@@ -3492,6 +3492,14 @@ class Product extends CommonObject
$url = DOL_URL_ROOT.'/product/card.php?id='.$this->id;
}
+ if ($option !== 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ }
+
$linkstart = ' ';
$linkend='';
diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php
index a4012b7d3c4..a6cc3427243 100644
--- a/htdocs/product/composition/card.php
+++ b/htdocs/product/composition/card.php
@@ -203,7 +203,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($user->rights->produit->lire || $user->rights->service->lire)
{
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index 53bbbfeeabb..fd67cd72504 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -212,7 +212,7 @@ if ($object->id)
}
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index cb295012795..6124bc9161a 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -308,7 +308,7 @@ if ($id > 0 || $ref)
dol_fiche_head($head, 'suppliers', $titre, -1, $picto);
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
diff --git a/htdocs/product/info.php b/htdocs/product/info.php
index c8af676ed0a..1887e96df47 100644
--- a/htdocs/product/info.php
+++ b/htdocs/product/info.php
@@ -94,7 +94,7 @@ if ($id > 0 || $ref)
dol_fiche_head($head, 'info', $titre, -1, $picto);
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
diff --git a/htdocs/product/note.php b/htdocs/product/note.php
index 19496eeb860..5e73548579c 100644
--- a/htdocs/product/note.php
+++ b/htdocs/product/note.php
@@ -93,7 +93,7 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'note', $titre, -1, $picto);
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index af9fa2a927f..e00973902dd 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -690,7 +690,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'price', $titre, -1, $picto);
-$linkback = ' '.$langs->trans("BackToList").'';
+$linkback = ' '.$langs->trans("BackToList").'';
$object->next_prev_filter=" fk_product_type = ".$object->type;
$shownav = 1;
diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php
index 6389c5a8b8b..8f08e0b0317 100644
--- a/htdocs/product/stats/card.php
+++ b/htdocs/product/stats/card.php
@@ -138,7 +138,7 @@ if ($result && (! empty($id) || ! empty($ref)))
dol_fiche_head($head, 'stats', $titre, -1, $picto);
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 4eb8992d837..dc3d9a9b7d6 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -100,7 +100,7 @@ if ($id > 0 || ! empty($ref))
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index 17d4bb5f962..4526af86f96 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -107,7 +107,7 @@ if ($id > 0 || ! empty($ref)) {
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index 8780a8a6a3b..7882f251dbd 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -90,7 +90,7 @@ if ($id > 0 || ! empty($ref))
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 36359d1bd35..794d939bc6e 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -117,7 +117,7 @@ if ($id > 0 || ! empty($ref))
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 6618d8deac8..2e6b8d19677 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index aa2c9a8e603..3173a04ee55 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php
index 9406ade286f..07e8015d846 100644
--- a/htdocs/product/stats/supplier_proposal.php
+++ b/htdocs/product/stats/supplier_proposal.php
@@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 2963f5e278d..faee4d05a6a 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -544,7 +544,7 @@ if ($id > 0 || $ref)
dol_htmloutput_events();
- $linkback = ' '.$langs->trans("BackToList").'';
+ $linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php
index 791da80c05d..fd13aee1ea2 100644
--- a/htdocs/product/traduction.php
+++ b/htdocs/product/traduction.php
@@ -200,7 +200,7 @@ if (! empty($object->multilangs))
dol_fiche_head($head, 'translation', $titre, 0, $picto);
-$linkback = ' '.$langs->trans("BackToList").'';
+$linkback = ' '.$langs->trans("BackToList").'';
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index a997b5f4b96..af192c63d1c 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1327,7 +1327,7 @@ if ($action == 'create')
// Supplier proposal card
- $linkback = ' ' . $langs->trans("BackToList") . '';
+ $linkback = ' ' . $langs->trans("BackToList") . '';
$morehtmlref=' ';
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index 53c2d4215df..19dc3eed6e9 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -1116,8 +1116,8 @@ class SupplierProposal extends CommonObject
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."supplier_proposal as p";
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity = ' . getEntity('c_paiement');
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity = ' . getEntity('c_payment_term');
$sql.= " WHERE p.fk_statut = c.id";
$sql.= " AND p.entity = ".$conf->entity;
if ($ref) $sql.= " AND p.ref='".$ref."'";
@@ -2364,13 +2364,14 @@ class SupplierProposal extends CommonObject
/**
* Return clicable link of object (with eventually picto)
*
- * @param int $withpicto Add picto into link
- * @param string $option Where point the link ('compta', 'expedition', 'document', ...)
- * @param string $get_params Parametres added to url
- * @param int $notooltip 1=Disable tooltip
- * @return string String with URL
+ * @param int $withpicto Add picto into link
+ * @param string $option Where point the link ('compta', 'expedition', 'document', ...)
+ * @param string $get_params Parametres added to url
+ * @param int $notooltip 1=Disable tooltip
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- function getNomUrl($withpicto=0,$option='', $get_params='', $notooltip=0)
+ function getNomUrl($withpicto=0, $option='', $get_params='', $notooltip=0, $save_lastsearch_value=-1)
{
global $langs, $conf, $user;
@@ -2397,6 +2398,14 @@ class SupplierProposal extends CommonObject
$url = DOL_URL_ROOT.'/supplier_proposal/document.php?id='.$this->id. $get_params;
}
+ if ($option !== 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ }
+
$linkclose='';
if (empty($notooltip) && $user->rights->propal->lire)
{
diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php
index 4985fd34629..9bb7db0222b 100644
--- a/htdocs/supplier_proposal/document.php
+++ b/htdocs/supplier_proposal/document.php
@@ -94,7 +94,7 @@ if ($object->id > 0)
// Supplier proposal card
- $linkback = ' ' . $langs->trans("BackToList") . '';
+ $linkback = ' ' . $langs->trans("BackToList") . '';
$morehtmlref=' ';
diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php
index 8cee304e3bb..9f134b332ae 100644
--- a/htdocs/supplier_proposal/info.php
+++ b/htdocs/supplier_proposal/info.php
@@ -58,7 +58,7 @@ $head = supplier_proposal_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans('CommRequest'), -1, 'supplier_proposal');
// Supplier proposal card
-$linkback = ' ' . $langs->trans("BackToList") . '';
+$linkback = ' ' . $langs->trans("BackToList") . '';
$morehtmlref=' ';
diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php
index 10a9668382c..997cb67db2f 100644
--- a/htdocs/supplier_proposal/note.php
+++ b/htdocs/supplier_proposal/note.php
@@ -71,7 +71,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id, $ref))
{
$object->fetch_thirdparty();
-
+
$societe = new Societe($db);
if ( $societe->fetch($object->socid) )
{
@@ -80,9 +80,9 @@ if ($id > 0 || ! empty($ref))
// Supplier proposal card
- $linkback = ' ' . $langs->trans("BackToList") . '';
-
-
+ $linkback = ' ' . $langs->trans("BackToList") . '';
+
+
$morehtmlref=' ';
// Ref supplier
//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
@@ -123,17 +123,17 @@ if ($id > 0 || ! empty($ref))
}
}
$morehtmlref.=' ';
-
-
+
+
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
-
+
+
print ' ';
print ' ';
-
+
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
-
+
print ' ';
dol_fiche_end();
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 77ccbbcb219..a7c2d0f1a6b 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -2040,17 +2040,18 @@ class User extends CommonObject
* Return a link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
*
- * @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
- * @param string $option On what the link point to
- * @param integer $infologin Add complete info tooltip
- * @param integer $notooltip 1=Disable tooltip on picto and name
- * @param int $maxlen Max length of visible user name
- * @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user
- * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login
- * @param string $morecss Add more css on link
- * @return string String with URL
+ * @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
+ * @param string $option On what the link point to
+ * @param integer $infologin Add complete info tooltip
+ * @param integer $notooltip 1=Disable tooltip on picto and name
+ * @param int $maxlen Max length of visible user name
+ * @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user
+ * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login
+ * @param string $morecss Add more css on link
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
- function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='')
+ function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='', $save_lastsearch_value=-1)
{
global $langs, $conf, $db, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -2108,10 +2109,18 @@ class User extends CommonObject
if (! empty($_SESSION["disablemodules"])) $label.= ' '.$langs->trans("DisabledModules").': '.join(', ',explode(',',$_SESSION["disablemodules"]));
}
+ if ($option == 'leave') $url.= DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;
+ else $link.= $url.= DOL_URL_ROOT.'/user/card.php?id='.$this->id;
- if ($option == 'leave') $link.= ' |