diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index a71b0eb5304..b2290b0f598 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -80,6 +80,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));
@@ -1360,7 +1361,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 : '');
@@ -1526,9 +1527,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 a8e51d32173..eb16e54bbbb 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -74,6 +74,8 @@ $search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_day=GETPOST("search_day","int");
$search_month=GETPOST("search_month","int");
$search_year=GETPOST("search_year","int");
+$search_btn=GETPOST('button_search','alpha');
+$search_remove_btn=GETPOST('button_removefilter','alpha');
$viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha');
@@ -87,7 +89,7 @@ $limit = GETPOST('limit')?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 c0cd1b49ce9..de7fbee450b 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -75,6 +75,8 @@ $search_total_ht=GETPOST('search_total_ht','alpha');
$optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int');
$viewstatut=GETPOST('viewstatut');
+$search_btn=GETPOST('button_search','alpha');
+$search_remove_btn=GETPOST('button_removefilter','alpha');
// Security check
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int'));
@@ -88,7 +90,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 3a0a75043f2..bc7a14c0c45 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -4813,7 +4813,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 4a58a921389..b813ed7c6da 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -89,12 +89,14 @@ $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_btn=GETPOST('button_search','alpha');
+$search_remove_btn=GETPOST('button_removefilter','alpha');
$option = GETPOST('option');
if ($option == 'late') {
@@ -106,7 +108,7 @@ $limit = GETPOST('limit')?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/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 377f2215b6d..fa8bba9b95b 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1900,13 +1900,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/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index be4f5898f85..ed0989e9139 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
@@ -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($object->id,$extralabels);
$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;
+
}
/**
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index aff104cf25f..8449181907c 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -85,6 +85,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');
@@ -100,7 +102,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 0876cfc7595..374ddcf3618 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -99,6 +99,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') {
@@ -110,7 +112,7 @@ $limit = GETPOST('limit')?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/product/reassort.php b/htdocs/product/reassort.php
index 295bf530f91..ccd01e56db7 100644
--- a/htdocs/product/reassort.php
+++ b/htdocs/product/reassort.php
@@ -134,7 +134,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 b6c3c2b1f10..b3348a1e528 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -87,6 +87,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');
$optioncss=GETPOST('optioncss','alpha');
@@ -100,7 +102,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 74ee17affd5..e5d4449c52d 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -73,6 +73,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"));
@@ -85,7 +87,7 @@ $limit = GETPOST('limit')?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;
|