diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 537b6f76a63..5d7664b13aa 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -464,7 +464,7 @@ class Adherent extends CommonObject $action='update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $result=$this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 75f518074b1..ca8372c04ed 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -142,7 +142,7 @@ class AdherentType extends CommonObject /** * Met a jour en base donnees du type * - * @param User $user Object user making change + * @param User $user Object user making change * @param int $notrigger 1=do not execute triggers, 0 otherwise * @return int >0 if OK, < 0 if KO */ @@ -172,7 +172,7 @@ class AdherentType extends CommonObject $action='update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $result=$this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 7e3dfe28b0e..6312bc8494b 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -330,7 +330,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! if (! $error) { -// $db->commit(); + $db->commit(); } else { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 6bb1876b926..7693063a517 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -117,10 +117,10 @@ else if (GETPOST('downloadcsv','alpha')) $sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data"; $sql.= " FROM ".MAIN_DB_PREFIX."blockedlog"; $sql.= " WHERE entity = ".$conf->entity; - if (GETPOST('yeartoexport','int') > 0) + if (GETPOST('monthtoexport','int') > 0 || GETPOST('yeartoexport','int') > 0) { - $dates = dol_get_first_day(GETPOST('yeartoexport','int'), 1); - $datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12); + $dates = dol_get_first_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):1); + $datee = dol_get_last_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):12); $sql.= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'"; } $sql.= " ORDER BY rowid ASC"; // Required so we get the first one @@ -131,9 +131,16 @@ else if (GETPOST('downloadcsv','alpha')) { // Make the first fetch to get first line $obj = $db->fetch_object($res); - - $previoushash = $block_static->getPreviousHash(0, $obj->rowid); - $firstid = $obj->rowid; + if ($obj) + { + $previoushash = $block_static->getPreviousHash(0, $obj->rowid); + $firstid = $obj->rowid; + } + else + { // If not data found for filter, we do not need previoushash neither firstid + $previoushash = 'nodata'; + $firstid = ''; + } } else { @@ -144,14 +151,14 @@ else if (GETPOST('downloadcsv','alpha')) if (! $error) { - // Now restart request with all data + // Now restart request with all data = no limit(1) in sql request $sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data"; $sql.= " FROM ".MAIN_DB_PREFIX."blockedlog"; $sql.= " WHERE entity = ".$conf->entity; - if (GETPOST('yeartoexport','int') > 0) + if (GETPOST('monthtoexport','int') > 0 || GETPOST('yeartoexport','int') > 0) { - $dates = dol_get_first_day(GETPOST('yeartoexport','int'), 1); - $datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12); + $dates = dol_get_first_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):1); + $datee = dol_get_last_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):12); $sql.= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'"; } $sql.= " ORDER BY rowid ASC"; // Required so later we can use the parameter $previoushash of checkSignature() @@ -161,7 +168,7 @@ else if (GETPOST('downloadcsv','alpha')) { header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); - header("Content-disposition: attachment; filename=\"unalterable-log-archive-" .$dolibarr_main_db_name."-".(GETPOST('yeartoexport','int')>0?GETPOST('yeartoexport','int').'-':'').$previoushash. ".csv\""); + header("Content-disposition: attachment; filename=\"unalterable-log-archive-" .$dolibarr_main_db_name."-".(GETPOST('yeartoexport','int')>0 ? GETPOST('yeartoexport','int').(GETPOST('monthtoexport','int')>0?sprintf("%02d",GETPOST('monthtoexport','int')):'').'-':'').$previoushash. ".csv\""); print $langs->transnoentities('Id') .';'.$langs->transnoentities('Date') @@ -321,7 +328,20 @@ print '
'; print $langs->trans("RestrictYearToExport").': '; -print ''; +$smonth=GETPOST('monthtoexport','int'); +// Month +$retstring=''; +$retstring.='"; +print $retstring; +print ''; print ''; print ''; if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | '.$langs->trans('DownloadBlockChain').''; @@ -360,7 +380,7 @@ print ''; // User print ''; -print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200'); print ''; @@ -373,6 +393,7 @@ print ''; // Ref print ''; +// Link to ref print ''; // Amount @@ -463,7 +484,6 @@ if (is_array($blocks)) // User print ''; - //print $block->getUser() print $block->user_fullname; print ''; @@ -475,7 +495,7 @@ if (is_array($blocks)) print ''.$block->ref_object.''; // Link to source object - print ''.$object_link.''; + print ''.$object_link.''; // Amount print ''.price($block->amounts).''; @@ -484,8 +504,8 @@ if (is_array($blocks)) print ''.img_info($langs->trans('ShowDetails')).''; // Fingerprint - print ''; - print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint'); + print ''; + print $form->textwithpicto(dol_trunc($block->signature, '8'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint'.$block->id); print ''; // Status diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7ddeabb660b..daaf9cd01f9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -74,6 +74,7 @@ $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); $lineid = GETPOST('lineid', 'int'); $contactid = GETPOST('contactid','int'); +$projectid = GETPOST('projectid','int'); // PDF $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -1389,7 +1390,7 @@ if ($action == 'create') } $objectsrc->fetch_thirdparty(); - $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); + $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : 0); $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); @@ -1551,9 +1552,6 @@ if ($action == 'create') // Project if (! empty($conf->projet->enabled)) { - $projectid = GETPOST('projectid')?GETPOST('projectid'):0; - if ($origin == 'project') $projectid = ($originid ? $originid : 0); - $langs->load("projects"); print ''; print '' . $langs->trans("Project") . ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 9ebd4a85e5e..e49fe43e2c9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1464,6 +1464,8 @@ class Propal extends CommonObject */ function update(User $user, $notrigger=0) { + global $conf; + $error=0; // Clean parameters @@ -1512,17 +1514,23 @@ class Propal extends CommonObject $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) { - if (! $notrigger) + $result=$this->insertExtraFields(); + if ($result < 0) { - // Call trigger - $result=$this->call_trigger('PROPAL_MODIFY', $user); - if ($result < 0) $error++; - // End call triggers + $error++; } } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('PROPAL_MODIFY', $user); + if ($result < 0) $error++; + // End call triggers + } + // Commit or rollback if ($error) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3a83410580c..dc6e4aff17b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -78,13 +78,15 @@ $search_day=GETPOST("search_day","int"); $search_month=GETPOST("search_month","int"); $search_year=GETPOST("search_year","int"); $search_dayfin=GETPOST("search_dayfin","int"); -$search_monthfin=GETPOST("search_monthfin","int"); +$search_month_end=GETPOST("search_month_end","int"); $search_yearfin=GETPOST("search_yearfin","int"); $search_daydelivery=GETPOST("search_daydelivery","int"); $search_monthdelivery=GETPOST("search_monthdelivery","int"); $search_yeardelivery=GETPOST("search_yeardelivery","int"); $search_availability=GETPOST('search_availability','int'); $search_categ_cus=trim(GETPOST("search_categ_cus",'int')); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $viewstatut=GETPOST('viewstatut','alpha'); $optioncss = GETPOST('optioncss','alpha'); @@ -98,7 +100,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -214,7 +216,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_month=''; $search_day=''; $search_yearfin=''; - $search_monthfin=''; + $search_month_end=''; $search_dayfin=''; $search_yeardelivery=''; $search_monthdelivery=''; @@ -344,14 +346,14 @@ else if ($search_year > 0) { $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } -if ($search_monthfin > 0) +if ($search_month_end > 0) { if ($search_yearfin > 0 && empty($search_dayfin)) - $sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,$search_monthfin,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,$search_monthfin,false))."'"; + $sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,$search_month_end,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,$search_month_end,false))."'"; else if ($search_yearfin > 0 && ! empty($search_dayfin)) - $sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_monthfin, $search_dayfin, $search_yearfin))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_monthfin, $search_dayfin, $search_yearfin))."'"; + $sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_end, $search_dayfin, $search_yearfin))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_end, $search_dayfin, $search_yearfin))."'"; else - $sql.= " AND date_format(p.fin_validite, '%m') = '".$db->escape($search_monthfin)."'"; + $sql.= " AND date_format(p.fin_validite, '%m') = '".$db->escape($search_month_end)."'"; } else if ($search_yearfin > 0) { @@ -616,7 +618,7 @@ if ($resql) print ''; //print $langs->trans('Month').': '; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; //print ' '.$langs->trans('Year').': '; $formother->select_year($search_yearfin,'search_yearfin',1, 20, 5); print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index bbdc0f84caf..941c061eea1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3067,17 +3067,23 @@ class Commande extends CommonOrder $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) { - if (! $notrigger) + $result=$this->insertExtraFields(); + if ($result < 0) { - // Call trigger - $result=$this->call_trigger('ORDER_MODIFY', $user); - if ($result < 0) $error++; - // End call triggers + $error++; } } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('ORDER_MODIFY', $user); + if ($result < 0) $error++; + // End call triggers + } + // Commit or rollback if ($error) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1f2c98c29db..2ed616c90a0 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -78,6 +78,8 @@ $search_categ_cus=trim(GETPOST("search_categ_cus",'int')); $optioncss = GETPOST('optioncss','alpha'); $billed = GETPOST('billed','int'); $viewstatut=GETPOST('viewstatut'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $search_project_ref=GETPOST('search_project_ref','alpha'); // Security check @@ -92,7 +94,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 32c36b477a4..b09c0435bcd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1555,6 +1555,8 @@ class Facture extends CommonInvoice */ function update(User $user, $notrigger=0) { + global $conf; + $error=0; // Clean parameters @@ -1620,17 +1622,23 @@ class Facture extends CommonInvoice $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) { - if (! $notrigger) + $result=$this->insertExtraFields(); + if ($result < 0) { - // Call trigger - $result=$this->call_trigger('BILL_MODIFY',$user); - if ($result < 0) $error++; - // End call triggers + $error++; } } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('BILL_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + // Commit or rollback if ($error) { @@ -4843,7 +4851,7 @@ class FactureLigne extends CommonInvoiceLine $resql = $this->db->query($sql); if ($resql && $resql->num_rows > 0) { $res = $this->db->fetch_array($resql); - return $res['situation_percent']; + return floatval($res['situation_percent']); } else { $this->error = $this->db->error(); dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 251d2a01139..6ae531db133 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -88,13 +88,15 @@ $search_country=GETPOST("search_country",'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $search_user = GETPOST('search_user','int'); $search_sale = GETPOST('search_sale','int'); -$search_day = GETPOST('search_day','int'); +$search_day = GETPOST('search_day','int'); $search_month = GETPOST('search_month','int'); $search_year = GETPOST('search_year','int'); -$search_day_lim = GETPOST('search_day_lim','int'); +$search_day_lim = GETPOST('search_day_lim','int'); $search_month_lim = GETPOST('search_month_lim','int'); $search_year_lim = GETPOST('search_year_lim','int'); $search_categ_cus=trim(GETPOST("search_categ_cus",'int')); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $option = GETPOST('search_option'); if ($option == 'late') { @@ -106,7 +108,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (! $sortorder) $sortorder='DESC'; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 7ddf1a114cd..b08e2c3662e 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -45,7 +45,10 @@ $result = restrictedArea($user, 'prelevement', '', '', 'bons'); $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha')?GETPOST('mode','alpha'):'real'; $format = GETPOST('format','aZ09'); - +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +$page = GETPOST("page",'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; /* * Actions @@ -196,13 +199,33 @@ $sql.= " AND pfd.traite = 0"; $sql.= " AND pfd.fk_facture = f.rowid"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1,$offset); + $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; - print load_fiche_titre($langs->trans("InvoiceWaitingWithdraw").($num > 0?' ('.$num.')':''),'',''); + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if($socid) $param .= '&socid='.urlencode($socid); + if($option) $param .= "&option=".urlencode($option); + + if(! empty($page) && $num <= $nbtotalofrecords) $page = 0; + + print ''; + print ''; + print ''; + + print_barre_liste($langs->trans("InvoiceWaitingWithdraw"),$page,$_SERVER['PHP_SELF'],$param,'','','',$num,$nbtotalofrecords,'title_accountancy.png',0,'','', $limit); print ''; print ''; @@ -219,7 +242,7 @@ if ($resql) require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $bac = new CompanyBankAccount($db); - while ($i < $num && $i < 20) + while ($i < $num && $i < $limit) { $obj = $db->fetch_object($resql); @@ -260,6 +283,7 @@ if ($resql) } else print ''; print "
'.$langs->trans("None").'
"; + print ""; print "
\n"; } else diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 013751e8282..d7df30d5ee5 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -371,15 +371,12 @@ class Contact extends CommonObject $action='update'; // Actions on extra fields - if (! $error) + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + $result=$this->insertExtraFields(); + if ($result < 0) { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + $error++; } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 640793b7f37..a867d8937c9 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -925,16 +925,13 @@ class Contrat extends CommonObject } } - if (! $error) + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } } // Insert contacts commerciaux ('SALESREPSIGN','contrat') @@ -1283,18 +1280,7 @@ class Contrat extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { - // Call triggers - $result=$this->call_trigger('CONTRACT_MODIFY',$user); - if ($result < 0) { $error++; } - // End call triggers - } - } - - if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) { $result=$this->insertExtraFields(); if ($result < 0) @@ -1303,6 +1289,14 @@ class Contrat extends CommonObject } } + if (! $error && ! $notrigger) + { + // Call triggers + $result=$this->call_trigger('CONTRACT_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers + } + // Commit or rollback if ($error) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a58eb656a07..72ef472229d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7077,15 +7077,12 @@ abstract class CommonObject } // Update extrafield - if (! $error) + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + $result=$this->insertExtraFields(); + if ($result < 0) { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + $error++; } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 232458cb7de..1785e3ae810 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1083,7 +1083,11 @@ class Form else if (!is_array($selected)) $selected = array($selected); // Clean $filter that may contains sql conditions so sql code - if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3); + if (function_exists('test_sql_and_script_inject')) { + if (test_sql_and_script_inject($filter, 3)>0) { + $filter =''; + } + } // On recherche les societes $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; @@ -4972,6 +4976,7 @@ class Form } // Zone de saisie manuelle de la date + $retstring.='
'; $retstring.='trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript @@ -4995,6 +5000,7 @@ class Form $retstring.=''; } + $retstring.='
'; $retstring.=''."\n"; $retstring.=''."\n"; $retstring.=''."\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cf8c298f443..20f1645a109 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6354,7 +6354,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) $ret=''; // If order not defined, we use the setup - if ($nameorder < 0) $nameorder=$conf->global->MAIN_FIRSTNAME_NAME_POSITION; + if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?1:0); if ($nameorder && ((string) $nameorder != '2')) { $ret.=$firstname; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 047e7285b0d..74ab2d61b83 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1885,13 +1885,13 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) { $prev_progress = 0; $progress = 1; - if (method_exists($object, 'get_prev_progress')) + if (method_exists($object->lines[$i], 'get_prev_progress')) { $prev_progress = $object->lines[$i]->get_prev_progress($object->id); $progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100; } $result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs); - } + } else $result.=price($sign * $total_ht, 0, $outputlangs); } diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 6db325f8f55..7dd44aa1b0e 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -42,7 +42,7 @@ class modService extends DolibarrModules */ function __construct($db) { - global $conf; + global $conf, $mysoc; $this->db = $db; $this->numero = 53; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 92b3ea54a48..d936c01139f 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -67,7 +67,7 @@ class doc_generic_project_odt extends ModelePDFProjects function __construct($db) { global $conf,$langs,$mysoc; - + // Load traductions files requiredby by page $langs->loadLangs(array("companies", "main")); @@ -130,12 +130,9 @@ class doc_generic_project_odt extends ModelePDFProjects $array_key.'_statut'=>$object->getLibStatut() ); - // Retrieve extrafields - $extrafieldkey=$object->element; - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); - $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element,true); $object->fetch_optionals(); $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); @@ -154,7 +151,7 @@ class doc_generic_project_odt extends ModelePDFProjects { global $conf; - return array( + $resarray = array( 'task_ref'=>$task->ref, 'task_fk_project'=>$task->fk_project, 'task_projectref'=>$task->projectref, @@ -170,6 +167,16 @@ class doc_generic_project_odt extends ModelePDFProjects 'task_note_private'=>$task->note_private, 'task_note_public'=>$task->note_public ); + + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label($task->table_element,true); + $task->fetch_optionals($task->id,$extralabels); + + $resarray = $this->fill_substitutionarray_with_extrafields($task,$resarray,$extrafields,'task',$outputlangs); + + return $resarray; + } /** @@ -452,7 +459,7 @@ class doc_generic_project_odt extends ModelePDFProjects if (! is_object($outputlangs)) $outputlangs=$langs; $sav_charset_output=$outputlangs->charset_output; $outputlangs->charset_output='UTF-8'; - + // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 4974722166c..448b13f43fa 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -313,7 +313,7 @@ class Expedition extends CommonObject } // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { $result=$this->insertExtraFields(); if ($result < 0) @@ -541,8 +541,7 @@ class Expedition extends CommonObject */ $result=$this->fetch_thirdparty(); - // Retreive all extrafield - // fetch optionals attributes and labels + // Retreive extrafields $this->fetch_optionals(); /* @@ -2412,7 +2411,8 @@ class ExpeditionLigne extends CommonObjectLine if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet"); - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { $result=$this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 370fed20768..d14419f49b0 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -222,7 +222,7 @@ class Fichinter extends CommonObject if (! $resql) $error++; } - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { $result=$this->insertExtraFields(); if ($result < 0) @@ -285,6 +285,8 @@ class Fichinter extends CommonObject $this->fk_project = 0; } + $error = 0; + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; @@ -299,8 +301,16 @@ class Fichinter extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } - if (! $notrigger) + if (! $error && ! $notrigger) { // Call trigger $result=$this->call_trigger('FICHINTER_MODIFY',$user); @@ -372,8 +382,7 @@ class Fichinter extends CommonObject if ($this->statut == 0) $this->brouillon = 1; - // Retreive all extrafield - // fetch optionals attributes and labels + // Retreive extrafields $this->fetch_optionals(); /* diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 25f3118ad14..44ae098f195 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -79,6 +79,8 @@ $search_total_ttc=GETPOST('search_total_ttc','alpha'); $optioncss = GETPOST('optioncss','alpha'); $search_billed = GETPOST('search_billed','int'); $search_project_ref=GETPOST('search_project_ref','alpha'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $status=GETPOST('statut','alpha'); $viewstatut=GETPOST('viewstatut'); @@ -94,7 +96,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index b06d802fefd..98a6956a809 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -98,6 +98,8 @@ $day_lim = GETPOST('day_lim','int'); $month_lim = GETPOST('month_lim','int'); $year_lim = GETPOST('year_lim','int'); $toselect = GETPOST('toselect', 'array'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $option = GETPOST('option'); if ($option == 'late') { @@ -109,7 +111,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); -if ($page == -1 || $page == null) { $page = 0 ; } +if ($page == -1 || $page == null || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0 ; } $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 1b6046d50f8..fd050c4f772 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -452,10 +452,15 @@ if ($action == 'confirm_valid') $newSolde = $soldeActuel - ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); // On ajoute la modification dans le LOG - $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); - + $result=$object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); + if ($result<0) { + setEventMessages(null, $object->errors,'errors'); + } // Mise à jour du solde - $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); + $result=$object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); + if ($result<0) { + setEventMessages(null, $object->errors,'errors'); + } // To $destinataire = new User($db); diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index d2acd9873cb..3ab90c6d3fa 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -50,4 +50,4 @@ BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs modu BlockedLogDisableNotAllowedForCountry=List of countries where usage of this module is mandatory (just to prevent to disable the module by error, if your country is in this list, disable of module is not possible without editing this list first. Note also that enabling/disabling this module will keep a track into the unalterable log). OnlyNonValid=Non-valid TooManyRecordToScanRestrictFilters=Too many record to scan/analyze. Please restrict list with more restrictive filters. -RestrictYearToExport=Restrict year to export \ No newline at end of file +RestrictYearToExport=Restrict month / year to export \ No newline at end of file diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 823f4960bfd..d19f8f86732 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -933,7 +933,7 @@ class Product extends CommonObject $action='update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { $result=$this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index ef906c38704..2e8dfcb36fa 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -135,7 +135,7 @@ if (dol_strlen($type)) $sql.= " AND p.fk_product_type <> '1'"; } } -if ($sref) $sql.= natural_search('p.ref', $ref); +if ($sref) $sql.= natural_search('p.ref', $sref); if ($search_barcode) $sql.= natural_search('p.barcode', $search_barcode); if ($snom) $sql.= natural_search('p.label', $snom); if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 42a732fcb21..d088476ccc2 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -40,11 +40,13 @@ if (isset($_GET['connect'])){ { $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY; $service = 'StripeTest'; + $servicestatus = 0; } else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $service = 'StripeLive'; + $servicestatus = 1; } } else { @@ -52,11 +54,13 @@ else { { $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; $service = 'StripeTest'; + $servicestatus = 0; } else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY; $service = 'StripeLive'; + $servicestatus = 1; } } $payload = @file_get_contents("php://input"); @@ -224,19 +228,37 @@ elseif ($event->type == 'charge.failed') { } elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated==true)) { - $stripe=new Stripe($db); - $charge=$stripe->CreatePaymentStripe($event->data->object->amount/100,$event->data->object->currency,$event->data->object->metadata->source,$event->data->object->metadata->idsource,$event->data->object->id,$event->data->object->metadata->customer,$stripe->getStripeAccount($service)); + $fulltag=$event->data->object->metadata->FULLTAG; + // Save into $tmptag all metadata + $tmptag=dolExplodeIntoArray($fulltag,'.','='); + + if (! empty($tmptag['ORD'])){ + $order=new Commande($db); + $order->fetch('',$tmptag['ORD']); + $origin='order'; + $item=$order->id; + } elseif (! empty($tmptag['INV'])) { + $invoice = new Facture($db); + $invoice->fetch('',$tmptag['INV']); + $origin='invoice'; + $item=$invoice->id; + } + $stripe=new Stripe($db); + $stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here) + $stripecu = $stripe->getStripeCustomerAccount($tmptag['CUS'], $servicestatus); // Get thirdparty cu_... + $charge=$stripe->createPaymentStripe($event->data->object->amount/100,$event->data->object->currency,$origin,$item,$event->data->object->id,$stripecu,$stripeacc,$servicestatus); + if (isset($charge->id) && $charge->statut=='error'){ $msg=$charge->message; $code=$charge->code; $error++; - } - elseif (isset($charge->id) && $charge->statut=='success' && $event->data->object->metadata->source=='order') { - $order=new Commande($db); - $order->fetch($event->data->object->metadata->idsource); + } + elseif (isset($charge->id) && $charge->statut=='success' && (! empty($tmptag['ORD']))) { + //$order=new Commande($db); + //$order->fetch('',$tmptag['ORD']); $invoice = new Facture($db); - $idinv=$invoice->createFromOrder($order); + $idinv=$invoice->createFromOrder($order,$user); if ($idinv > 0) { @@ -262,7 +284,7 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type == if (!$error){ $datepaye = dol_now(); - $paiementcode ="CB"; + $paymentType ="CB"; $amounts=array(); $amounts[$invoice->id] = $total; $multicurrency_amounts=array(); @@ -271,7 +293,7 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type == $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Array with all payments dispatching $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching - $paiement->paiementid = dol_getIdFromCode($db,$paiementcode,'c_paiement'); + $paiement->paiementid = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); $paiement->num_paiement = $charge->message; $paiement->note = ''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a1e8ba0d906..c70d0a1a3e2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -754,6 +754,7 @@ class Societe extends CommonObject function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update', $nosyncmember=1) { global $langs,$conf,$hookmanager; + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (empty($id)) $id = $this->id; @@ -1053,7 +1054,7 @@ class Societe extends CommonObject $action='update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $result=$this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index a8ae45b317c..7b2272c407b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -90,6 +90,8 @@ $search_level_from = GETPOST("search_level_from","alpha"); $search_level_to = GETPOST("search_level_to","alpha"); $search_stcomm=GETPOST('search_stcomm','int'); $search_import_key = GETPOST("search_import_key","alpha"); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $type=GETPOST('type','alpha'); $optioncss=GETPOST('optioncss','alpha'); @@ -103,7 +105,7 @@ $sortorder=GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; -if (empty($page) || $page == -1) { $page = 0; } +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 54672da2b75..c3b6e4b3338 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1013,7 +1013,7 @@ class SupplierProposal extends CommonObject $action='update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { $result=$this->insertExtraFields(); if ($result < 0) @@ -1022,7 +1022,7 @@ class SupplierProposal extends CommonObject } } - if (! $erro && ! $notrigger) + if (! $error && ! $notrigger) { // Call trigger $result=$this->call_trigger('PROPAL_SUPPLIER_CREATE',$user); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 3dcf9601944..2fcb296b433 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -69,6 +69,8 @@ $search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha'); $search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int'); $object_statut=$db->escape(GETPOST('supplier_proposal_statut')); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); @@ -81,7 +83,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a126c1e942a..6205d42e1cf 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1611,7 +1611,7 @@ class User extends CommonObject $action='update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { $result=$this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index a33049ffbad..3212fe6fb6e 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -64,7 +64,9 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css') llxHeader('',$langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')','','',0,0,$arrayofjs,$arrayofcss); -print load_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
'); +$morehtmlright = ''.$langs->trans("ViewList").''; + +print load_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', $morehtmlright); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index f610d6b720e..088148ba4af 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -292,8 +292,9 @@ print ''; print ''; +$morehtmlright = ''.$langs->trans("HierarchicView").''; -print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit); +print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, $morehtmlright.' '.$newcardbutton, '', $limit); if ($sall) {