diff --git a/.travis.yml b/.travis.yml index 0696d8b4a03..bb6b774d9ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -269,12 +269,16 @@ script: cd htdocs/install php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log + php step5.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-3.log php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log php upgrade2.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-2.log + php step5.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-3.log php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log php upgrade2.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-2.log + php step5.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-3.log php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log php upgrade2.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-2.log + php step5.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-3.log cd - set +e echo diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab328c8e785..6a188d04abb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,7 +76,7 @@ Feel free to express technical details, use cases or anything relevant to the cu This section can span multiple lines. -Try to keep lines under 72 characters. +Try to keep lines under 120 characters. #### Samples
diff --git a/ChangeLog b/ChangeLog
index d2b0d63216a..8255f3ca5f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -148,6 +148,8 @@ NEW: Add restler framework. First step to build REST API into Dolibarr.
 
 WARNING: 
 
+Dolibarr 3.9 is not yet fully compatible with PHP 7.
+
 Following changes may create regression for some external modules, but were necessary to make
 Dolibarr better:
 - Deprecated Product::setPriceExpression. Use Product::update instead
diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt
index c7b5e0cd8fc..c5487f67273 100644
--- a/dev/dolibarr_changes.txt
+++ b/dev/dolibarr_changes.txt
@@ -62,6 +62,13 @@ In htdocs/includes/tcpdf/tcpdf.php
 * Renamed getmypid into dol_getmypid().
 
 
+To avoid to have QRcode changed because generated with a random mask, replace
+define('QR_FIND_FROM_RANDOM', 2);
+with
+define('QR_FIND_FROM_RANDOM', false);
+
+
+
 TCPDI:
 ------
 Add fpdf_tpl.php 1.2
diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index d1c4ef409b4..8213fed9d48 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -49,7 +49,7 @@ if (!$user->admin)
 
 $sortfield = GETPOST("sortfield", 'alpha');
 $sortorder = GETPOST("sortorder", 'sortorder');
-$limit = $conf->liste_limit;
+$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 $page = GETPOST("page", 'int');
 if ($page == - 1) {
 	$page = 0;
diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php
index 58cf5768595..2be16820445 100644
--- a/htdocs/accountancy/admin/productaccount.php
+++ b/htdocs/accountancy/admin/productaccount.php
@@ -72,10 +72,8 @@ $pagenext = $page + 1;
 // bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
 if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
 	$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
-	// } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
-	// $limit = $conf->liste_limit;
 } else {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 }
 $offset = $limit * $page;
 
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 951a07d3171..26a30171677 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -44,7 +44,7 @@ $search_doc_ref = GETPOST("search_doc_ref");
 $search_account = GETPOST("search_account");
 $search_thirdparty = GETPOST("search_thirdparty");
 $search_journal = GETPOST("search_journal");
-$limit = $conf->liste_limit;
+$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 
 if ($sortorder == "")
 	$sortorder = "ASC";
diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php
index fe185fd1118..c6a26755365 100644
--- a/htdocs/accountancy/bookkeeping/listbyyear.php
+++ b/htdocs/accountancy/bookkeeping/listbyyear.php
@@ -36,7 +36,7 @@ $langs->load("accountancy");
 $page = GETPOST("page");
 $sortorder = GETPOST("sortorder");
 $sortfield = GETPOST("sortfield");
-$limit = $conf->liste_limit;
+$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 
 // Filter
 $year = GETPOST("year", 'int');
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index a505c91c1c7..4c2b8ee7686 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -61,9 +61,9 @@ $pagenext = $page + 1;
 if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
 	$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
 } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 } else {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 }
 $offset = $limit * $page;
 
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 4800737528d..4361e730a26 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -65,9 +65,9 @@ if ($page < 0)
 if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
 	$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
 } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 } else {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 }
 $offset = $limit * $page;
 
@@ -169,9 +169,9 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
 if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
 	$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
 } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 } else {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 }
 
 $offset = $limit * $page;
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index e703bca6f2d..6c2dc69c22c 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -66,11 +66,11 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION))
 } 
 else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) 
 {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 } 
 else 
 {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 }
 if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
 
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index c94c8612535..d47c2c924c8 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -66,9 +66,9 @@ if ($page < 0)
 if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
 	$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
 } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 } else {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 }
 $offset = $limit * $page;
 
@@ -174,9 +174,9 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
 if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
 	$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
 } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 } else {
-	$limit = $conf->liste_limit;
+	$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
 }
 
 $offset = $limit * $page;
diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php
index dcf77a2dbad..d02ec100322 100644
--- a/htdocs/adherents/stats/byproperties.php
+++ b/htdocs/adherents/stats/byproperties.php
@@ -119,7 +119,7 @@ else
 print '';
 print '';
 print '';
-print '';
+print '';
 print '';
 print '';
 
@@ -135,7 +135,7 @@ foreach ($data as $val)
 	print '';
 	print '';
 	print '';
-	print '';
+	print '';
 	print '';
 	$oldyear=$year;
 }
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index dc5bf732103..83ceea04698 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -170,9 +170,9 @@ $data = $stats->getAllByYear();
 print '
'.$langs->trans("Nature").''.$langs->trans("NbOfMembers").''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").'
'.$memberstatic->getmorphylib($val['label']).''.$val['nb'].''.dol_print_date($val['lastdate'],'dayhour').''.dol_print_date($val['lastdate'],'dayhour').'
'; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 49d229898b8..ee27833b5b4 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -37,7 +37,7 @@ $page = GETPOST('page','int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="date"; if ($page < 0) { $page = 0; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page; if (! $user->admin) diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index cddd42a8623..c9e4211842d 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -39,7 +39,7 @@ $page = GETPOST("page",'int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="date"; if ($page < 0) { $page = 0; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page; if (! $user->admin) accessforbidden(); diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index d86a351cdff..1775c14767d 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2005 Brice Davoleau * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006-2014 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Florian Henry diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 9ffd7ac6401..715547c3311 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -36,6 +36,7 @@ $ref=GETPOST('ref'); $type=GETPOST('type'); $action=GETPOST('action'); $confirm=GETPOST('confirm'); +$cancel=GETPOST('cancel'); $socid=GETPOST('socid','int'); $label=GETPOST('label'); @@ -54,6 +55,10 @@ if ($id == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); +if ($id > 0) +{ + $result=$object->fetch($id); +} $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -61,52 +66,56 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('categorycard')); + /* * Actions */ +if ($cancel) +{ + header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); + exit; +} + // Action mise a jour d'une categorie if ($action == 'update' && $user->rights->categorie->creer) { - $categorie = new Categorie($db); - $result=$categorie->fetch($id); - - $categorie->label = $label; - $categorie->description = dol_htmlcleanlastbr($description); - $categorie->color = $color; - $categorie->socid = ($socid ? $socid : 'null'); - $categorie->visible = $visible; + $object->label = $label; + $object->description = dol_htmlcleanlastbr($description); + $object->color = $color; + $object->socid = ($socid ? $socid : 'null'); + $object->visible = $visible; if ($parent != "-1") - $categorie->fk_parent = $parent; + $object->fk_parent = $parent; else - $categorie->fk_parent = ""; + $object->fk_parent = ""; - if (empty($categorie->label)) + if (empty($object->label)) { $error++; $action = 'edit'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); } - if (! $error && empty($categorie->error)) + if (! $error && empty($object->error)) { - $ret = $extrafields->setOptionalsFromPost($extralabels,$categorie); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if ($ret < 0) $error++; - if (! $error && $categorie->update($user) > 0) + if (! $error && $object->update($user) > 0) { - header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$categorie->id.'&type='.$type); + header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); exit; } else { - setEventMessages($categorie->error, $categorie->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } else { - setEventMessages($categorie->error, $categorie->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -176,7 +185,7 @@ print '
'.$langs->trans("Year").''.$langs->trans("NbOfSubscriptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").''.$langs->trans("NbOfSubscriptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'; dol_fiche_end(); -print '
'; +print '
 
'; print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index ff585212dff..e57cd22d5fd 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -146,6 +146,7 @@ foreach($fulltree as $key => $val) { $categstatic->id=$val['id']; $categstatic->ref=$val['label']; + $categstatic->color=$val['color']; $categstatic->type=$type; $li=$categstatic->getNomUrl(1,'',60); $desc=dol_htmlcleanlastbr($val['description']); @@ -153,8 +154,8 @@ foreach($fulltree as $key => $val) $data[] = array( 'rowid'=>$val['rowid'], 'fk_menu'=>$val['fk_parent'], - 'entry'=>''. + 'entry'=>'
'.$li. - ''.dolGetFirstLineOfText($desc).'
'. + ''. ''. '
color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.''.dolGetFirstLineOfText($desc).''.img_view().'
' ); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 39f8d62fb7b..3b5d0b64a86 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Raphaël Doursenaud @@ -294,6 +294,7 @@ else print "\n"; } + // List of products or services (type is type of category) if ($object->type == Categorie::TYPE_PRODUCT) { @@ -339,7 +340,7 @@ if ($object->type == Categorie::TYPE_PRODUCT) $var=!$var; print "\t\n"; print ''; - print $prod->getNomUrl(1,'category'); + print $prod->getNomUrl(1); print "\n"; print ''.$prod->label."\n"; // Link to delete from category @@ -390,7 +391,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER) print "\t\n"; print ''; - print $soc->getNomUrl(1,'category_supplier'); + print $soc->getNomUrl(1); print "\n"; // Link to delete from category print ''; @@ -444,7 +445,7 @@ if($object->type == Categorie::TYPE_CUSTOMER) $var=!$var; print "\t\n"; print ''; - print $soc->getNomUrl(1,'category'); + print $soc->getNomUrl(1); print "\n"; // Link to delete from category print ''; @@ -497,7 +498,7 @@ if ($object->type == Categorie::TYPE_MEMBER) print "\t\n"; print ''; $member->ref=$member->login; - print $member->getNomUrl(1,0,'category'); + print $member->getNomUrl(1,0); print "\n"; print ''.$member->lastname."\n"; print ''.$member->firstname."\n"; @@ -526,7 +527,7 @@ if ($object->type == Categorie::TYPE_MEMBER) } } -//Categorie contact +// Categorie contact if($object->type == Categorie::TYPE_CONTACT) { $contacts = $object->getObjectsInCateg("contact"); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0f561622bd1..440a5d11833 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1081,8 +1081,10 @@ if ($id > 0) print ''; + print '

'; + print ''; // Thirdparty - Contact diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2324b6ee799..622e5445b1f 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -58,7 +58,7 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page","int"); if ($page == -1) { $page = 0; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="a.datec"; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 86978967970..bedf50f00b4 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -74,7 +74,7 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) { diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index a0f78608d04..4037d07de43 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -55,7 +55,7 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page","int"); if ($page == -1) { $page = 0; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="a.datec"; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 21e85c89756..6a33e83e585 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -41,7 +41,7 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="a.datep"; diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 7bdbaf99b80..4a90357ac4a 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -34,7 +34,7 @@ $page=GETPOST('page', 'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="p.name"; if ($page < 0) { $page = 0; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; $type=GETPOST('type', 'alpha'); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 20796db24f4..66474afea8e 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -32,7 +32,7 @@ $result=restrictedArea($user,'mailing'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 2237f41b299..55d8b49fa46 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -154,7 +154,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='p.datep'; if (! $sortorder) $sortorder='DESC'; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sql = 'SELECT'; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index f757a224266..04529dd2d9e 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -62,6 +62,7 @@ $formpropal=new FormPropal($db); $langs->load('propal'); $langs->load('other'); +$langs->load("companies"); llxHeader('', $langs->trans("ProposalsStatistics")); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b7caa472425..55b9e103474 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -67,7 +67,7 @@ $result = restrictedArea($user, 'commande', $id,''); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if ($page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index 5bdca142a91..81a1a493892 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -70,7 +70,7 @@ if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='b.dateo'; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index e192d1e9d82..c263cc99696 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -49,7 +49,7 @@ $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $page = $_GET["page"]; if ($page < 0) $page = 0; -//$limit = $conf->liste_limit; +//$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; //$offset = $limit * $page ; if (! $sortfield) $sortfield="cs.date_ech"; diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 0d9d63e8bb2..b83cdde2db9 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -45,7 +45,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="d.dated"; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; /* diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 7c849f67f50..a5684891ca8 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -46,7 +46,7 @@ $search_company=GETPOST('search_company','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if ($page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 531c05401ab..9ffbe111ea7 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacementstats.class.php'; $langs->load("trips"); +$langs->load("companies"); $WIDTH=DolGraph::getDefaultGraphSizeForStats('width'); $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 60f931ba90c..cc3d4200912 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2094,8 +2094,8 @@ class Facture extends CommonInvoice if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($fk_prev_id)) $fk_prev_id = 'null'; - if (is_null($situation_percent) || $situation_percent > 100) $situation_percent = 100; - + if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100; + $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); @@ -2282,7 +2282,7 @@ class Facture extends CommonInvoice if (empty($qty)) $qty=0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($special_code) || $special_code == 3) $special_code=0; - if ($situation_percent > 100 || is_null($situation_percent) || $situation_percent == "") $situation_percent = 100; + if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100; $remise_percent = price2num($remise_percent); $qty = price2num($qty); @@ -3881,7 +3881,8 @@ class FactureLigne extends CommonInvoiceLine if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_prev_id)) $this->fk_prev_id = 'null'; - if (empty($this->situation_percent)) $this->situation_percent = 0; + if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100; + if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin @@ -4076,9 +4077,9 @@ class FactureLigne extends CommonInvoiceLine if (empty($this->special_code)) $this->special_code=0; if (empty($this->product_type)) $this->product_type=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; - if (is_null($this->situation_percent)) $this->situation_percent=100; + if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100; if (empty($this->pa_ht)) $this->pa_ht=0; - + // Check parameters if ($this->product_type < 0) return -1; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 3f7aec9809f..5f17c5d49bb 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -48,7 +48,7 @@ if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; if ($sortorder == "") diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2c8bf65fe4a..a680886827a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -77,7 +77,7 @@ if ($option == 'late') $filter = 'paye:0'; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; @@ -743,7 +743,7 @@ if ($resql) print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDue"),$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PaymentModeShort"),$_SERVER["PHP_SELF"],"f.fk_reglement_mode","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PaymentModeShort"),$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Taxes'),$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); @@ -866,7 +866,7 @@ if ($resql) // Payment mode print ''; print ''; diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index b6044e75d67..cff600d3a57 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -545,7 +545,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield="f.date_lim_reglement"; if (! $sortorder) $sortorder="ASC"; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sql = "SELECT s.nom as name, s.rowid as socid, s.email"; $sql.= ", f.rowid as facid, f.facnumber, f.ref_client, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp"; @@ -605,7 +605,7 @@ if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; } $sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.ref_client, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp,"; -$sql.= " f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type, fk_mode_reglement"; +$sql.= " f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type, f.fk_mode_reglement"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " ORDER BY "; $listfield=explode(',',$sortfield); @@ -807,7 +807,7 @@ if ($resql) print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"f.fk_reglement_mode","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); @@ -941,7 +941,7 @@ if ($resql) // Payment mode print ''; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 393070d410b..655bed80031 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -673,7 +673,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (! GETPOST('action')) { if ($page == -1) $page = 0 ; - $limit = $conf->liste_limit; + $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) $sortorder='DESC'; diff --git a/htdocs/compta/paiement/avalider.php b/htdocs/compta/paiement/avalider.php index 6a891b72bda..02201093830 100644 --- a/htdocs/compta/paiement/avalider.php +++ b/htdocs/compta/paiement/avalider.php @@ -53,7 +53,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut"; $sql.=", c.libelle as paiement_type, p.num_paiement"; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 163f242b76d..e93ff737440 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -54,7 +54,7 @@ $page=GETPOST('page', 'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="b.dateo,b.rowid"; if ($page < 0) { $page = 0 ; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; $dir=$conf->banque->dir_output.'/bordereau/'; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index f4451178e71..5324a9f81db 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -43,7 +43,7 @@ $search_account = GETPOST('search_account','int'); $search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 35d0f838ff9..7e94a1f5448 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; -/** \class Paiement - * \brief Classe permettant la gestion des paiements des factures clients +/** + * Class to manage payments of customer invoices */ class Paiement extends CommonObject { @@ -78,7 +78,7 @@ class Paiement extends CommonObject * @param int $id Id of payment to get * @param string $ref Ref of payment to get (currently ref = id but this may change in future) * @param int $fk_bank Id of bank line associated to payment - * @return int <0 if KO, 0 if not found, >0 if OK + * @return int <0 if KO, 0 if not found, >0 if OK */ function fetch($id, $ref='', $fk_bank='') { @@ -96,14 +96,12 @@ class Paiement extends CommonObject else if ($fk_bank) $sql.= ' AND p.fk_bank = '.$fk_bank; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - - if ($result) + $resql = $this->db->query($sql); + if ($resql) { - if ($this->db->num_rows($result)) + if ($this->db->num_rows($resql)) { - $obj = $this->db->fetch_object($result); + $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; $this->ref = $obj->ref; $this->date = $this->db->jdate($obj->dp); @@ -120,12 +118,12 @@ class Paiement extends CommonObject $this->fk_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; - $this->db->free($result); + $this->db->free($resql); return 1; } else { - $this->db->free($result); + $this->db->free($resql); return 0; } } diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 0a5c2cd1572..3e70ac0c5bc 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -57,7 +57,7 @@ $search_amount=GETPOST("search_amount"); $search_company=GETPOST("search_company"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index ddff5dad895..f3312761141 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -46,7 +46,7 @@ if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if (! $sortfield) $sortfield="s.datep"; if (! $sortorder) $sortorder="DESC"; $optioncss = GETPOST('optioncss','alpha'); diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 6df15c9ba8e..dec724c95d5 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -46,7 +46,7 @@ if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if (! $sortfield) $sortfield="cs.date_ech"; if (! $sortorder) $sortorder="DESC"; diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 4156bc977a3..b603101ad29 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -49,7 +49,7 @@ if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if (! $sortfield) $sortfield="t.datev"; if (! $sortorder) $sortorder="DESC"; diff --git a/htdocs/compta/ventilation/fournisseur/list.php b/htdocs/compta/ventilation/fournisseur/list.php index 888f9152240..20ca396aa30 100644 --- a/htdocs/compta/ventilation/fournisseur/list.php +++ b/htdocs/compta/ventilation/fournisseur/list.php @@ -45,7 +45,7 @@ llxHeader('','Ventilation'); */ $page = $_GET["page"]; if ($page < 0) $page = 0; -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; $sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ttc as price, l.rowid, l.fk_code_ventilation "; diff --git a/htdocs/compta/ventilation/list.php b/htdocs/compta/ventilation/list.php index 264673049ad..fc022cade0d 100644 --- a/htdocs/compta/ventilation/list.php +++ b/htdocs/compta/ventilation/list.php @@ -47,7 +47,7 @@ llxHeader('','Ventilation'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 1da57afc2f6..d762b134b1c 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -288,17 +288,16 @@ if (empty($reshook)) // Photo save $dir = $conf->societe->dir_output."/contact/".$object->id."/photos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); + if (GETPOST('deletephoto') && $object->photo) + { + $fileimg=$dir.'/'.$object->photo; + $dirthumbs=$dir.'/thumbs'; + dol_delete_file($fileimg); + dol_delete_dir_recursive($dirthumbs); + $object->photo = ''; + } if ($file_OK) { - if (GETPOST('deletephoto')) - { - $fileimg=$dir.'/'.$object->photo; - $dirthumbs=$dir.'/thumbs'; - dol_delete_file($fileimg); - dol_delete_dir_recursive($dirthumbs); - $object->photo = ''; - } - if (image_format_supported($_FILES['photo']['name']) > 0) { dol_mkdir($dir); @@ -980,7 +979,7 @@ else print "
\n"; } print '
'; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none', '', -1); print ''.price($objp->total_ht,0,$langs).''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none', '', -1); print '
'; - if ($object->photo) print ''; + if ($object->photo) print ''; //print ''; print ''; print '
'.$langs->trans("Delete").'

'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index ac7411b49c3..c916710e087 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $begin=GETPOST('begin'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="p.lastname"; if ($page < 0) { $page = 0; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page; $langs->load("companies"); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index ef226d35908..22b619c599c 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -40,7 +40,7 @@ $sortfield=GETPOST('sortfield','alpha'); $sortorder=GETPOST('sortorder','alpha'); $page=GETPOST('page','int'); if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; $search_name=GETPOST('search_name'); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 1ce7c91343e..c59c67fe91c 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -38,7 +38,7 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0 ; } -$limit = $conf->liste_limit; +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; if (! $sortfield) $sortfield="c.rowid"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4b86fa378cd..bcdcdea6147 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1718,13 +1718,13 @@ class Form foreach ($scrit as $crit) { if ($i > 0) $sql.=" AND "; - $sql.="(p.ref LIKE '".$prefix.$crit."%' OR p.label LIKE '".$prefix.$crit."%'"; - if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$prefix.$crit."%'"; + $sql.="(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'"; + if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$db->escape($prefix.$crit)."%'"; $sql.=")"; $i++; } if (count($scrit) > 1) $sql.=")"; - if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$prefix.$filterkey."%'"; + if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'"; $sql.=')'; } $sql.= $db->order("p.ref"); @@ -2087,7 +2087,7 @@ class Form $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " AND p.tobuy = 1"; - if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; + if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$this->db->escape($filtertype); if (! empty($filtre)) $sql.=" ".$filtre; // Add criteria on ref/label if ($filterkey != '') @@ -2101,11 +2101,11 @@ class Form foreach ($scrit as $crit) { if ($i > 0) $sql.=" AND "; - $sql.="(pfp.ref_fourn LIKE '".$prefix.$crit."%' OR p.ref LIKE '".$prefix.$crit."%' OR p.label LIKE '".$prefix.$crit."%')"; + $sql.="(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%')"; $i++; } if (count($scrit) > 1) $sql.=")"; - if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$prefix.$filterkey."%'"; + if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; $sql.=')'; } $sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC"; @@ -2619,7 +2619,7 @@ class Form /** * Charge dans cache la liste des types de paiements possibles * - * @return int Nb of lines loaded, <0 if KO + * @return int Nb of lines loaded, <0 if KO */ function load_cache_types_paiements() { @@ -2632,9 +2632,9 @@ class Form $this->cache_types_paiements = array(); - $sql = "SELECT id, code, libelle as label, type"; + $sql = "SELECT id, code, libelle as label, type, active"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement"; - $sql.= " WHERE active > 0"; + //if ($active >= 0) $sql.= " WHERE active = ".$active; $resql = $this->db->query($sql); if ($resql) @@ -2651,6 +2651,7 @@ class Form $this->cache_types_paiements[$obj->id]['code'] =$obj->code; $this->cache_types_paiements[$obj->id]['label']=$label; $this->cache_types_paiements[$obj->id]['type'] =$obj->type; + $this->cache_types_paiements[$obj->id]['active'] =$obj->active; $i++; } @@ -2708,14 +2709,15 @@ class Form * * @param string $selected Id du mode de paiement pre-selectionne * @param string $htmlname Nom de la zone select - * @param string $filtertype To filter on field type in llx_c_paiement (array('code'=>xx,'label'=>zz)) + * @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz)) * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code * @param int $empty 1=peut etre vide, 0 sinon * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $maxlength Max length of label + * @param int $active Active or not, -1 = all * @return void */ - function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0) + function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1) { global $langs,$user; @@ -2732,6 +2734,9 @@ class Form if ($empty) print ''; foreach($this->cache_types_paiements as $id => $arraytypes) { + // If not good status + if ($active >= 0 && $arraytypes['active'] != $active) continue; + // On passe si on a demande de filtrer sur des modes de paiments particuliers if (count($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue; @@ -3685,9 +3690,10 @@ class Form * @param int $selected Id mode pre-selectionne * @param string $htmlname Name of select html field * @param string $filtertype To filter on field type in llx_c_paiement (array('code'=>xx,'label'=>zz)) + * @param int $active Active or not, -1 = all * @return void */ - function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='') + function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='', $active=1) { global $langs; if ($htmlname != "none") @@ -3697,7 +3703,7 @@ class Form print ''; print ''; print ''; print ''; print '
'; - $this->select_types_paiements($selected,$htmlname,$filtertype); + $this->select_types_paiements($selected,$htmlname,$filtertype,0,0,0,0,$active); print '
'; @@ -3707,7 +3713,6 @@ class Form if ($selected) { $this->load_cache_types_paiements(); - print $this->cache_types_paiements[$selected]['label']; } else { print " "; @@ -4909,7 +4914,7 @@ class Form $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text foreach($ways as $way) { - $toprint[] = '
  • color?' style="background: #'.$c->color.';"':'').'>'.img_object('','category').' '.$way.'
  • '; + $toprint[] = '
  • color?' style="background: #'.$c->color.';"':' style="background: #aaa"').'>'.img_object('','category').' '.$way.'
  • '; } } return '
      '.implode(' ', $toprint).'
    '; @@ -5323,7 +5328,7 @@ class Form { $ret.=''; } - $ret.='
    '.$morehtmlright.'
    '; + if ($morehtmlright) $ret.='
    '.$morehtmlright.'
    '; $ret.=''; return $ret; @@ -5381,19 +5386,15 @@ class Form $id = (! empty($object->id) ? $object->id : $object->rowid); $ret='';$dir='';$file='';$originalfile='';$altfile='';$email=''; - if ($modulepart=='societe') { $dir=$conf->societe->multidir_output[$entity]; - $smallfile=$object->logo; - $smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile); if (! empty($object->logo)) { - // TODO Introduce get_exdir - if ((string) $imagesize == 'mini') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_mini'); - else if ((string) $imagesize == 'small') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_small'); - else $file=$id.'/logos/thumbs/'.$smallfile; - $originalfile=$id.'/logos/thumbs/'.$smallfile; + if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs + else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_small'); + else $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; + $originalfile=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; } } else if ($modulepart=='contact') @@ -5401,11 +5402,10 @@ class Form $dir=$conf->societe->multidir_output[$entity].'/contact'; if (! empty($object->photo)) { - // TODO Introduce get_exdir - if ((string) $imagesize == 'mini') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_mini'); - else if ((string) $imagesize == 'small') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_small'); - else $file=$id.'/photos/'.$object->photo; - $originalfile=$id.'/photos/'.$object->photo; + if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_mini'); + else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_small'); + else $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; + $originalfile=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; } } else if ($modulepart=='userphoto') diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 0bb318df8da..4ecbef60b58 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -55,6 +55,8 @@ class FormOrder */ function selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status') { + $tmpsupplierorder=new CommandeFournisseur($db); + print ''; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 51cf8a9c7a7..d6f1521e49d 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -598,7 +598,7 @@ class FormOther include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $color = colorArrayToHex(colorStringToArray($color,array()),''); - if ($color) print ''; + if ($color) print ''; else print $textifnotdefined; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 82d5c52c575..fdb8b89f0f1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -908,7 +908,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } else { - if ($showimage) $morehtmlleft.='
    '.$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos).'
    '; + if ($showimage) $morehtmlleft.='
    '.$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos).'
    '; } if ($showbarcode) $morehtmlleft.='
    '.$form->showbarcode($object).'
    '; if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { @@ -3961,9 +3961,12 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart) else { // TODO - // We will introduce here a common way of forging path for document storage + // We will enhance here a common way of forging path for document storage // Here, object->id, object->ref and object->modulepart are required. - + if (in_array($modulepart, array('thirdparty','contact'))) + { + $path=$object->ref?$object->ref:$object->id; + } } if (empty($withoutslash) && ! empty($path)) $path.='/'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index aaa7738a9b1..62a92f4d5ac 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1008,17 +1008,16 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al { foreach($linkedobjects as $linkedobject) { + $reftoshow = $linkedobject["ref_title"].' : '.$linkedobject["ref_value"]; + if (! empty($linkedobject["date_value"])) + { + $reftoshow .= ' / '.$linkedobject["date_value"]; + } + $posy+=3; $pdf->SetXY($posx,$posy); $pdf->SetFont('','', $default_font_size - 2); - $pdf->MultiCell($w, $h, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', $align); - - if (! empty($linkedobject["date_title"]) && ! empty($linkedobject["date_value"])) - { - $posy+=3; - $pdf->SetXY($posx,$posy); - $pdf->MultiCell($w, $h, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', $align); - } + $pdf->MultiCell($w, $h, $reftoshow, '', $align); } } @@ -1826,10 +1825,11 @@ function pdf_getTotalQty($object,$type,$outputlangs) /** * Return linked objects + * FIXME This function returns only one link per link type instead of all links. If we fix this, we must also fix function pdf_writeLinkedObjects * * @param object $object Object * @param Translate $outputlangs Object lang for output - * @return array Linked objects + * @return array Linked objects */ function pdf_getLinkedObjects($object,$outputlangs) { diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index b3f3e16a3bd..e900931037e 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -98,6 +98,7 @@ function tree_showpad(&$fulltree,$key,$silent=0) /** * Recursive function to output menu tree.
    • ...
    + * It is also used for the tree of categories. * Note: To have this function working, check you have loaded the js and css for treeview. * $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', * '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); @@ -132,7 +133,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') print '
      '; } - if ($rang > 10) return; // Protection contre boucle infinie + if ($rang > 50) return; // Protect against infinite loop. Max 50 depth //ballayage du tableau $sizeoftab=count($tab); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index c1d13b49429..ed95bdc4023 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -410,7 +410,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print ''; } if ($edit) print '
      ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -430,7 +430,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY,array()),''); - if ($color) print ''; + if ($color) print ''; else print $langs->trans("Default"); } print '   ('.$langs->trans("Default").': ffffff, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -455,7 +455,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print ''; } if ($edit) print '
      ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -474,7 +474,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print $langs->trans("Default"); } print '   ('.$langs->trans("Default").': 7882aa, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -567,7 +567,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),''); if ($color) { - if ($color != 'edf4fb') print ''; + if ($color != 'edf4fb') print ''; else print $langs->trans("Default"); } else print $langs->trans("None"); @@ -595,7 +595,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; + if ($color) print ''; else print ''; } if ($edit) print '
      ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; @@ -614,7 +614,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''); - if ($color) print ''; + if ($color) print ''; else print $langs->trans("Default"); } print '   ('.$langs->trans("Default").': 000078, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index 98320a6f08b..692cf2aefab 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -142,7 +142,7 @@ class modSupplierProposal extends DolibarrModules $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=commercial', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry - 'titre'=>'supplier_proposalMENU_LEFT_TITLE', + 'titre'=>'SupplierProposalShort', 'leftmenu'=>'supplier_proposalsubmenu', 'url'=>'/supplier_proposal/index.php', 'langs'=>'supplier_proposal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. @@ -156,7 +156,7 @@ class modSupplierProposal extends DolibarrModules $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', 'type'=>'left', - 'titre'=>'supplier_proposalMENU_LEFT_TITLE_NEW', + 'titre'=>'SupplierProposalNew', 'url'=>'/supplier_proposal/card.php?action=create', 'langs'=>'supplier_proposal', 'enabled'=>'$conf->supplier_proposal->enabled', @@ -169,7 +169,7 @@ class modSupplierProposal extends DolibarrModules $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', 'type'=>'left', - 'titre'=>'supplier_proposalMENU_LEFT_TITLE_LIST', + 'titre'=>'List', 'url'=>'/supplier_proposal/list.php', 'langs'=>'supplier_proposal', 'enabled'=>'$conf->supplier_proposal->enabled', diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 2b201ae2f68..f6a076660d8 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -28,7 +28,7 @@ if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1; // If we force to use jmobile, then we reenable javascript if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1; -print top_htmlhead('',$langs->trans('Login').' '.$title); +print top_htmlhead('',$langs->trans('SendNewPassword')); ?> @@ -48,7 +48,7 @@ $(document).ready(function () {