';
- if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
+ if (empty($offset) && $num <= $limit) // If we have all record on same page, then the following test/warning can be done
+ {
+ if ($total != $object->amount) print img_warning("TotalAmountOfdirectDebitOrderDiffersFromSumOfLines");
+ }
print price($total);
print "
\n";
print '
';
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index c9dd592c6a9..92ba7f621cb 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -739,14 +739,13 @@ class BonPrelevement extends CommonObject
$sql = "SELECT count(f.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
- $sql.= " WHERE f.fk_statut = 1";
+ $sql.= " WHERE f.fk_statut = ".Facture::STATUS_VALIDATED;
$sql.= " AND f.entity IN (".getEntity('invoice').")";
$sql.= " AND f.rowid = pfd.fk_facture";
- $sql.= " AND f.paye = 0";
$sql.= " AND pfd.traite = 0";
$sql.= " AND f.total_ttc > 0";
- dol_syslog(get_class($this)."::SommeAPrelever");
+ dol_syslog(get_class($this)."::NbFactureAPrelever");
$resql = $this->db->query($sql);
if ( $resql )
@@ -759,7 +758,7 @@ class BonPrelevement extends CommonObject
}
else
{
- $this->error=get_class($this)."::SommeAPrelever Erreur -1 sql=".$this->db->error();
+ $this->error=get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
return -1;
}
}
@@ -1629,8 +1628,8 @@ class BonPrelevement extends CommonObject
public static function buildRumNumber($row_code_client, $row_datec, $row_drum)
{
global $langs;
- $pre = $langs->trans('RUM').'-';
- return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
+ $pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
+ return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index eaef92a1abc..dce08c5c66b 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
-$langs->loadLangs(array('banks', 'categories', 'widthdrawals', 'companies', 'bills'));
+$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills'));
// Security check
if ($user->societe_id) $socid=$user->societe_id;
@@ -105,6 +105,7 @@ if (empty($reshook))
/*
* View
*/
+
$form = new Form($db);
$thirdpartystatic=new Societe($db);
@@ -207,9 +208,11 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql.= " WHERE s.rowid = f.fk_soc";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
+$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
+$sql.= " AND f.total_ttc > 0";
$sql.= " AND pfd.traite = 0";
$sql.= " AND pfd.fk_facture = f.rowid";
-if ($socid) $sql.= " AND f.fk_soc = ".$socid;
+if ($socid > 0) $sql.= " AND f.fk_soc = ".$socid;
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@@ -293,7 +296,7 @@ if ($resql)
$i++;
}
}
- else print '
'.$langs->trans("None").'
';
+ else print '
'.$langs->trans("None").'
';
print "";
print "";
print " \n";
diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php
index 8f9df284291..a34fde042e5 100644
--- a/htdocs/compta/prelevement/demandes.php
+++ b/htdocs/compta/prelevement/demandes.php
@@ -35,31 +35,43 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
// Security check
$socid = GETPOST('socid', 'int');
+$status = GETPOST('status', 'int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
-// Get supervariables
-$page = GETPOST('page', 'int');
-$sortorder = GETPOST('sortorder', 'alpha');
-$sortfield = GETPOST('sortfield', 'alpha');
+$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search
+$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
+// Load variable for pagination
$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 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.ref";
+$massactionbutton = '';
+
/*
* View
*/
-llxHeader();
+if (!$status)
+{
+ $title = $langs->trans("RequestStandingOrderToTreat");
+}
+else
+{
+ $title = $langs->trans("RequestStandingOrderTreated");
+}
+
+llxHeader('', $title);
$thirdpartystatic=new Societe($db);
$invoicestatic=new Facture($db);
@@ -78,95 +90,126 @@ $sql.= " WHERE s.rowid = f.fk_soc";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
-if (!$statut) $sql.= " AND pfd.traite = 0";
-if ($statut) $sql.= " AND pfd.traite = ".$statut;
+if (!$status) $sql.= " AND pfd.traite = 0";
+if ($status) $sql.= " AND pfd.traite = ".$status;
+$sql.= " AND f.total_ttc > 0";
+$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
$sql.= " AND pfd.fk_facture = f.rowid";
if (dol_strlen(trim(GETPOST('search_societe', 'alpha'))))
{
$sql.= natural_search("s.nom", 'search_societe');
}
-$sql.= " ORDER BY $sortfield $sortorder ";
-$sql.= $db->plimit($limit+1, $offset);
+$sql.=$db->order($sortfield, $sortorder);
-$resql=$db->query($sql);
-if ($resql)
+
+// Count total nb of records
+$nbtotalofrecords = '';
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
- $num = $db->num_rows($resql);
- $i = 0;
-
- if (!$statut)
+ $resql = $db->query($sql);
+ $nbtotalofrecords = $db->num_rows($resql);
+ if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
{
- print_barre_liste($langs->trans("RequestStandingOrderToTreat"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
+ $page = 0;
+ $offset = 0;
}
- else
- {
- print_barre_liste($langs->trans("RequestStandingOrderTreated"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num);
- }
-
- print '';
+}
+// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
+if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
+{
+ $num = $nbtotalofrecords;
}
else
{
- dol_print_error($db);
+ $sql.= $db->plimit($limit+1, $offset);
+
+ $resql=$db->query($sql);
+ if (! $resql)
+ {
+ dol_print_error($db);
+ exit;
+ }
+
+ $num = $db->num_rows($resql);
}
+
+
+$newcardbutton = ''.$langs->trans("Back").'';
+
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit);
+
+print '';
+
+
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php
index 1be716f8f61..44db7dd2625 100644
--- a/htdocs/compta/prelevement/index.php
+++ b/htdocs/compta/prelevement/index.php
@@ -71,6 +71,7 @@ $thirdpartystatic=new Societe($db);
$invoicestatic=new Facture($db);
$bprev = new BonPrelevement($db);
+
print '
';
print '
'.$langs->trans("Statistics").'
';
@@ -100,6 +101,8 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX
$sql.= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql.= " WHERE s.rowid = f.fk_soc";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
+$sql.= " AND f.total_ttc > 0";
+$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
$sql.= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php
index 6594d7bb04a..f85f5656afe 100644
--- a/htdocs/core/modules/modReception.class.php
+++ b/htdocs/core/modules/modReception.class.php
@@ -58,7 +58,7 @@ class modReception extends DolibarrModules
// Data directories to create when module is enabled
$this->dirs = array("/reception/receipt",
"/reception/receipt/temp",
- "/doctemplates/reception"
+ "/doctemplates/receptions"
);
// Config pages
diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
index 23d000308ef..4a16724d614 100644
--- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php
+++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
@@ -121,15 +121,7 @@ class pdf_squille extends ModelePdfReception
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
- $outputlangs->load("main");
- $outputlangs->load("dict");
- $outputlangs->load("companies");
- $outputlangs->load("bills");
- $outputlangs->load("products");
- $outputlangs->load("propal");
- $outputlangs->load("deliveries");
- $outputlangs->load("receptions");
- $outputlangs->load("productbatch");
+ $outputlangs->loadLangs(array("main","dict","companies","bills","products","propal","deliveries","receptions","productbatch","sendings"));
$nblines = count($object->lines);
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index df29d329e0d..9be757cf87e 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -939,8 +939,16 @@ if ($id > 0 || ! empty($ref)) {
print '
';
print '
' . $langs->trans("Warehouse") . '
';
print '
' . $langs->trans("Comment") . '
';
- if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) || !empty($conf->reception->enabled))
+
+ // Status
+ if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && empty($reception->rowid)) {
print '
';
print "\n";
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 2207148e4ea..204d832a94c 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -55,13 +55,6 @@ $langs->load("holiday");
$childids = $user->getAllChildIds(1);
-$cancreate = 0;
-if (! empty($user->rights->holiday->write_all)) $cancreate=1;
-if (! empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate=1;
-
-$candelete = 0;
-if (! empty($user->rights->holiday->delete)) $candelete=1;
-
$morefilter = 'AND employee = 1';
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
@@ -82,6 +75,13 @@ if ($id > 0)
}
}
+$cancreate = 0;
+if (! empty($user->rights->holiday->write_all)) $cancreate=1;
+if (! empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate=1;
+
+$candelete = 0;
+if (! empty($user->rights->holiday->delete)) $candelete=1;
+if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1;
/*
* Actions
@@ -1435,7 +1435,7 @@ else
{
print 'id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'';
}
- if ($user->rights->holiday->delete && ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED)) // If draft or canceled or refused
+ if ($candelete && ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED)) // If draft or canceled or refused
{
print 'id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'';
}
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 494e7d4a8a3..a84a052094a 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1940,4 +1940,5 @@ RESTRICT_API_ON_IP=Allow available APIs to some host IP only (wildcard not allow
RESTRICT_ON_IP=Allow access to some host IP only (wildcard not allowed, use space between values). Empty means every hosts can access.
BaseOnSabeDavVersion=Based on the library SabreDAV version
NotAPublicIp=Not a public IP
-MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation.
\ No newline at end of file
+MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation.
+FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 397e562e265..a69947dfd8c 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -825,6 +825,7 @@ Mandatory=Mandatory
Hello=Hello
GoodBye=GoodBye
Sincerely=Sincerely
+ConfirmDeleteObject=Are you sure you want to delete this object?
DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this line?
NoPDFAvailableForDocGenAmongChecked=No PDF were available for the document generation among checked record
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 28c817658f6..72bc424c53c 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -256,7 +256,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete')
{
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline')
diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php
index 9601c661c70..2b66b76e9dd 100644
--- a/htdocs/reception/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php
@@ -1,6 +1,7 @@
- * Copyright (C) 2014 Marcos García
+/* Copyright (C) 2012 Regis Houssin
+ * Copyright (C) 2014 Marcos García
+ * Copyright (C) 2019 Laurent Destailleur
*
* 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
@@ -15,6 +16,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+
+// Protection to avoid direct call of template
+if (empty($conf) || ! is_object($conf))
+{
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
?>
@@ -22,41 +31,47 @@
load("receptions");
+$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
+
$total=0; $ilink=0;
-$var=true;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
- $trclass=($var?'pair':'impair');
+ $trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>