From ffc861d4e2a5f5b75ccf52ee2b99ad676e04c82d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 18:04:22 +0100 Subject: [PATCH 1/7] FIX Autoadd product when barcode match Show barcode value in tooltips --- htdocs/takepos/ajax/ajax.php | 17 +++++++++--- htdocs/takepos/css/pos.css.php | 20 ++++++++++++-- htdocs/takepos/floors.php | 14 ++++++++++ htdocs/takepos/freezone.php | 4 +++ htdocs/takepos/index.php | 50 +++++++++++++++++++++++++++++----- htdocs/takepos/invoice.php | 5 ++++ htdocs/takepos/pay.php | 4 +++ htdocs/takepos/phone.php | 5 ++++ htdocs/takepos/receipt.php | 4 +++ htdocs/takepos/reduction.php | 4 +++ htdocs/takepos/send.php | 5 ++++ htdocs/takepos/smpcb.php | 12 +++++++- 12 files changed, 129 insertions(+), 15 deletions(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 07de9e50a51..56c30b69283 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -85,10 +85,10 @@ elseif ($action == 'search' && $term != '') { } } - $sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product as p'; + $sql = 'SELECT rowid, ref, label, tosell, tobuy, barcode, price FROM '.MAIN_DB_PREFIX.'product as p'; $sql .= ' WHERE entity IN ('.getEntity('product').')'; if ($filteroncategids) { - $sql.= ' AND rowid IN (SELECT DISTINCT fk_product FROM '.MAIN_DB_PREFIX.'categorie_product WHERE fk_categorie IN ('.$filteroncategids.'))'; + $sql.= ' AND EXISTS (SELECT cp.fk_product FROM '.MAIN_DB_PREFIX.'categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN ('.$filteroncategids.'))'; } $sql .= ' AND tosell = 1'; $sql .= natural_search(array('ref', 'label', 'barcode'), $term); @@ -96,8 +96,17 @@ elseif ($action == 'search' && $term != '') { if ($resql) { $rows = array(); - while ($row = $db->fetch_object($resql)) { - $rows[] = $row; + while ($obj = $db->fetch_object($resql)) { + $rows[] = array( + 'rowid' => $obj->rowid, + 'ref' => $obj->ref, + 'label' => $obj->label, + 'tosell' => $obj->tosell, + 'tobuy' => $obj->tobuy, + 'barcode' => $obj->barcode, + 'price' => $obj->price + //'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) + ); } echo json_encode($rows); } diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 32b7d7b7104..b541cdd6bad 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -286,7 +286,7 @@ div.paymentbordline .row1withhead{ margin: 0 auto; width: 100%; - height: calc(50% - 50px); + height: calc(45% - 50px); padding-top: 5px; } @@ -299,7 +299,7 @@ div.paymentbordline .row2withhead{ margin: 0 auto; width: 100%; - height: 50%; + height: 55%; } .div1{ @@ -488,6 +488,20 @@ div#moreinfo, div#infowarehouse { padding: 0 8px 0 8px; } +.productprice { + position: absolute; + top: 5px; + right: 5px; + background: var(--colorbackhmenu1); + color: var(--colortextbackhmenu); + font-size: 2em; + padding: 5px; + border-radius: 2px; + opacity: 0.9; + padding-left: 8px; + padding-right: 8px; +} + @media screen and (min-width: 892px) { .actionbutton{ @@ -561,7 +575,7 @@ div#moreinfo, div#infowarehouse { } .row1withhead{ - height: calc(50% - 100px); + height: calc(45% - 100px); } diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 6a067a76268..260813dd3b6 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -47,6 +47,15 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + +/* + * Actions + */ + if ($action == "getTables") { $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; @@ -81,6 +90,11 @@ if ($action == "add") $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } + +/* + * View + */ + // Title $title = 'TakePOS - Dolibarr '.DOL_VERSION; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index e8cce00abb3..5e58910928a 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -40,6 +40,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $idline = GETPOST('idline', 'int'); $action = GETPOST('action', 'alpha'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 9685e14ffd8..9615f90d539 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -263,6 +263,8 @@ function LoadProducts(position, issubcat) { if (currentcat==val.fk_parent) { $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(val.label); + $("#proprice"+ishow).attr("class", "hidden"); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); $("#prodiv"+ishow).data("iscat",1); @@ -281,6 +283,8 @@ function LoadProducts(position, issubcat) { if (typeof (data[idata]) == "undefined") { $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); + $("#proprice"+ishow).attr("class", "hidden"); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("title",""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); @@ -289,9 +293,17 @@ function LoadProducts(position, issubcat) { ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell) - var titlestring = 'transnoentities('Ref').': '); ?>'+data[idata]['ref']; + transnoentities('Ref').': ')."' + data[idata]['ref']"; + $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[idata]['barcode']"; + ?> + var titlestring = ; $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + if (data[parseInt(idata)]['price_formated']) { + $("#proprice"+ishow).attr("class", "productprice"); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + } $("#proimg"+ishow).attr("title", titlestring); $("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid", data[idata]['id']); @@ -337,6 +349,8 @@ function MoreProducts(moreorless) { if (typeof (data[idata]) == "undefined") { $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); + $("#proprice"+ishow).attr("class", ""); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product @@ -345,6 +359,10 @@ function MoreProducts(moreorless) { //Only show products with status=1 (for sell) $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + if (data[parseInt(idata)]['price_formated']) { + $("#proprice"+ishow).attr("class", "productprice"); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + } $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); @@ -462,7 +480,7 @@ function New() { * return {void} */ function Search2(keyCodeForEnter) { - console.log("Search2 Call ajax search to replace products"); + console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter); var search = false; var eventKeyCode = window.event.keyCode; @@ -477,20 +495,37 @@ function Search2(keyCodeForEnter) { for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined") { $("#prodesc" + i).text(""); + $("#proprice" + i).attr("class", "hidden"); + $("#proprice" + i).html(""); $("#proimg" + i).attr("src", "genimg/empty.png"); $("#prodiv" + i).data("rowid", ""); continue; } - var titlestring = 'transnoentities('Ref').': '); ?>' + data[i]['ref']; + transnoentities('Ref').': ')."' + data[i]['ref']"; + $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']"; + ?> + var titlestring = ; $("#prodesc" + i).text(data[i]['label']); $("#prodivdesc" + i).show(); + if (data[i]['price_formated']) { + $("#proprice" + i).attr("class", "productprice"); + $("#proprice" + i).html(data[i]['price_formated']); + } $("#proimg" + i).attr("title", titlestring); $("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']); $("#prodiv" + i).data("rowid", data[i]['rowid']); $("#prodiv" + i).data("iscat", 0); } }).always(function (data) { - if ($('#search').val().length > 0 && data.length == 1) ClickProduct(0); + // If there is only 1 answer + if ($('#search').val().length > 0 && data.length == 1) { + console.log($('#search').val()+' - '+data[0]['barcode']); + if ($('#search').val() == data[0]['barcode']) { + console.log("There is only 1 answer with barcode matching the search, so we add the product in basket"); + ClickProduct(0); + } + } }); } } @@ -924,15 +959,16 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { '; - echo ''; + print ''; } elseif ($count == ($MAXPRODUCT - 1)) { //echo ''; - echo ''; + print ''; } else { - echo ''; + print '
'; + print ''; } ?> diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3ca20a9ddee..bf68713a806 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -70,6 +70,11 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == '; } +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + /** * Abort invoice creationg with a given error message * diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index fb2442b5aba..f79e310f36b 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -38,6 +38,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $invoiceid = GETPOST('invoiceid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 5d0346a495c..c32561d3f52 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -48,6 +48,11 @@ if ($setterminal > 0) $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + /* * View */ diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 66043f7139c..31390c347bd 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -34,6 +34,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $facid = GETPOST('facid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index a2d57ea3a6e..613b78d5578 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -38,6 +38,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $invoiceid = GETPOST('invoiceid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php index 0b16f555e2f..8078ddc1787 100644 --- a/htdocs/takepos/send.php +++ b/htdocs/takepos/send.php @@ -37,6 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $invoiceid = GETPOST('facid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + /* * View */ diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php index 445bc6da9cc..6bf81b1cdf6 100644 --- a/htdocs/takepos/smpcb.php +++ b/htdocs/takepos/smpcb.php @@ -1,5 +1,15 @@ rights->takepos->run)) { + access_forbidden(); +} if (isset($_GET['status'])) { die(strtoupper($_SESSION['SMP_CURRENT_PAYMENT'])); From 01724894ad294df212dc90667d2015ad86201965 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 18:33:06 +0100 Subject: [PATCH 2/7] Fix useless BR --- htdocs/takepos/invoice.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index bf68713a806..9f0705b967d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -916,14 +916,16 @@ if ($placeid > 0) if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) { $tooltiptext = ''.$langs->trans("Ref").' : '.$line->product_ref.'
'; $tooltiptext .= ''.$langs->trans("Label").' : '.$line->product_label.'
'; - $tooltiptext .= '
'; - $tooltiptext .= $line->desc; + if ($line->product_label != $line->desc) { + if ($line->desc) $tooltiptext .= '
'; + $tooltiptext .= $line->desc; + } $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : $line->product_ref, $tooltiptext); } else { if ($line->product_label) $htmlforlines .= $line->product_label; - if ($line->product_label && $line->desc) $htmlforlines .= '
'; if ($line->product_label != $line->desc) { + if ($line->product_label && $line->desc) $htmlforlines .= '
'; $firstline = dolGetFirstLineOfText($line->desc, $conf->global->TAKEPOS_SHOW_N_FIRST_LINES); if ($firstline != $line->desc) { From 73f2e9e5de7538d372350f74f71da5a846c7fe38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 19:23:18 +0100 Subject: [PATCH 3/7] WIP migrate num_paiement into num_payment Fix label for free product in takepos --- htdocs/cashdesk/validation_verif.php | 1 + htdocs/compta/facture/class/facture.class.php | 6 ++-- htdocs/compta/paiement/list.php | 6 ++-- htdocs/compta/paiement/tovalidate.php | 4 +-- htdocs/compta/paiement_charge.php | 9 +++--- .../class/bonprelevement.class.php | 2 +- .../class/rejetprelevement.class.php | 1 + htdocs/compta/sociales/card.php | 4 +-- .../class/paymentsocialcontribution.class.php | 29 ++++++++++++++----- .../modules/rapport/pdf_paiement.class.php | 8 ++--- htdocs/expensereport/card.php | 3 +- .../class/api_supplier_invoices.class.php | 6 ++-- htdocs/fourn/facture/paiement.php | 8 +++-- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/public/payment/paymentok.php | 1 + htdocs/takepos/invoice.php | 13 +++++---- htdocs/webservices/server_payment.php | 18 ++++++------ 17 files changed, 70 insertions(+), 50 deletions(-) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b7b37054d91..7783bf7137a 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -305,6 +305,7 @@ switch ($action) $payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice(); $payment->paiementid=$invoice->mode_reglement_id; $payment->num_paiement=''; + $payment->num_payment=''; $paiement_id = $payment->create($user); if ($paiement_id > 0) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b0b78b3bf03..74d4c482c6a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2251,10 +2251,10 @@ class Facture extends CommonInvoice // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 - * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 + * Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1 + * or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 * - * @param User $user Objet utilisateur qui modifie + * @param User $user Object user that modify * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 926c0bfc87e..c78a010777a 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -115,7 +115,7 @@ if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code"; // Add fields from hooks $parameters=array(); @@ -133,7 +133,7 @@ if (GETPOST("orphelins", "alpha")) else { $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " s.rowid as socid, s.nom as name, s.email"; @@ -323,7 +323,7 @@ if ($resql) if (!$i) $totalarray['nbfield']++; // Payment number - print ''.$objp->num_paiement.''; + print ''.$objp->num_payment.''; if (!$i) $totalarray['nbfield']++; // Account diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index 7539d6165ea..c14c29f3179 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -64,7 +64,7 @@ if (! $sortfield) $sortfield="p.rowid"; llxHeader(); $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut"; -$sql.=", c.libelle as paiement_type, p.num_paiement"; +$sql.=", c.libelle as paiement_type, p.num_paiement as num_payment"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id"; if ($socid) { @@ -119,7 +119,7 @@ if ($resql) print ''; print ''.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp), 'day')."\n"; - print "$objp->paiement_type $objp->num_paiement\n"; + print "$objp->paiement_type $objp->num_payment\n"; print ''.price($objp->amount).''; print ''; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 561120aead6..31e13a9d356 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -108,9 +108,10 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y $paiement->chid = $chid; $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Tableau de montant - $paiement->paiementtype = $_POST["paiementtype"]; - $paiement->num_paiement = $_POST["num_paiement"]; - $paiement->note = $_POST["note"]; + $paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml'); + $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); + $paiement->note = GETPOST("note", 'none'); + $paiement->note_private = GETPOST("note", 'none'); if (!$error) { @@ -243,7 +244,7 @@ if ($action == 'create') print ''.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print ''; - print ''."\n"; + print ''."\n"; print ''; print ''.$langs->trans("Comments").''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 4050d081fe4..41f1ebf5a62 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -484,7 +484,7 @@ class BonPrelevement extends CommonObject $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice $paiement->paiementid = 3; // $paiement->num_payment = $this->ref; // Set ref of direct debit note - $paiement->num_paiement = $this->ref; // For bacward compatibility + $paiement->num_paiement = $this->ref; // For backward compatibility $paiement->id_prelevement = $this->id; $paiement_id = $paiement->create($user); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 740a1e47784..c78dbd06259 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -154,6 +154,7 @@ class RejetPrelevement $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; + $pai->num_payment = $fac->ref; if ($pai->create($this->user) < 0) // we call with no_commit { diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 69ad435c64c..d7f20622a43 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -603,7 +603,7 @@ if ($id > 0) /* * Payments */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql = "SELECT p.rowid, p.num_paiement as num_payment, datep as dp, p.amount,"; $sql .= " c.code as type_code,c.libelle as paiement_type,"; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -647,7 +647,7 @@ if ($id > 0) print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp), 'day')."\n"; $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; - print "".$labeltype.' '.$objp->num_paiement."\n"; + print "".$labeltype.' '.$objp->num_payment."\n"; if (!empty($conf->banque->enabled)) { $bankaccountstatic->id = $objp->baid; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 629a73578b2..02c15b099b9 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -69,8 +69,17 @@ class PaymentSocialContribution extends CommonObject */ public $fk_typepaiement; + /** + * @var string + * @deprecated + */ public $num_paiement; + /** + * @var string + */ + public $num_payment; + /** * @var int ID */ @@ -125,7 +134,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -149,11 +159,11 @@ class PaymentSocialContribution extends CommonObject if ($totalamount != 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,"; - $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)"; + $sql .= " fk_typepaiement, num_paiement as num_payment, note, fk_user_creat, fk_bank)"; $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaye)."',"; $sql .= " ".$totalamount.","; - $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.","; + $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.","; $sql .= " 0)"; $resql = $this->db->query($sql); @@ -231,7 +241,7 @@ class PaymentSocialContribution extends CommonObject $sql.= " t.datep,"; $sql.= " t.amount,"; $sql.= " t.fk_typepaiement,"; - $sql.= " t.num_paiement,"; + $sql.= " t.num_paiement as num_payment,"; $sql.= " t.note,"; $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; @@ -260,7 +270,8 @@ class PaymentSocialContribution extends CommonObject $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; $this->fk_typepaiement = $obj->fk_typepaiement; - $this->num_paiement = $obj->num_paiement; + $this->num_paiement = $obj->num_payment; + $this->num_payment = $obj->num_payment; $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; @@ -301,7 +312,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -511,8 +523,9 @@ class PaymentSocialContribution extends CommonObject $this->datep = ''; $this->amount = ''; $this->fk_typepaiement = ''; - $this->num_paiement = ''; - $this->note = ''; + $this->num_payment = ''; + $this->note_private = ''; + $this->note_public = ''; $this->fk_bank = ''; $this->fk_user_creat = ''; $this->fk_user_modif = ''; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 7393f0e198d..163ba420fc7 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -181,8 +181,7 @@ class pdf_paiement switch ($this->doc_type) { case "client": $sql = "SELECT p.datep as dp, f.ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -212,8 +211,7 @@ class pdf_paiement break; case "fourn": $sql = "SELECT p.datep as dp, f.ref as ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -257,7 +255,7 @@ class pdf_paiement $lines[$i][0] = $objp->ref; $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp), "day", false, $outputlangs, true); $lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code); - $lines[$i][3] = $objp->num_paiement; + $lines[$i][3] = $objp->num_payment; $lines[$i][4] = price($objp->paiement_amount); $lines[$i][5] = price($objp->facture_amount); $lines[$i][6] = price($objp->pf_amount); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 79e418206a5..77c2cf07f8e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2029,7 +2029,8 @@ else $paymentexpensereportstatic->id = $objp->rowid; $paymentexpensereportstatic->datepaye = $db->jdate($objp->dp); $paymentexpensereportstatic->ref = $objp->rowid; - $paymentexpensereportstatic->num_paiement = $objp->num_paiement; + $paymentexpensereportstatic->num_paiement = $objp->num_payment; + $paymentexpensereportstatic->num_payment = $objp->num_payment; $paymentexpensereportstatic->payment_code = $objp->payment_code; print ''; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 204471bc9e7..65ae5677c87 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -388,7 +388,7 @@ class SupplierInvoices extends DolibarrApi * @param int $paiementid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} - * @param string $num_paiement {@from body} Payment number (optional) + * @param string $num_payment {@from body} Payment number (optional) * @param string $comment {@from body} Note (optional) * @param string $chqemetteur {@from body} Payment issuer (mandatory if paiementcode = 'CHQ') * @param string $chqbank {@from body} Issuer bank name (optional) @@ -400,7 +400,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 */ - public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') + public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '') { global $conf; @@ -455,7 +455,7 @@ class SupplierInvoices extends DolibarrApi $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->paiementid = $paiementid; $paiement->paiementcode = dol_getIdFromCode($this->db, $paiementid, 'c_paiement', 'id', 'code', 1); - $paiement->num_payment = $num_paiement; + $paiement->num_payment = $num_payment; $paiement->note_public = $comment; $paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices=='yes'?1:0)); // This include closing invoices diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6c4f5ff95b1..f45160b427e 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -299,10 +299,12 @@ if (empty($reshook)) $paiement->multicurrency_amounts = $multicurrency_amounts; $paiement->paiementid = GETPOST('paiementid', 'int'); - $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml'); $paiement->note_private = GETPOST('comment', 'alpha'); - $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility - $paiement->note = $paiement->note_private; // For bacward compatibility + $paiement->num_paiement = $paiement->num_payment; // For backward compatibility + $paiement->num_payment = $paiement->num_payment; + $paiement->note = $paiement->note_private; // For backward compatibility + $paiement->note_private = $paiement->note_private; if (!$error) { diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 603f15d2779..ec86076ac22 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -16,6 +16,7 @@ AddThisArticle=Add this article RestartSelling=Go back on sell SellFinished=Sale complete PrintTicket=Print ticket +SendTicket=Send ticket NoProductFound=No article found ProductFound=product found NoArticle=No article diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 5029d717a10..28060a6d71e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -658,6 +658,7 @@ if ($ispaymentok) } $paiement->paiementid = $paymentTypeId; $paiement->num_paiement = ''; + $paiement->num_payment = ''; $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; $paiement->ext_payment_id = $TRANSACTIONID; $paiement->ext_payment_site = $service; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 9f0705b967d..a822e2f53e6 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -45,6 +45,12 @@ $idproduct = GETPOST('idproduct', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + + if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') { // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED @@ -70,11 +76,6 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == '; } -if (empty($user->rights->takepos->run)) { - access_forbidden(); -} - - /** * Abort invoice creationg with a given error message * @@ -920,7 +921,7 @@ if ($placeid > 0) if ($line->desc) $tooltiptext .= '
'; $tooltiptext .= $line->desc; } - $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : $line->product_ref, $tooltiptext); + $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); } else { if ($line->product_label) $htmlforlines .= $line->product_label; if ($line->product_label != $line->desc) diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index 3ccf3dafcaa..4f4490d4707 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -97,7 +97,7 @@ $server->wsdl->addComplexType( '', array( 'amount' => array('name'=>'amount','type'=>'xsd:double'), - 'num_paiement' => array('name'=>'num_paiement','type'=>'xsd:string'), + 'num_payment' => array('name'=>'num_payment','type'=>'xsd:string'), 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), 'bank_account' => array('name'=>'bank_account','type'=>'xsd:int'), 'payment_mode_id' => array('name'=>'payment_mode_id','type'=>'xsd:int'), @@ -167,14 +167,14 @@ function createPayment($authentication, $payment) $soc = new Societe($db); $res = $soc->fetch($payment['thirdparty_id']); - $new_payment = new Paiement($db); - $new_payment->amount = doubleval($payment['amount']); - $new_payment->num_paiement = $payment['num_paiement']; - $new_payment->bank_account = intval($payment['bank_account']); - $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; - $new_payment->datepaye = $now; - $new_payment->author = $payment['thirdparty_id']; - $new_payment->amounts = array(); + $new_payment = new Paiement($db); + $new_payment->amount = doubleval($payment['amount']); + $new_payment->num_payment = $payment['num_payment']; + $new_payment->fk_account = intval($payment['bank_account']); + $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; + $new_payment->datepaye = $now; + $new_payment->author = $payment['thirdparty_id']; + $new_payment->amounts = array(); if (intval($payment['invoice_id']) > 0) { $new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount; From 94750ed350c68a38b45a6f4de46138894f157765 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 01:31:48 +0100 Subject: [PATCH 4/7] css --- htdocs/core/class/html.formfile.class.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 2 ++ htdocs/theme/md/style.css.php | 1 + htdocs/website/index.php | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 111605d38b7..e84feb90601 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -125,7 +125,7 @@ class FormFile $out .= ''; } - $out .= ''; + $out .= '
'; $out .= ''; if (!empty($options)) $out .= ''; @@ -168,7 +168,7 @@ class FormFile $out .= ''; } - $out .= 'global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple'); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""'); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2bf5824477c..be847c73147 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1165,6 +1165,7 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth250onsmartphone { max-width: 250px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } @@ -4161,6 +4162,7 @@ span[phptag] { background: #e6e6e6; display: inline-block; padding: 4px 0 4px 0; + z-index: 250; } .websitebar .buttonDelete, .websitebar .button { text-shadow: none; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8ad0df866c7..4715f6b72a9 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1245,6 +1245,7 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth250onsmartphone { max-width: 250px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e8732c04673..2613d506c0b 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2074,7 +2074,7 @@ if (!GETPOST('hide_websitemenu')) // List of website print ''; $out = ''; - $out .= ''; if (empty($object->records)) $out .= ''; // Loop on each sites $i = 0; @@ -2260,7 +2260,7 @@ if (!GETPOST('hide_websitemenu')) if ($action != 'addcontainer') { - print ''.$formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action).''; + print ''.$formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'maxwidth200onsmartphone').''; } else { From 42271bb7680ee09efa06f8e4df94aad6076ca6ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 02:30:19 +0100 Subject: [PATCH 5/7] CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index be847c73147..03ef2191a50 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1289,7 +1289,7 @@ td.showDragHandle { .side-nav-vert { position: sticky; top: 0px; - z-index: 210; + z-index: 1001; } @@ -4162,7 +4162,7 @@ span[phptag] { background: #e6e6e6; display: inline-block; padding: 4px 0 4px 0; - z-index: 250; + z-index: 1000; } .websitebar .buttonDelete, .websitebar .button { text-shadow: none; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 4715f6b72a9..33b9635bb68 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1440,7 +1440,7 @@ body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block .side-nav-vert { position: sticky; top: 0px; - z-index: 210; + z-index: 1001; } From 5f255a6c14ae852046561f6616aed747fc837c06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 03:24:24 +0100 Subject: [PATCH 6/7] A new way to navigate between pages in list is available --- ChangeLog | 5 ++++- htdocs/contact/list.php | 6 +++--- htdocs/core/lib/functions.lib.php | 7 ++++--- htdocs/societe/list.php | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0483767ac50..6f48691d299 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,10 @@ For Users: NEW: Module MO (Manufacturing Order) is available as stable module. For Developers or integrators: - +* A new way to navigate between pages in list is available. To use it, you must + - replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); + - remove input field in form '';' + - add parameter $pagenavastextinput to value 1 when calling print_barre_liste WARNING: diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0335e203049..d7a8d025e21 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -108,7 +108,7 @@ $userid = GETPOST('userid', 'int'); $begin = GETPOST('begin'); if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "p.lastname"; -if (empty($page) || $page < 0) { $page = 0; } +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } $offset = $limit * $page; $titre = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); @@ -497,11 +497,11 @@ print ''; print ''; print ''; print ''; -print ''; +//print ''; print ''; print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "contact"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8434755bef1..d544ffd6949 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4361,7 +4361,8 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', if ($cpt == $page) { $pagelist .= ''; - if (($cpt + 1) < $nbpages) $pagelist .= '/'; + $pagelist .= '/'; + //if (($cpt + 1) < $nbpages) $pagelist .= '/'; } } else { if ($cpt == $page) @@ -4386,9 +4387,9 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', } } else { //var_dump($page.' '.$cpt.' '.$nbpages); - if (($page + 1) < $nbpages) { + //if (($page + 1) < $nbpages) { $pagelist .= ''; - } + //} } } else diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bf261a8076e..04ad577bff9 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -111,7 +111,7 @@ $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "s.nom"; -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $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; From 4f442905b2579aa96944df004b0ae4d6bc545e2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 03:31:58 +0100 Subject: [PATCH 7/7] A new way to navigate between pages in list is available --- htdocs/modulebuilder/template/myobject_list.php | 4 ++-- htdocs/product/list.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index e451a627d69..6697fd15da1 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -86,7 +86,7 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -367,7 +367,7 @@ print ''; print ''; print ''; -print ''; +//print ''; print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ae89e4c558c..a37acf91ebe 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -87,8 +87,8 @@ $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user- $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); -$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $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; @@ -536,11 +536,11 @@ if ($resql) print ''; print ''; print ''; - print ''; + //print ''; print ''; if (empty($arrayfields['p.fk_product_type']['checked'])) print ''; - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "product";
'.$options.'