diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 23958820b64..a264411c501 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -184,6 +184,8 @@ if ($action == 'validatehistory') {
} else {
$num_lines = $db->num_rows($result);
+ $facture_static = new Facture($db);
+
$isSellerInEEC = isInEEC($mysoc);
$thirdpartystatic = new Societe($db);
@@ -266,6 +268,18 @@ if ($action == 'validatehistory') {
}
}
+ // Manage Deposit
+ if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
+ if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
+ $accountdeposittoventilated = new AccountingAccount($db);
+ $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
+ $objp->code_sell_l = $accountdeposittoventilated->ref;
+ $objp->code_sell_p = '';
+ $objp->code_sell_t = '';
+ $objp->aarowid_suggest = $accountdeposittoventilated->rowid;
+ }
+ }
+
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 020fbab1e4d..abf5a8d4c2e 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -589,7 +589,28 @@ if ($result) {
}
//var_dump($return);
- if (!empty($code_sell_p)) {
+ // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ if (!empty($objp->company_code_sell)) {
+ $objp->code_sell_t = $objp->company_code_sell;
+ $objp->aarowid_suggest = $objp->aarowid_thirdparty;
+ $suggestedaccountingaccountfor = '';
+ }
+ }
+
+ // Manage Deposit
+ if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
+ if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
+ $accountdeposittoventilated = new AccountingAccount($db);
+ $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
+ $objp->code_sell_l = $accountdeposittoventilated->ref;
+ $objp->code_sell_p = '';
+ $objp->code_sell_t = '';
+ $objp->aarowid_suggest = $accountdeposittoventilated->rowid;
+ }
+ }
+
+ if (!empty($objp->code_sell_p)) {
// Value was defined previously
} else {
$code_sell_p_notset = 'color:orange';
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index d0776bc3459..0854b94bff2 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -195,9 +195,7 @@ foreach ($data as $val) {
}
print '
';
print '| ';
- //print '';
- print $year;
- //print '';
+ print ''.$year.'';
print ' | ';
print ''.$val['nb'].' | ';
print ''.price(price2num($val['total'], 'MT'), 1).' | ';
diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php
index 06ae59d64a3..ebd1269f74a 100644
--- a/htdocs/admin/resource.php
+++ b/htdocs/admin/resource.php
@@ -100,7 +100,7 @@ if (empty($conf->use_javascript_ajax)) {
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
print '';
print '';
- print '';
+ print '';
print ' | ';
}
print '
';
@@ -108,7 +108,7 @@ print '';
print '';
print '| '.$langs->trans('DisabledResourceLinkUser').' | ';
-print '';
+print ' | ';
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
print ' | ';
print ' | ';
@@ -117,7 +117,7 @@ print '
';
print '';
print '| '.$langs->trans('DisabledResourceLinkContact').' | ';
-print '';
+print ' | ';
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
print ' | ';
print ' | ';
@@ -126,7 +126,7 @@ print '
';
print '';
print '| '.$langs->trans('EnableResourceUsedInEventCheck').' | ';
-print '';
+print ' | ';
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
print ' | ';
print ' | ';
diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php
index fe64f37c805..73c71521603 100644
--- a/htdocs/core/boxes/box_members_subscriptions_by_year.php
+++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php
@@ -111,7 +111,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
- $year = dol_print_date($this->db->jdate($objp->dateh), "%Y", 'gmt');
+ $year = dol_print_date($this->db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
$tot += $objp->subscription;
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 07e9ba4f2b7..1d31c0cfc86 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -264,7 +264,7 @@ class Ldap
}
// Try in anonymous
if (!$this->bind) {
- dol_syslog(get_class($this)."::connect_bind try bind on ".$host, LOG_DEBUG);
+ dol_syslog(get_class($this)."::connect_bind try bind anonymously on ".$host, LOG_DEBUG);
$result = $this->bind();
if ($result) {
$this->bind = $this->result;
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index a30fa5f4f7e..1aecd205da3 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -318,10 +318,10 @@ abstract class DoliDB implements Database
/**
* Return first result from query as object
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
- * Dont add LIMIT to your query, it will be added by this method.
+ * Dont add LIMIT to your query, it will be added by this method
*
- * @param string $sql The sql query string
- * @return bool|object Result of fetch_object
+ * @param string $sql The sql query string
+ * @return bool|int|object False on failure, 0 on empty, object on success
*/
public function getRow($sql)
{
@@ -329,14 +329,19 @@ abstract class DoliDB implements Database
$res = $this->query($sql);
if ($res) {
- return $this->fetch_object($res);
+ $obj = $this->fetch_object($res);
+ if ($obj) {
+ return $obj;
+ } else {
+ return 0;
+ }
}
return false;
}
/**
- * return all results from query as an array of objects
+ * Return all results from query as an array of objects
* Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries
* be carefull with this method use it only with some limit of results to avoid performences loss.
*
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 6c152c5751e..f5064699eb2 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1008,7 +1008,7 @@ class CommandeFournisseur extends CommonOrder
if (empty($secondlevel)) { // standard or first level approval
$sql .= " date_approve='".$this->db->idate($now)."',";
$sql .= " fk_user_approve = ".$user->id;
- if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) {
+ if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $this->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) {
if (empty($this->user_approve_id2)) {
$movetoapprovestatus = false; // second level approval not done
$comment = ' (first level)';
diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php
index 4e7a5c57ae7..025ec2fbf70 100644
--- a/htdocs/resource/list.php
+++ b/htdocs/resource/list.php
@@ -61,50 +61,8 @@ $search_type = GETPOST("search_type", 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-
$filter = array();
-$param = '';
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
- $param .= '&contextpage='.urlencode($contextpage);
-}
-if ($limit > 0 && $limit != $conf->liste_limit) {
- $param .= '&limit='.urlencode($limit);
-}
-
-if ($search_ref != '') {
- $param .= '&search_ref='.urlencode($search_ref);
- $filter['t.ref'] = $search_ref;
-}
-if ($search_type != '') {
- $param .= '&search_type='.urlencode($search_type);
- $filter['ty.label'] = $search_type;
-}
-
-// Add $param from extra fields
-foreach ($search_array_options as $key => $val) {
- $crit = $val;
- $tmpkey = preg_replace('/search_options_/', '', $key);
- $typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey];
- if ($val != '') {
- $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
- }
- $mode_search = 0;
- if (in_array($typ, array('int', 'double', 'real'))) {
- $mode_search = 1; // Search on a numeric
- }
- if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') {
- $mode_search = 2; // Search on a foreign key int
- }
- if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1')) {
- $filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search);
- }
-}
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
- $param .= '&contextpage='.urlencode($contextpage);
-}
-
-
$hookmanager->initHooks(array('resourcelist'));
if (empty($sortorder)) {
@@ -159,9 +117,17 @@ if (empty($user->rights->resource->read)) {
/*
- * Action
+ * Actions
*/
+if (GETPOST('cancel', 'alpha')) {
+ $action = 'list';
+ $massaction = '';
+}
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
+ $massaction = '';
+}
+
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@@ -175,8 +141,42 @@ if ($reshook < 0) {
$form = new Form($db);
+//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
+$help_url = '';
$pagetitle = $langs->trans('ResourcePageIndex');
-llxHeader('', $pagetitle, '');
+llxHeader('', $pagetitle, $help_url);
+
+
+$sql = '';
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
+
+$param = '';
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+ $param .= '&contextpage='.urlencode($contextpage);
+}
+if ($limit > 0 && $limit != $conf->liste_limit) {
+ $param .= '&limit='.urlencode($limit);
+}
+
+if ($search_ref != '') {
+ $param .= '&search_ref='.urlencode($search_ref);
+ $filter['t.ref'] = $search_ref;
+}
+if ($search_type != '') {
+ $param .= '&search_type='.urlencode($search_type);
+ $filter['ty.label'] = $search_type;
+}
+
+// Including the previous script generate the correct SQL filter for all the extrafields
+// we are playing with the behaviour of the Dolresource::fetch_all() by generating a fake
+// extrafields filter key to make it works
+$filter['ef.resource'] = $sql;
+
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+
+// Add $param from extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
+
// Confirmation suppression resource line
if ($action == 'delete_resource') {
@@ -186,6 +186,7 @@ if ($action == 'delete_resource') {
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
+
print '