diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index dfde7ce613f..673ee198c6b 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/list.php b/htdocs/comm/propal/list.php
index 36cd98cd8a3..a40a6e25b97 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -85,6 +85,8 @@ $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;
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 0436c92f29f..3734ab18a93 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 93a97eaee1a..2329b1caeb0 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -4844,7 +4844,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 75dce3c01a3..6c39c0cd0a9 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 74bd282d606..9cc2cf77867 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 " \n";
}
else
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 83f613155aa..5c523e28753 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1078,7 +1078,11 @@ class Form
$outarray=array();
// 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";
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index c968be9c4c4..10dab38f8e2 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -6325,7 +6325,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 30d6b82bb21..c596e1c8ae0 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1875,13 +1875,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 df09d27ca51..90b530df262 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 2f393e50002..94729f5ec14 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/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 971f99717f4..590bf14949e 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 494c572eaad..2ac212527b3 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/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/societe/list.php b/htdocs/societe/list.php
index d0e7fd19062..8eb6bf447d6 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/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;
|