';
$moreforfilter = '';
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index faba841e7c6..8ae6a18eb2f 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1049,13 +1049,15 @@ class Adherent extends CommonObject
/**
* Load member from database
*
- * @param int $rowid Id of object to load
- * @param string $ref To load member from its ref
- * @param int $fk_soc To load member from its link to third party
- * @param string $ref_ext External reference
- * @return int >0 if OK, 0 if not found, <0 if KO
+ * @param int $rowid Id of object to load
+ * @param string $ref To load member from its ref
+ * @param int $fk_soc To load member from its link to third party
+ * @param string $ref_ext External reference
+ * @param bool $fetch_optionals To load optionals (extrafields)
+ * @param bool $fetch_subscriptions To load member subscriptions
+ * @return int >0 if OK, 0 if not found, <0 if KO
*/
- function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')
+ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='',$fetch_optionals=true,$fetch_subscriptions=true)
{
global $langs;
@@ -1160,10 +1162,14 @@ class Adherent extends CommonObject
// Retreive all extrafield
// fetch optionals attributes and labels
- $this->fetch_optionals();
+ if ($fetch_optionals) {
+ $this->fetch_optionals();
+ }
// Load other properties
- $result=$this->fetch_subscriptions();
+ if ($fetch_subscriptions) {
+ $result=$this->fetch_subscriptions();
+ }
return $this->id;
}
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 2393d5dad3b..4a032457f0d 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -332,7 +332,9 @@ class AdherentType extends CommonObject
* Return array of Member objects for member type this->id (or all if this->id not defined)
*
* @param string $excludefilter Filter to exclude
- * @param int $mode 0=Return array of member instance, 1=Return array of members id only
+ * @param int $mode 0=Return array of member instance
+ * 1=Return array of member instance without extra data
+ * 2=Return array of members id only
* @return mixed Array of members or -1 on error
*/
function listMembersForMemberType($excludefilter='', $mode=0)
@@ -355,10 +357,14 @@ class AdherentType extends CommonObject
{
if (! array_key_exists($obj->rowid, $ret))
{
- if ($mode != 1)
+ if ($mode < 2)
{
$memberstatic=new Adherent($this->db);
- $memberstatic->fetch($obj->rowid);
+ if ($mode == 1) {
+ $memberstatic->fetch($obj->rowid,'','','',false, false);
+ } else {
+ $memberstatic->fetch($obj->rowid);
+ }
$ret[$obj->rowid]=$memberstatic;
}
else $ret[$obj->rowid]=$obj->rowid;
@@ -457,7 +463,7 @@ class AdherentType extends CommonObject
foreach($this->members as $key=>$val) // This is array of users for group into dolibarr database.
{
$member=new Adherent($this->db);
- $member->fetch($val->id);
+ $member->fetch($val->id,'','','',false,false);
$info2 = $member->_load_ldap_info();
$valueofldapfield[] = $member->_load_ldap_dn($info2);
}
diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php
index b8fc22f8f75..7edb42e6c76 100644
--- a/htdocs/adherents/type_ldap.php
+++ b/htdocs/adherents/type_ldap.php
@@ -63,7 +63,7 @@ if (empty($reshook))
if ($result > 0)
{
- $object->listMembersForMemberType();
+ $object->listMembersForMemberType('', 1);
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 9a4e3dcdb36..26c88b47ad3 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -41,7 +41,7 @@ $month=GETPOST("month",'int');
$day=GETPOST("day",'int');
$pid=GETPOST("projectid",'int',3);
$status=GETPOST("status",'alpha');
-$type=GETPOST('type');
+$type=GETPOST('type','alphanohtml');
$optioncss = GETPOST('optioncss','alpha');
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array'))
@@ -355,7 +355,7 @@ if ($resql)
//if ($actioncode) $nav.='';
//if ($resourceid) $nav.='';
if ($filter) $nav.='';
- if ($filtert) $nav.='';
+ //if ($filtert) $nav.='';
//if ($socid) $nav.='';
if ($showbirthday) $nav.='';
//if ($pid) $nav.='';
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 086cd1128dd..8be7fa249b8 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -616,7 +616,7 @@ if (empty($reshook))
// Close proposal
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
{
- if (! GETPOST('statut','int')) {
+ if (! (GETPOST('statut','int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'statut';
} else {
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 295d565dd98..8c234716bee 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -455,7 +455,7 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ";
-if ($search_bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
+if ($search_bid>0) $sql.= MAIN_DB_PREFIX."bank_class as l,";
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
$sql.= " ".MAIN_DB_PREFIX."bank as b";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_extrafields as ef on (b.rowid = ef.fk_object)";
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 087f6018354..a3576a438aa 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -366,7 +366,7 @@ $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= " country.code as country_code,";
-$sql.= " p.rowid as project_id, p.ref as project_ref";
+$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
@@ -979,6 +979,7 @@ if ($resql)
{
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
+ $projectstatic->title=$obj->project_label;
print $projectstatic->getNomUrl(1);
}
print '';
diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php
index df4909faad6..cfcb117b0a8 100644
--- a/htdocs/compta/localtax/index.php
+++ b/htdocs/compta/localtax/index.php
@@ -52,7 +52,6 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
$modetax = $conf->global->TAX_MODE;
if (isset($_GET["modetax"])) $modetax=GETPOST("modetax",'alpha');
-
/**
* print function
*
@@ -174,16 +173,16 @@ $y = $year_current ;
$total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
$i=0;
for ($m = 1 ; $m < 13 ; $m++ ) {
- $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
- $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
-
+ $coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m);
+ $coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m);
+
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
$parameters["type"] = 'localtax'.$localTaxType;
-
+
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@@ -198,7 +197,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
break;
}
-
+
print '
';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
$nbcols+=2;
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index bbe05ea1111..0ccd7013ba4 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -160,8 +160,8 @@ $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
$i=0;
for ($m = 1 ; $m < 13 ; $m++ )
{
- $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
- $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
+ $coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m);
+ $coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m);
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index 1b60a5603bb..92b67dbfd6f 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -198,8 +198,8 @@ $i=0;
$columns = 5;
// Load arrays of datas
-$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
-$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
+$x_coll = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'sell');
+$x_paye = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'buy');
if (! is_array($x_coll) || ! is_array($x_paye))
{
diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php
index c513db1b49f..d443956a9fe 100644
--- a/htdocs/contact/agenda.php
+++ b/htdocs/contact/agenda.php
@@ -101,7 +101,7 @@ if (! $sortfield) $sortfield='a.datep, a.id';
if (! $sortorder) $sortorder='DESC';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('contactcard','globalcard'));
+$hookmanager->initHooks(array('contactagenda','globalcard'));
/*
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index da77c5a4f9b..5bdc58cc61a 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6551,7 +6551,7 @@ abstract class CommonObject
*
* @return array
*/
- protected function set_save_query()
+ protected function setSaveQuery()
{
global $conf;
@@ -6650,7 +6650,7 @@ abstract class CommonObject
*
* @return string
*/
- protected function get_field_list()
+ protected function getFieldList()
{
$keys = array_keys($this->fields);
return implode(',', $keys);
@@ -6685,7 +6685,7 @@ abstract class CommonObject
$now=dol_now();
- $fieldvalues = $this->set_save_query();
+ $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now);
if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
@@ -6778,7 +6778,7 @@ abstract class CommonObject
{
if (empty($id) && empty($ref)) return false;
- $sql = 'SELECT '.$this->get_field_list();
+ $sql = 'SELECT '.$this->getFieldList();
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
if (!empty($id)) $sql.= ' WHERE rowid = '.$id;
@@ -6822,7 +6822,7 @@ abstract class CommonObject
$now=dol_now();
- $fieldvalues = $this->set_save_query();
+ $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification']=$this->db->idate($now);
if (array_key_exists('fk_user_modif', $fieldvalues) && ! ($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif']=$user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 2d5ba165365..8deb214782e 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1743,7 +1743,7 @@ class ExtraFields
*/
function showSeparator($key)
{
- $out = '
'.$this->attribute_label[$key].'
';
+ $out = '
'.$this->attribute_label[$key].'
';
return $out;
}
diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php
index aaae010c2fe..a79f01352e8 100644
--- a/htdocs/core/class/html.formaccounting.class.php
+++ b/htdocs/core/class/html.formaccounting.class.php
@@ -243,7 +243,7 @@ class FormAccounting extends Form
*
* @param string $selectid Preselected id or code of accounting accounts (depends on $select_in)
* @param string $htmlname Name of HTML field id. If name start with '.', it is name of HTML css class, so several component with same name in different forms can be used.
- * @param int $showempty Add an empty field
+ * @param int $showempty 1=Add an empty field, 2=Add an empty field+'None' field
* @param array $event Event options
* @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number
* @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number
@@ -253,7 +253,7 @@ class FormAccounting extends Form
*/
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='')
{
- global $conf;
+ global $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@@ -318,7 +318,12 @@ class FormAccounting extends Form
}
}
- $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
+ if ($showempty == 2)
+ {
+ $options['0'] = $langs->trans("None");
+ }
+
+ $out .= Form::selectarray($htmlname, $options, $selected, ($showempty > 0 ? 1 : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
return $out;
}
diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php
index e1ee7ae04ff..dba8c5d24e5 100644
--- a/htdocs/core/class/html.formbarcode.class.php
+++ b/htdocs/core/class/html.formbarcode.class.php
@@ -122,13 +122,13 @@ class FormBarCode
if ($useempty && $num > 0)
{
- print '