diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php
index df87efcd8c3..2d18568bf2d 100644
--- a/htdocs/api/class/api.class.php
+++ b/htdocs/api/class/api.class.php
@@ -65,6 +65,8 @@ class DolibarrApi
$this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
$this->r->setAPIVersion(1);
+ //$this->r->setSupportedFormats('json');
+ //$this->r->setSupportedFormats('jsonFormat');
}
/**
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index de7fbee450b..04ef69b2638 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -77,6 +77,7 @@ $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
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int'));
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index cd3aebf62f4..af49e849e9f 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -47,7 +47,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/contact/list.php b/htdocs/contact/list.php
index 1569eccd108..c63467390b4 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -418,6 +418,7 @@ print '';
print '';
print '';
+print '';
print '';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit);
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 6f07abd2c55..979dc7945fa 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -415,25 +415,25 @@ if (! $error && $massaction == 'confirm_presend')
if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYEMAIL';
if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYEMAIL';
if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_SENTBYEMAIL';
- if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYEMAIL';
+ if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYMAIL';
if ($triggername == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYEMAIL';
if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL';
if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYEMAIL';
if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYEMAIL';
- if (! empty($trigger_name))
+ if (! empty($triggername))
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
- $result=$interface->run_triggers($trigger_name, $objectobj, $user, $langs, $conf);
+ $result=$interface->run_triggers($triggername, $objectobj, $user, $langs, $conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
if ($error)
{
setEventMessages($db->lasterror(), $errors, 'errors');
- dol_syslog("Error in trigger ".$trigger_name.' '.$db->lasterror(), LOG_ERR);
+ dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR);
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index b84d31ddae3..b4426a02f74 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6291,7 +6291,7 @@ abstract class CommonObject
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
- if ($this->fields[$key]['notnull'] == 1 && ! isset($values[$key]) && is_null($val['default']))
+ if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && ! isset($values[$key]) && is_null($val['default']))
{
$error++;
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index e8ba9a538ec..9536b3f2768 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -727,6 +727,7 @@ class ExtraFields
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
+ if ($elementtype == 'order_supplier') $elementtype='commande_fournisseur';
$array_name_label=array();
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 776c04bfc41..5c7091ba6e3 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1070,7 +1070,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 d9c86dd45f4..f27c1fbf0a0 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5855,7 +5855,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/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 7c24e49e89b..cdd0929c74b 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -6,7 +6,7 @@
* Copyright (C) 2012 Christophe Battarel
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2015 Marcos García
- * Copyright (C) 2017 Ferran Marcet
+ * Copyright (C) 2017-2018 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -318,7 +318,7 @@ class pdf_einstein extends ModelePDFCommandes
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
{
- $tab_top = 88;
+ $tab_top = 88+$top_shift;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
@@ -353,7 +353,7 @@ class pdf_einstein extends ModelePDFCommandes
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
- $tab_top = 88 + $height_incoterms;
+ $tab_top = 88 + $top_shift + $height_incoterms;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 0e781044a18..392f2d9ed9b 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -7,7 +7,7 @@
* Copyright (C) 2012 Cédric Salvador
* Copyright (C) 2012-2014 Raphaël Doursenaud
* Copyright (C) 2015 Marcos García
- * Copyright (C) 2017 Ferran Marcet
+ * Copyright (C) 2017-2018 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -352,7 +352,7 @@ class pdf_crabe extends ModelePDFFactures
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
{
- $tab_top = 88;
+ $tab_top = 88+$top_shift;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
@@ -387,7 +387,7 @@ class pdf_crabe extends ModelePDFFactures
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
- $tab_top = 88 + $height_incoterms;
+ $tab_top = 88 +$top_shift + $height_incoterms;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php
index 7a9a3f4df3f..7302ebc673b 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/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 7be8b6a0d08..5e902ebdbc0 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -6,7 +6,7 @@
* Copyright (C) 2012 Christophe Battarel
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2015 Marcos García
- * Copyright (C) 2017 Ferran Marcet
+ * Copyright (C) 2017-2018 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -350,7 +350,7 @@ class pdf_azur extends ModelePDFPropales
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
{
- $tab_top = 88;
+ $tab_top = 88+$top_shift;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
@@ -393,7 +393,7 @@ class pdf_azur extends ModelePDFPropales
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
- $tab_top = 88 + $height_incoterms;
+ $tab_top = 88 +$top_shift + $height_incoterms;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 9f48d27ca00..cc54f7bed5b 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -988,6 +988,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled))
{
$projectid = GETPOST('projectid','int')?GETPOST('projectid','int'):0;
+ if(empty($projectid) && ! empty($object->fk_project)) $projectid = $object->fk_project;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load("projects");
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 374ddcf3618..9f4752a1cbb 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -70,14 +70,13 @@ $mode=GETPOST("mode");
$search_all = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_label = GETPOST("search_label","alpha");
-$search_company = GETPOST("search_company","alpha");
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
$search_product_category=GETPOST('search_product_category','int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
$search_refsupplier=GETPOST('search_refsupplier','alpha');
$search_project=GETPOST('search_project','alpha');
-$search_societe=GETPOST('search_societe','alpha');
+$search_company=GETPOST('search_company','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_vat=GETPOST('search_montant_vat','alpha');
$search_montant_localtax1=GETPOST('search_montant_localtax1','alpha');
@@ -207,7 +206,6 @@ if (empty($reshook))
$search_refsupplier="";
$search_label="";
$search_project='';
- $search_societe="";
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
@@ -310,13 +308,12 @@ if ($search_ref)
if ($search_ref) $sql .= natural_search('f.ref', $search_ref);
if ($search_refsupplier) $sql .= natural_search('f.ref_supplier', $search_refsupplier);
if ($search_project) $sql .= natural_search('p.ref', $search_project);
-if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
+if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
-if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total_ht', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total_tva', $search_montant_vat, 1);
if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1);
@@ -421,7 +418,7 @@ if ($resql)
{
$soc = new Societe($db);
$soc->fetch($socid);
- if (empty($search_societe)) $search_societe = $soc->name;
+ if (empty($search_company)) $search_company = $soc->name;
}
$param='&socid='.$socid;
@@ -626,7 +623,7 @@ if ($resql)
// Thirpdarty
if (! empty($arrayfields['s.nom']['checked']))
{
- print ' | ';
+ print ' | ';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print ' | ';
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index b19f63e0ab3..348edcac1e7 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/societe/consumption.php b/htdocs/societe/consumption.php
index 5ec8f35d1b3..3f1608b823e 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -296,6 +296,9 @@ if ($type_element == 'contract')
$thirdTypeSelect='customer';
}
+$parameters=array();
+$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
+
if (!empty($sql_select))
{
$sql = $sql_select;