From 895367060ced1d7c328d473f6afa09b9df0a020d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 9 Mar 2019 05:31:05 +0100 Subject: [PATCH 001/222] Fix some small error --- htdocs/accountancy/class/accountancysystem.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 65852258867..d27ede36d12 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -142,12 +142,12 @@ class AccountancySystem $result = $this->rowid; } else { $result = - 2; - $this->error = "AccountancySystem::Create Erreur $result"; + $this->error = "AccountancySystem::Create Error $result"; dol_syslog($this->error, LOG_ERR); } } else { $result = - 1; - $this->error = "AccountancySystem::Create Erreur $result"; + $this->error = "AccountancySystem::Create Error $result"; dol_syslog($this->error, LOG_ERR); } From d8223bfe98e98645adc55b79d9118451bd64d05d Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Mon, 11 Mar 2019 18:03:39 +0100 Subject: [PATCH 002/222] init dropdown --- htdocs/main.inc.php | 70 ++++++++++++++++++- htdocs/theme/eldy/_dropdown.css.php | 101 ++++++++++++++++++++++++++++ htdocs/theme/eldy/_global.css.php | 37 +++++++--- 3 files changed, 198 insertions(+), 10 deletions(-) create mode 100644 htdocs/theme/eldy/_dropdown.css.php diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4a85cd8ddab..52f360d57a5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1602,7 +1602,13 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead // Login name with photo and tooltip $mode=-1; $toprightmenu.='
'; $toprightmenu.=''."\n"; @@ -1714,6 +1720,68 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } + +function top_menu_user(user $user, $langs){ + + $userImage = $userDropDownImage = ''; + if (! empty($user->photo)) + { + $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); + $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); + } + + + $btnUser = ' + + '; + + + return $btnUser; +} + /** * Show left menu bar * diff --git a/htdocs/theme/eldy/_dropdown.css.php b/htdocs/theme/eldy/_dropdown.css.php new file mode 100644 index 00000000000..c6ad165fc00 --- /dev/null +++ b/htdocs/theme/eldy/_dropdown.css.php @@ -0,0 +1,101 @@ + +/* + use_javascript_ajax)) +{ + print "\n".''."\n"; + print ''."\n"; +} + print '
'; print ''; print ''; @@ -387,8 +390,22 @@ if ($placeid > 0) { if ($line->special_code == "3") { print ' order'; } - print '" id="' . $line->rowid . '">'; - print ''; print ''; diff --git a/htdocs/takepos/js/takepos.js b/htdocs/takepos/js/takepos.js deleted file mode 100644 index 062a3bb4e4a..00000000000 --- a/htdocs/takepos/js/takepos.js +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (C) 2018 Charles-FR BENKE - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index e02f14d8384..9262e8aff43 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -31,7 +31,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $place = GETPOST('place', 'int'); @@ -61,9 +61,8 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> - - + '."\n"; } + print '
'; print '
' . $line->product_label . $line->desc; + print '" id="' . $line->id . '">'; + print ''; + print $line->product_label; + if ($line->product_label && $line->desc) print '
'; + if ($line->product_label != $line->desc) + { + $firstline = dolGetFirstLineOfText($line->desc); + if ($firstline != $line->desc) + { + print $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); + } + else + { + print $line->desc; + } + } if (!empty($line->array_options['options_order_notes'])) echo "
(".$line->array_options['options_order_notes'].")"; print '
' . $line->qty . '
'; print ''; -print ''; +print ''; print ''; print ''; print ''; print "\n"; -if ($placeid > 0) { - foreach($invoice->lines as $line) +if ($placeid > 0) +{ + $tmplines = array_reverse($invoice->lines); + foreach($tmplines as $line) { - print 'special_code == "3") { - print ' order'; + $htmlforlines.= ' order'; } - print '" id="' . $line->id . '">'; - print ''; - print ''; - print ''; - print ''; - print ''; + if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + + print $htmlforlines; } } print '
' . $langs->trans('Description') . ''; +print ''; +if ($conf->global->TAKEPOS_BAR_RESTAURANT) +{ + $sql="SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place); + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) + { + $label = $obj->label; + $floor = $obj->floor; + } + print $langs->trans('Place')." ".$label." - "; + print $langs->trans('Floor')." ".$floor." - "; +} +print $langs->trans('TotalTTC'); +print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; +print '' . $langs->trans('ReductionShort') . '' . $langs->trans('Qty') . '' . $langs->trans('TotalHTShort') . '
'; - print $line->product_label; - if ($line->product_label && $line->desc) print '
'; + $htmlforlines.= '" id="' . $line->id . '">'; + $htmlforlines.= '
'; + $htmlforlines.= $line->product_label; + if ($line->product_label && $line->desc) $htmlforlines.= '
'; if ($line->product_label != $line->desc) { $firstline = dolGetFirstLineOfText($line->desc); if ($firstline != $line->desc) { - print $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); + $htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } else { - print $line->desc; + $htmlforlines.= $line->desc; } } - if (!empty($line->array_options['options_order_notes'])) echo "
(".$line->array_options['options_order_notes'].")"; - print '
' . vatrate($line->remise_percent, true) . '' . $line->qty . '' . price($line->total_ttc) . '
' . vatrate($line->remise_percent, true) . '' . $line->qty . '' . price($line->total_ttc) . '
'; -print '

'.$langs->trans('TotalTTC'); - -if ($conf->global->TAKEPOS_BAR_RESTAURANT) print " ".$langs->trans('Place')." ".$place; - -print ': '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' 

'; - if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY) { $soc = new Societe($db); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 6dd80bed342..fed57dcf068 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -34,7 +34,9 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; -$place = GETPOST('place', 'int'); +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS + $invoiceid = GETPOST('invoiceid', 'int'); @@ -51,15 +53,18 @@ else { $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); - $row = $db->fetch_array($resql); - $placeid=$row[0]; - if (! $placeid) + $obj = $db->fetch_object($resql); + if ($obj) { - $placeid=0; // Invoice does not exist yet + $invoiceid = $obj->rowid; + } + if (! $invoiceid) + { + $invoiceid=0; // Invoice does not exist yet } else { - $invoice->fetch($placeid); + $invoice->fetch($invoiceid); } } diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index fb23120623a..7e560a0d40f 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -24,19 +24,27 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->loadLangs(array("main", "cashdesk")); +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS + +$facid=GETPOST('facid', 'int'); + + /* * View */ top_httphead('text/html'); -$facid=GETPOST('facid', 'int'); -$place=GETPOST('place', 'int'); -if ($place>0){ +if ($place > 0) +{ $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); - $row = $db->fetch_array($resql); - $facid=$row[0]; + $obj = $db->fetch_object($resql); + if ($obj) + { + $facid=$obj->rowid; + } } $object=new Facture($db); $object->fetch($facid); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index fb0b0073510..bb57baaf04d 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -32,8 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$place = GETPOST('place', 'int'); -if ($place=="") $place="0"; +$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS + $action = GETPOST('action', 'alpha'); $langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter")); @@ -259,7 +260,7 @@ function ClickProduct(position) { if (idproduct=="") return; // Call page invoice.php to generate the section with product lines $("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } } From 9105e205ff1e8a23bab342804da417cf87e7077c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 20:20:39 +0100 Subject: [PATCH 179/222] No more need to set scroolTop, lines are sorted with last added first --- htdocs/takepos/customers.php | 2 +- htdocs/takepos/invoice.php | 68 ++++++++++++++++++++---------------- htdocs/takepos/pay.php | 2 +- htdocs/takepos/takepos.php | 18 +++++----- 4 files changed, 49 insertions(+), 41 deletions(-) diff --git a/htdocs/takepos/customers.php b/htdocs/takepos/customers.php index 46e06365a93..05fdf5537c9 100644 --- a/htdocs/takepos/customers.php +++ b/htdocs/takepos/customers.php @@ -61,7 +61,7 @@ if ($action=="change") { ?> diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 4b6aebbe80c..3c39b7e1e4e 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -407,39 +407,47 @@ print "\n"; if ($placeid > 0) { - $tmplines = array_reverse($invoice->lines); - foreach($tmplines as $line) + if (is_array($invoice->lines) && count($invoice->lines)) { - $htmlforlines = ''; - - $htmlforlines.= 'id . '">'; - $htmlforlines.= ''; - $htmlforlines.= $line->product_label; - if ($line->product_label && $line->desc) $htmlforlines.= '
'; - if ($line->product_label != $line->desc) + $tmplines = array_reverse($invoice->lines); + foreach($tmplines as $line) { - $firstline = dolGetFirstLineOfText($line->desc); - if ($firstline != $line->desc) - { - $htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); - } - else - { - $htmlforlines.= $line->desc; - } - } - if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; - $htmlforlines.= ''; - $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; - $htmlforlines.= '' . $line->qty . ''; - $htmlforlines.= '' . price($line->total_ttc) . ''; - $htmlforlines.= ''."\n"; + $htmlforlines = ''; + + $htmlforlines.= 'id . '">'; + $htmlforlines.= ''; + $htmlforlines.= $line->product_label; + if ($line->product_label && $line->desc) $htmlforlines.= '
'; + if ($line->product_label != $line->desc) + { + $firstline = dolGetFirstLineOfText($line->desc); + if ($firstline != $line->desc) + { + $htmlforlines.= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); + } + else + { + $htmlforlines.= $line->desc; + } + } + if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; + $htmlforlines.= ''; + $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; + $htmlforlines.= '' . $line->qty . ''; + $htmlforlines.= '' . price($line->total_ttc) . ''; + $htmlforlines.= ''."\n"; + + print $htmlforlines; + } + } + else + { + print ''.$langs->trans("Empty").''; - print $htmlforlines; } } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index fed57dcf068..3f9641b37d5 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -170,7 +170,7 @@ else print "var received=0;"; } console.log("We click on the payment mode to pay amount = "+amountpayed); parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&invoiceid="+invoiceid, function() { - parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); + //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); parent.$.colorbox.close(); }); } diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index bb57baaf04d..9fa2154eaf1 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -66,9 +66,9 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); get_full_arbo('product', 0, (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)?$conf->global->TAKEPOS_ROOT_CATEGORY_ID:0)); -//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0; // Search root category to know its level +//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0; $levelofrootcategory=0; if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { @@ -267,7 +267,7 @@ function ClickProduct(position) { function deleteline() { $("#poslines").load("invoice.php?action=deleteline&place="+place+"&idline="+selectedline, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } @@ -295,13 +295,13 @@ function TakeposOrderNotes() { function Refresh() { $("#poslines").load("invoice.php?place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } function Search() { $("#poslines").load("invoice.php?action=search&place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } @@ -334,7 +334,7 @@ function Edit(number){ if (editaction=='qty' && editnumber!=""){ $("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#qty").html("trans("Qty"); ?>"); }); return; @@ -347,7 +347,7 @@ function Edit(number){ if (editaction=='p' && editnumber!=""){ $("#poslines").load("invoice.php?action=updateprice&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#price").html("trans("Price"); ?>"); }); return; @@ -360,7 +360,7 @@ function Edit(number){ if (editaction=='r' && editnumber!=""){ $("#poslines").load("invoice.php?action=updatereduction&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#reduction").html("trans("ReductionShort"); ?>"); }); return; @@ -395,13 +395,13 @@ function Edit(number){ function TakeposPrintingOrder(){ $("#poslines").load("invoice.php?action=order&place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } function TakeposPrintingTemp(){ $("#poslines").load("invoice.php?action=temp&place="+place, function() { - $('#poslines').scrollTop($('#poslines')[0].scrollHeight); + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } From eb1d57226f45de3f1934845d220880b633cb477d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 20:28:02 +0100 Subject: [PATCH 180/222] Fix status paid after entering a payment --- htdocs/takepos/invoice.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3c39b7e1e4e..0a748ee32d8 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -116,9 +116,16 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->create($user); $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); - if ($invoice->getRemainToPay() == 0) + $remaintopay = $invoice->getRemainToPay(); + if ($remaintopay == 0) { + dol_syslog("Invoice is paid, so we set it to pay"); $result = $invoice->set_paid($user); + if ($result > 0) $invoice->paye = 1; + } + else + { + dol_syslog("Invoice is not paid, remain to pay = ".$remaintopay); } } From c6543614850007b0c6590df3c312afbb4b112f10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Mar 2019 20:46:07 +0100 Subject: [PATCH 181/222] Show link to invoice at the TOP --- htdocs/takepos/invoice.php | 44 ++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 0a748ee32d8..ed3f133b2d4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -274,6 +274,28 @@ if ($action == "order" and $placeid != 0) { $invoice->fetch($placeid); } +$sectionwithinvoicelink=''; +if ($action=="valid") +{ + $sectionwithinvoicelink.=''."\n"; + $sectionwithinvoicelink.=''; + $sectionwithinvoicelink.=''; + $sectionwithinvoicelink.=$invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - "; + if ($invoice->getRemainToPay() > 0) + { + $sectionwithinvoicelink.=$langs->trans('Generated'); + } + else + { + if ($invoice->paye) $sectionwithinvoicelink.=$langs->trans("Payed"); + else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated'); + } + $sectionwithinvoicelink.=''; + if ($conf->global->TAKEPOSCONNECTOR) $sectionwithinvoicelink.=' '; + else $sectionwithinvoicelink.=' '; + if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) $sectionwithinvoicelink.=''; +} + /* * View @@ -406,6 +428,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) } print $langs->trans('TotalTTC'); print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; +print '
'.$sectionwithinvoicelink; print ''; print '' . $langs->trans('ReductionShort') . ''; print '' . $langs->trans('Qty') . ''; @@ -470,27 +493,6 @@ if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY) print '

'; } -if ($action=="valid") -{ - print ''."\n"; - print ''; - print '

'; - print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - "; - if ($invoice->getRemainToPay() > 0) - { - print $langs->trans('Generated'); - } - else - { - if ($invoice->paye) print $langs->trans("Payed"); - else print $langs->trans('BillShortStatusValidated'); - } - print '

'; - if ($conf->global->TAKEPOSCONNECTOR) print '
'; - else print '
'; - if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) print ''; -} - if ($action == "search") { print '
From 80f7cef0a8ef4526b28a9c10fb3eb7a54c4307a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 09:20:05 +0100 Subject: [PATCH 182/222] Better translation --- htdocs/admin/index.php | 4 ++-- htdocs/langs/en_US/admin.lang | 4 ++-- htdocs/langs/en_US/errors.lang | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 62f5443d693..9e0acb0ff62 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -100,8 +100,8 @@ print '
'.$moreinfo; if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled { $langs->load("errors"); - $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"'); - print '
'; + $warnpicto=img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"'); + print '
'; } print '
'; print '
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index dde854f1925..92431aad538 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1053,8 +1053,8 @@ Delays_MAIN_DELAY_CHEQUES_TO_DEPOSIT=Check deposit not done Delays_MAIN_DELAY_EXPENSEREPORTS=Expense report to approve SetupDescription1=Before starting to use Dolibarr some initial parameters must be defined and modules enabled/configured. SetupDescription2=The following two sections are mandatory (the two first entries in the Setup menu): -SetupDescription3=%s -> %s
Basic parameters used to customize the default behavior of Dolibarr (e.g for country-related features). -SetupDescription4=%s -> %s
Dolibarr ERP/CRM is a collection of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module. +SetupDescription3=%s -> %s
Basic parameters used to customize the default behavior of your application (e.g for country-related features). +SetupDescription4=%s -> %s
This software is a suite of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module. SetupDescription5=Other Setup menu entries manage optional parameters. LogEvents=Security audit events Audit=Audit diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5e1e8fcd32e..6f12bd4ca37 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -218,7 +218,8 @@ ErrorVariableKeyForContentMustBeSet=Error, the constant with name %s (with text ErrorURLMustStartWithHttp=URL %s must start with http:// or https:// # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. -WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined +WarningMandatorySetupNotComplete=Click here to setup mandatory parameters +WarningEnableYourModulesApplications=Click here to enable your modules and applications WarningSafeModeOnCheckExecDir=Warning, PHP option safe_mode is on so command must be stored inside a directory declared by php parameter safe_mode_exec_dir. WarningBookmarkAlreadyExists=A bookmark with this title or this target (URL) already exists. WarningPassIsEmpty=Warning, database password is empty. This is a security hole. You should add a password to your database and change your conf.php file to reflect this. From 1818e22be92ea4ceabe905c4ed7fe66317799943 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 09:56:01 +0100 Subject: [PATCH 183/222] Add some font awesome icons on buttons --- htdocs/takepos/customers.php | 2 +- htdocs/takepos/floors.php | 6 ++++++ htdocs/takepos/freezone.php | 9 ++++++++- htdocs/takepos/invoice.php | 14 +++++++++++--- htdocs/takepos/receipt.php | 6 ++++++ htdocs/takepos/takepos.php | 14 ++++++++++---- 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/htdocs/takepos/customers.php b/htdocs/takepos/customers.php index 05fdf5537c9..6bb96e478d3 100644 --- a/htdocs/takepos/customers.php +++ b/htdocs/takepos/customers.php @@ -26,7 +26,7 @@ /** * \file htdocs/takepos/customers.php - * \ingroup societe + * \ingroup takepos * \brief Page to show list of third parties. TODO Merge with societe/list.php */ diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 0206fe1a8e0..9401d61b9a0 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -15,6 +15,12 @@ * along with this program. If not, see . */ +/** + * \file htdocs/takepos/floors.php + * \ingroup takepos + * \brief Page to edit floors and tables. + */ + //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index f9a270b247c..64c21a30304 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -15,6 +15,12 @@ * along with this program. If not, see . */ +/** + * \file htdocs/takepos/floors.php + * \ingroup takepos + * \brief Popup to enter a free line + */ + //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); @@ -33,7 +39,8 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $plac $posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS $idline = GETPOST('idline', 'int'); -$action = GETPOST('action'); +$action = GETPOST('action', 'alpha'); + /* * View diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ed3f133b2d4..856616ee7b0 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -16,6 +16,12 @@ * along with this program. If not, see . */ +/** + * \file htdocs/takepos/invoice.php + * \ingroup takepos + * \brief Page to generate section with list of lines + */ + // if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language // if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language // if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); @@ -48,8 +54,8 @@ $amountofpayment = price2num(GETPOST('amount', 'alpha')); $invoiceid = GETPOST('invoiceid', 'int'); $paycode = $pay; -if ($pay == 'cash') $paycode = 'LIQ'; // For backward compatibility -if ($pay == 'card') $paycode = 'CB'; // For backward compatibility +if ($pay == 'cash') $paycode = 'LIQ'; // For backward compatibility +if ($pay == 'card') $paycode = 'CB'; // For backward compatibility if ($pay == 'cheque') $paycode = 'CHQ'; // For backward compatibility // Retrieve paiementid @@ -477,9 +483,11 @@ if ($placeid > 0) else { print ''.$langs->trans("Empty").''; - } } +else { // No invoice generated yet + print ''.$langs->trans("Empty").''; +} print ''; diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 7e560a0d40f..262231f72b5 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -19,6 +19,12 @@ * along with this program. If not, see . */ +/** + * \file htdocs/takepos/floors.php + * \ingroup takepos + * \brief Page to show a receipt. + */ + require '../main.inc.php'; // Load $user and permissions include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 9fa2154eaf1..959bc0baac5 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -16,6 +16,12 @@ * along with this program. If not, see . */ +/** + * \file htdocs/takepos/floors.php + * \ingroup takepos + * \brief Main TakePOS screen + */ + //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); @@ -493,17 +499,17 @@ if (count($maincategories)==0) { // User menu and external TakePOS modules $menus = array(); $r=0; -$menus[$r++]=array('title'=>$langs->trans("SearchProduct"), +$menus[$r++]=array('title'=>''.$langs->trans("SearchProduct"), 'action'=>'Search();'); $menus[$r++]=array('title'=>$langs->trans("FreeZone"), 'action'=>'FreeZone();'); -$menus[$r++]=array('title'=>$langs->trans("Customer"), +$menus[$r++]=array('title'=>''.$langs->trans("Customer"), 'action'=>'Customer();'); -$menus[$r++]=array('title'=>$langs->trans("BackOffice"), +$menus[$r++]=array('title'=>''.$langs->trans("BackOffice"), 'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');'); $menus[$r++]=array('title'=>$langs->trans("DoPayment"), 'action'=>'CloseBill();'); -$menus[$r++]=array('title'=>$langs->trans("Logout"), +$menus[$r++]=array('title'=>''.$langs->trans("Logout"), 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); // BAR RESTAURANT specific menu From 9f9dd2cd30995100ee4d00c3a4165592ff3fb442 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 28 Mar 2019 11:41:59 +0100 Subject: [PATCH 184/222] NEW: Add import of accounting account for intra/export selling on product card --- htdocs/core/modules/modProduct.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 368a41a6fac..f9cb16fc9c0 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -325,6 +325,8 @@ class modProduct extends DolibarrModules 'p.duration' => "Duration",///duration of service 'p.url' => "PublicUrl", 'p.accountancy_code_sell' => "ProductAccountancySellCode", + 'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", + 'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode", 'p.accountancy_code_buy' => "ProductAccountancyBuyCode", 'p.weight' => "Weight", 'p.weight_units' => "WeightUnits", From 8163739a68db5e2fbc2453c85fb94bec51dedb62 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 28 Mar 2019 12:03:04 +0100 Subject: [PATCH 185/222] LOG_WARNING on function dol_print_date with deprecated value --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0937981164b..2ca52840505 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1785,7 +1785,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 { // TODO Remove this. This part of code should not be used. - dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR); + dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING); //if (function_exists('debug_print_backtrace')) debug_print_backtrace(); // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' $syear = (! empty($reg[1]) ? $reg[1] : ''); From 3de82ad345f90ea8cc79d9bccce06761edb49c9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 12:27:31 +0100 Subject: [PATCH 186/222] Prepare removal of duplicate page --- htdocs/societe/list.php | 2 +- htdocs/takepos/customers.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index c716604fd7c..4b9e83461ea 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -150,7 +150,7 @@ if (! empty($conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS)) $fieldstosearchall // Define list of fields to show into list -$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0); +$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist', 'poslist')) ? 1 : 0); $checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); $checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0); $checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); diff --git a/htdocs/takepos/customers.php b/htdocs/takepos/customers.php index 6bb96e478d3..d32ae82e25d 100644 --- a/htdocs/takepos/customers.php +++ b/htdocs/takepos/customers.php @@ -27,7 +27,8 @@ /** * \file htdocs/takepos/customers.php * \ingroup takepos - * \brief Page to show list of third parties. TODO Merge with societe/list.php + * \brief Page to show list of third parties. + * TODO replace use of this page by societe/list.php?contextpage=poslist */ require '../main.inc.php'; // Load $user and permissions @@ -168,7 +169,7 @@ if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod'; // Define list of fields to show into list -$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0); +$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist', 'poslist')) ? 1 : 0); $checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); $checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0); $checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); From 396e79199c935be8610d4bb7342bc6b4ad4d1d00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 12:32:32 +0100 Subject: [PATCH 187/222] Add contextpage to open popup to change customers --- htdocs/takepos/customers.php | 2 +- htdocs/takepos/takepos.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/customers.php b/htdocs/takepos/customers.php index d32ae82e25d..a9ec90776e8 100644 --- a/htdocs/takepos/customers.php +++ b/htdocs/takepos/customers.php @@ -1007,7 +1007,7 @@ while ($i < min($num, $limit)) $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; - print ''; + print ''; if (! empty($arrayfields['s.rowid']['checked'])) { print ''; diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 959bc0baac5..ed31674cf64 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -278,7 +278,7 @@ function deleteline() { } function Customer() { - $.colorbox({href:"customers.php?nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"trans("Customer");?>"}); + $.colorbox({href:"customers.php?contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"trans("Customer");?>"}); } function CloseBill() { From c888c071e5b82a53c2b5a879cfce0b32b8d38cb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 13:10:44 +0100 Subject: [PATCH 188/222] Removed duplicate file --- htdocs/societe/list.php | 50 +- htdocs/takepos/customers.php | 1273 ---------------------------------- htdocs/takepos/takepos.php | 2 +- 3 files changed, 44 insertions(+), 1281 deletions(-) delete mode 100644 htdocs/takepos/customers.php diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 4b9e83461ea..ad16c9adb25 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2019 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2013-2015 Raphaël Doursenaud * Copyright (C) 2015 Florian Henry @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; -$langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories")); +$langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk")); $action=GETPOST('action', 'alpha'); $massaction=GETPOST('massaction', 'alpha'); @@ -47,6 +47,11 @@ $confirm=GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'thirdpartylist'; +if ($contextpage == 'poslist') +{ + $_GET['optioncss'] = 'print'; +} + // Security check $socid = GETPOST('socid', 'int'); if ($user->societe_id) $socid=$user->societe_id; @@ -218,6 +223,25 @@ $object = new Societe($db); * Actions */ +if ($action=="change") +{ + $idcustomer = GETPOST('idcustomer', 'int'); + $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant + $posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS + + $sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'"; + $resql = $db->query($sql); + ?> + + global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $obj = $db->fetch_object($resql); $id = $obj->rowid; if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) { - if ( $obj->client > 0) { + if ($obj->client > 0) { header("Location: ".DOL_URL_ROOT.'/comm/card.php?socid='.$id); exit; } - if ( $obj->fournisseur > 0){ + if ($obj->fournisseur > 0) { header("Location: ".DOL_URL_ROOT.'/fourn/card.php?socid='.$id); exit; } @@ -545,7 +569,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','pre $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; -if ($user->rights->societe->creer) +if ($user->rights->societe->creer && $contextpage != 'postlist') { $typefilter=''; $label='MenuNewThirdParty'; @@ -975,7 +999,12 @@ while ($i < min($num, $limit)) $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; $companystatic->fk_parent = $obj->fk_parent; - print ''; + print ''; + } + print '>'; if (! empty($arrayfields['s.rowid']['checked'])) { print ''; @@ -988,7 +1017,14 @@ while ($i < min($num, $limit)) $savalias = $obj->name_alias; if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias=''; print ''; - print $companystatic->getNomUrl(1, '', 100, 0, 1); + if ($contextpage == 'poslist') + { + print $obj->name; + } + else + { + print $companystatic->getNomUrl(1, '', 100, 0, 1); + } print "\n"; $companystatic->name_alias = $savalias; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/takepos/customers.php b/htdocs/takepos/customers.php deleted file mode 100644 index a9ec90776e8..00000000000 --- a/htdocs/takepos/customers.php +++ /dev/null @@ -1,1273 +0,0 @@ - - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2019 Regis Houssin - * Copyright (C) 2012 Marcos García - * Copyright (C) 2013-2015 Raphaël Doursenaud - * Copyright (C) 2015 Florian Henry - * Copyright (C) 2016 Josep Lluis Amador - * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2017 Juanjo Menent - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/takepos/customers.php - * \ingroup takepos - * \brief Page to show list of third parties. - * TODO replace use of this page by societe/list.php?contextpage=poslist - */ - -require '../main.inc.php'; // Load $user and permissions -include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; - -$langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk")); - -$action=GETPOST('action', 'alpha'); -$massaction=GETPOST('massaction', 'alpha'); -$show_files=GETPOST('show_files', 'int'); -$confirm=GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -$idcustomer = GETPOST('idcustomer', 'int'); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant -$posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS - -$_GET['optioncss'] = 'print'; - - -/* - * Actions - */ - -if ($action=="change") { - $sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'"; - $resql = $db->query($sql); - ?> - - societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'societe', $socid, ''); - -$search_all=trim(GETPOST('search_all', 'alphanohtml')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); -$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars - -$search_id=trim(GETPOST("search_id", "int")); -$search_nom=trim(GETPOST("search_nom")); -$search_alias=trim(GETPOST("search_alias")); -$search_nom_only=trim(GETPOST("search_nom_only")); -$search_barcode=trim(GETPOST("search_barcode")); -$search_customer_code=trim(GETPOST('search_customer_code')); -$search_supplier_code=trim(GETPOST('search_supplier_code')); -$search_account_customer_code=trim(GETPOST('search_account_customer_code')); -$search_account_supplier_code=trim(GETPOST('search_account_supplier_code')); -$search_town=trim(GETPOST("search_town")); -$search_zip=trim(GETPOST("search_zip")); -$search_state=trim(GETPOST("search_state")); -$search_region=trim(GETPOST("search_region")); -$search_email=trim(GETPOST('search_email')); -$search_phone=trim(GETPOST('search_phone')); -$search_url=trim(GETPOST('search_url')); -$search_idprof1=trim(GETPOST('search_idprof1')); -$search_idprof2=trim(GETPOST('search_idprof2')); -$search_idprof3=trim(GETPOST('search_idprof3')); -$search_idprof4=trim(GETPOST('search_idprof4')); -$search_idprof5=trim(GETPOST('search_idprof5')); -$search_idprof6=trim(GETPOST('search_idprof6')); -$search_vat=trim(GETPOST('search_vat')); -$search_sale=trim(GETPOST("search_sale", 'int')); -$search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); -$search_categ_sup=trim(GETPOST("search_categ_sup", 'int')); -$search_country=GETPOST("search_country", 'intcomma'); -$search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); -$search_status=GETPOST("search_status", 'int'); -$search_type=GETPOST('search_type', 'alpha'); -$search_level_from = GETPOST("search_level_from", "alpha"); -$search_level_to = GETPOST("search_level_to", "alpha"); -$search_stcomm=GETPOST('search_stcomm', 'int'); -$search_import_key = GETPOST("search_import_key", "alpha"); - -$type=GETPOST('type'); -$optioncss=GETPOST('optioncss', 'alpha'); -$mode=GETPOST("mode"); - -$diroutputmassaction=$conf->societe->dir_output . '/temp/massgeneration/'.$user->id; - -$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; -$sortfield=GETPOST("sortfield", 'alpha'); -$sortorder=GETPOST("sortorder", 'alpha'); -$page=GETPOST("page", 'int'); -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="s.nom"; -if (empty($page) || $page == -1) { $page = 0; } -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; - -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$contextpage='thirdpartylist'; -/*if ($search_type == '1,3') { $contextpage='customerlist'; $type='c'; } -if ($search_type == '2,3') { $contextpage='prospectlist'; $type='p'; } -if ($search_type == '4') { $contextpage='supplierlist'; $type='f'; } -*/ -if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } -if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } -if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } - -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array($contextpage)); -$extrafields = new ExtraFields($db); - -// fetch optionals attributes and labels -$extralabels = $extrafields->fetch_name_optionals_label('societe'); -$search_array_options=$extrafields->getOptionalsFromPost('societe', '', 'search_'); - -// List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 's.nom'=>"ThirdPartyName", - 's.name_alias'=>"AliasNameShort", - 's.code_client'=>"CustomerCode", - 's.code_fournisseur'=>"SupplierCode", - 's.code_compta'=>"CustomerAccountancyCodeShort", - 's.code_compta_fournisseur'=>"SupplierAccountancyCodeShort", - 's.email'=>"EMail", - 's.url'=>"URL", - 's.tva_intra'=>"VATIntra", - 's.siren'=>"ProfId1", - 's.siret'=>"ProfId2", - 's.ape'=>"ProfId3", -); -if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4']='ProfId4'; -if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5']='ProfId5'; -if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6']='ProfId6'; -if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod'; - -// Define list of fields to show into list -$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist', 'poslist')) ? 1 : 0); -$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); -$checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0); -$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); -$checkedtypetiers=1; -$checkedprofid1=0; -$checkedprofid2=0; -$checkedprofid3=0; -$checkedprofid4=0; -$checkedprofid5=0; -$checkedprofid6=0; -//$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0); -//$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0); -//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0); -$checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0); -$checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0); -$arrayfields=array( - 's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)), - 's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1), - 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1), - 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), - 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>$checkedcustomercode), - 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), - 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'checked'=>$checkedcustomeraccountcode), - 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), - 's.town'=>array('label'=>"Town", 'checked'=>1), - 's.zip'=>array('label'=>"Zip", 'checked'=>1), - 'state.nom'=>array('label'=>"State", 'checked'=>0), - 'region.nom'=>array('label'=>"Region", 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), - 's.email'=>array('label'=>"Email", 'checked'=>0), - 's.url'=>array('label'=>"Url", 'checked'=>0), - 's.phone'=>array('label'=>"Phone", 'checked'=>1), - 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 's.siren'=>array('label'=>"ProfId1Short", 'checked'=>$checkedprofid1), - 's.siret'=>array('label'=>"ProfId2Short", 'checked'=>$checkedprofid2), - 's.ape'=>array('label'=>"ProfId3Short", 'checked'=>$checkedprofid3), - 's.idprof4'=>array('label'=>"ProfId4Short", 'checked'=>$checkedprofid4), - 's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5), - 's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6), - 's.tva_intra'=>array('label'=>"VATIntra", 'checked'=>0), - 'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1), - 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel), - 's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm), - 's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), - 's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), -); -// Extra fields -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) -{ - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } -} - -$object = new Societe($db); - - -/* - * Actions - */ - -if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } -if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } - -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -if (empty($reshook)) -{ - // Selection of new fields - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - - // Did we click on purge search criteria ? - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers - { - $search_id=''; - $search_nom=''; - $search_alias=''; - $search_categ_cus=0; - $search_categ_sup=0; - $search_sale=''; - $search_barcode=""; - $search_customer_code=''; - $search_supplier_code=''; - $search_account_customer_code=''; - $search_account_supplier_code=''; - $search_town=""; - $search_zip=""; - $search_state=""; - $search_country=''; - $search_email=''; - $search_phone=''; - $search_url=''; - $search_idprof1=''; - $search_idprof2=''; - $search_idprof3=''; - $search_idprof4=''; - $search_idprof5=''; - $search_idprof6=''; - $search_vat=''; - $search_type=''; - $search_type_thirdparty=''; - $search_status=-1; - $search_stcomm=''; - $search_level_from=''; - $search_level_to=''; - $search_import_key=''; - $toselect=''; - $search_array_options=array(); - } - - // Mass actions - $objectclass='Societe'; - $objectlabel='ThirdParty'; - $permtoread = $user->rights->societe->lire; - $permtodelete = $user->rights->societe->supprimer; - $uploaddir = $conf->societe->dir_output; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - - if ($action == 'setstcomm') - { - $object = new Client($db); - $result=$object->fetch(GETPOST('stcommsocid')); - $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm'); - $result=$object->update($object->id, $user); - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - - $action=''; - } -} - -if ($search_status=='') $search_status=1; // always display active thirdparty first - - - -/* - * View - */ - -/* - REM: Rules on permissions to see thirdparties - Internal or External user + No permission to see customers => See nothing - Internal user socid=0 + Permission to see ALL customers => See all thirdparties - Internal user socid=0 + No permission to see ALL customers => See only thirdparties linked to user that are sale representative - External user socid=x + Permission to see ALL customers => Can see only himself - External user socid=x + No permission to see ALL customers => Can see only himself - */ - -$form=new Form($db); -$formother=new FormOther($db); -$companystatic=new Societe($db); -$formcompany=new FormCompany($db); -$prospectstatic=new Client($db); -$prospectstatic->client=2; -$prospectstatic->loadCacheOfProspStatus(); - - -$title=$langs->trans("ListOfThirdParties"); -if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers"); -if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects"); -if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers"); - -// If both parameters are set, search for everything BETWEEN them -if ($search_level_from != '' && $search_level_to != '') -{ - // Ensure that these parameters are numbers - $search_level_from = (int) $search_level_from; - $search_level_to = (int) $search_level_to; - - // If from is greater than to, reverse orders - if ($search_level_from > $search_level_to) - { - $tmp = $search_level_to; - $search_level_to = $search_level_from; - $search_level_from = $tmp; - } - - // Generate the SQL request - $sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range'; -} -// If only "from" parameter is set, search for everything GREATER THAN it -elseif ($search_level_from != '') -{ - // Ensure that this parameter is a number - $search_level_from = (int) $search_level_from; - - // Generate the SQL request - $sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range'; -} -// If only "to" parameter is set, search for everything LOWER THAN it -elseif ($search_level_to != '') -{ - // Ensure that this parameter is a number - $search_level_to = (int) $search_level_to; - - // Generate the SQL request - $sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range'; -} -// If no parameters are set, dont search for anything -else -{ - $sortwhere = '0 as is_in_range'; -} - -// Select every potentiels, and note each potentiels which fit in search parameters -dol_syslog('societe/list.php', LOG_DEBUG); -$sql = "SELECT code, label, sortorder, ".$sortwhere; -$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; -$sql.= " WHERE active > 0"; -$sql.= " ORDER BY sortorder"; - -$resql = $db->query($sql); -if ($resql) -{ - $tab_level = array(); - $search_levels = array(); - - while ($obj = $db->fetch_object($resql)) - { - // Compute level text - $level=$langs->trans($obj->code); - if ($level == $obj->code) $level=$langs->trans($obj->label); - - // Put it in the array sorted by sortorder - $tab_level[$obj->sortorder] = $level; - - // If this potentiel fit in parameters, add its code to the $search_levels array - if ($obj->is_in_range == 1) - { - $search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"'; - } - } - - // Implode the $search_levels array so that it can be use in a "IN (...)" where clause. - // If no paramters was set, $search_levels will be empty - $search_levels = implode(',', $search_levels); -} -else dol_print_error($db); - -$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,"; -$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; -$sql.= " s.email, s.phone, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; -$sql.= " s.tms as date_update, s.datec as date_creation,"; -$sql.= " s.code_compta,s.code_compta_fournisseur,"; -$sql.= " typent.code as typent_code,"; -$sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= " region.code_region as region_code, region.nom as region_name"; -// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) -if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; -// We'll need these fields in order to filter by categ -if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; -if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc"; -// Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); -// Add fields from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; -// We'll need this table joined to the select in order to filter by categ -if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ -if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ -$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; -// We'll need this table joined to the select in order to filter by sale -if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= " WHERE s.fk_stcomm = st.id"; -$sql.= " AND s.entity IN (".getEntity('societe').")"; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socid) $sql.= " AND s.rowid = ".$socid; -if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale -if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible -if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_sup > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; -if ($search_categ_sup == -2) $sql.= " AND cs.fk_categorie IS NULL"; - -if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); -if (strlen($search_cti)) $sql.= natural_search('s.phone', $search_cti); - -if ($search_id > 0) $sql.= natural_search("s.rowid", $search_id, 1); -if ($search_nom) $sql.= natural_search("s.nom", $search_nom); -if ($search_alias) $sql.= natural_search("s.name_alias", $search_alias); -if ($search_nom_only) $sql.= natural_search("s.nom", $search_nom_only); -if ($search_customer_code) $sql.= natural_search("s.code_client", $search_customer_code); -if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur", $search_supplier_code); -if ($search_account_customer_code) $sql.= natural_search("s.code_compta", $search_account_customer_code); -if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur", $search_account_supplier_code); -if ($search_town) $sql.= natural_search("s.town", $search_town); -if (strlen($search_zip)) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_region) $sql.= natural_search("region.nom", $search_region); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_email) $sql.= natural_search("s.email", $search_email); -if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone); -if ($search_url) $sql.= natural_search("s.url", $search_url); -if (strlen($search_idprof1)) $sql.= natural_search("s.siren", $search_idprof1); -if (strlen($search_idprof2)) $sql.= natural_search("s.siret", $search_idprof2); -if (strlen($search_idprof3)) $sql.= natural_search("s.ape", $search_idprof3); -if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4", $search_idprof4); -if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5", $search_idprof5); -if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6", $search_idprof6); -if (strlen($search_vat)) $sql.= natural_search("s.tva_intra", $search_vat); -// Filter on type of thirdparty -if ($search_type > 0 && in_array($search_type, array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; -if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AND s.fournisseur = 1"; -if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; -if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status); -if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode); -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; -if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm", $search_stcomm, 2); -if ($search_import_key) $sql.= natural_search("s.import_key", $search_import_key); -// Add where from extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; - -// Add where from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; - -$sql.= $db->order($sortfield, $sortorder); - -// Count total nb of records -$nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) -{ - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); -} - -$sql.= $db->plimit($limit+1, $offset); - -$resql = $db->query($sql); -if (! $resql) -{ - dol_print_error($db); - exit; -} - -$num = $db->num_rows($resql); - -$arrayofselected=is_array($toselect)?$toselect:array(); - -if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') -{ - $obj = $db->fetch_object($resql); - $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id); - exit; -} - -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; -llxHeader('', $langs->trans("ThirdParty"), $help_url); - -$param=''; -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; -if ($search_all != '') $param = "&sall=".urlencode($search_all); -if ($sall != '') $param .= "&sall=".urlencode($sall); -if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); -if ($search_categ_sup > 0) $param.='&search_categ_sup='.urlencode($search_categ_sup); -if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); -if ($search_id > 0) $param.= "&search_id=".urlencode($search_id); -if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); -if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias); -if ($search_town != '') $param.= "&search_town=".urlencode($search_town); -if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); -if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); -if ($search_email != '') $param.= "&search_email=".urlencode($search_email); -if ($search_url != '') $param.= "&search_url=".urlencode($search_url); -if ($search_state != '') $param.= "&search_state=".urlencode($search_state); -if ($search_country != '') $param.= "&search_country=".urlencode($search_country); -if ($search_customer_code != '') $param.= "&search_customer_code=".urlencode($search_customer_code); -if ($search_supplier_code != '') $param.= "&search_supplier_code=".urlencode($search_supplier_code); -if ($search_account_customer_code != '') $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); -if ($search_account_supplier_code != '') $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); -if ($search_barcode != '') $param.= "&search_barcode=".urlencode($search_barcode); -if ($search_idprof1 != '') $param.= '&search_idprof1='.urlencode($search_idprof1); -if ($search_idprof2 != '') $param.= '&search_idprof2='.urlencode($search_idprof2); -if ($search_idprof3 != '') $param.= '&search_idprof3='.urlencode($search_idprof3); -if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4); -if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5); -if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6); -if ($search_vat != '') $param.= '&search_vat='.urlencode($search_vat); -if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); -if ($search_type != '') $param.='&search_type='.urlencode($search_type); -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); -if ($search_status != '') $param.='&search_status='.urlencode($search_status); -if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm); -if ($search_level_from != '') $param.='&search_level_from='.urlencode($search_level_from); -if ($search_level_to != '') $param.='&search_level_to='.urlencode($search_level_to); -if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); -if ($type != '') $param.='&type='.urlencode($type); -// Add $param from extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - -// Show delete result message -if (GETPOST('delsoc')) -{ - setEventMessages($langs->trans("CompanyDeleted", GETPOST('delsoc')), null, 'mesgs'); -} - -// List of mass actions available -$arrayofmassactions = array( - 'presend'=>$langs->trans("SendByMail"), -// 'builddoc'=>$langs->trans("PDFMerge"), -); -//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); -if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); -$massactionbutton=$form->selectMassAction('', $arrayofmassactions); - -print '
'; -if ($optioncss != '') print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); - -$langs->load("other"); -$textprofid=array(); -foreach(array(1,2,3,4,5,6) as $key) -{ - $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); - $textprofid[$key]=''; - if ($label != "ProfId".$key.$mysoc->country_code) - { // Get only text between () - if (preg_match('/\((.*)\)/i', $label, $reg)) $label=$reg[1]; - $textprofid[$key]=$langs->trans("ProfIdShortDesc", $key, $mysoc->country_code, $label); - } -} - -$topicmail="Information"; -$modelmail="thirdparty"; -$objecttmp=new Societe($db); -$trackid='thi'.$object->id; -include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - -if ($search_all) -{ - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall); -} - -// Filter on categories -$moreforfilter=''; -if (empty($type) || $type == 'c' || $type == 'p') -{ - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': '; - $moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); - $moreforfilter.='
'; - } -} -if (empty($type) || $type == 'f') -{ - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('SuppliersCategoriesShort').': '; - $moreforfilter.=$formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1); - $moreforfilter.='
'; - } -} - -// If the user can view prospects other than his' -if ($user->rights->societe->client->voir || $socid) -{ - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; - $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); - $moreforfilter.='
'; -} -if ($moreforfilter) -{ - print '
'; - print $moreforfilter; - $parameters=array('type'=>$type); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; -} - -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); - -if (empty($arrayfields['customerorsupplier']['checked'])) print ''; - -print '
'; -print ''."\n"; - -// Fields title search -print ''; -if (! empty($arrayfields['s.rowid']['checked'])) -{ - print ''; -} -if (! empty($arrayfields['s.nom']['checked'])) -{ - print ''; -} -if (! empty($arrayfields['s.name_alias']['checked'])) -{ - print ''; -} -// Barcode -if (! empty($arrayfields['s.barcode']['checked'])) -{ - print ''; -} -// Customer code -if (! empty($arrayfields['s.code_client']['checked'])) -{ - print ''; -} -// Supplier code -if (! empty($arrayfields['s.code_fournisseur']['checked'])) -{ - print ''; -} -// Account Customer code -if (! empty($arrayfields['s.code_compta']['checked'])) -{ - print ''; -} -// Account Supplier code -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) -{ - print ''; -} -// Town -if (! empty($arrayfields['s.town']['checked'])) -{ - print ''; -} -// Zip -if (! empty($arrayfields['s.zip']['checked'])) -{ - print ''; -} -// State -if (! empty($arrayfields['state.nom']['checked'])) -{ - print ''; -} -// Region -if (! empty($arrayfields['region.nom']['checked'])) -{ - print ''; -} -// Country -if (! empty($arrayfields['country.code_iso']['checked'])) -{ - print ''; -} -// Company type -if (! empty($arrayfields['typent.code']['checked'])) -{ - print ''; -} -if (! empty($arrayfields['s.email']['checked'])) -{ - // Email - print ''; -} -if (! empty($arrayfields['s.phone']['checked'])) -{ - // Phone - print ''; -} -if (! empty($arrayfields['s.url']['checked'])) -{ - // Url - print ''; -} -if (! empty($arrayfields['s.siren']['checked'])) -{ - // IdProf1 - print ''; -} -if (! empty($arrayfields['s.siret']['checked'])) -{ - // IdProf2 - print ''; -} -if (! empty($arrayfields['s.ape']['checked'])) -{ - // IdProf3 - print ''; -} -if (! empty($arrayfields['s.idprof4']['checked'])) -{ - // IdProf4 - print ''; -} -if (! empty($arrayfields['s.idprof5']['checked'])) -{ - // IdProf5 - print ''; -} -if (! empty($arrayfields['s.idprof6']['checked'])) -{ - // IdProf6 - print ''; -} -if (! empty($arrayfields['s.tva_intra']['checked'])) -{ - // Vat number - print ''; -} - -// Type (customer/prospect/supplier) -if (! empty($arrayfields['customerorsupplier']['checked'])) -{ - print ''; -} -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) -{ - // Prospect level - print ''; -} - -if (! empty($arrayfields['s.fk_stcomm']['checked'])) -{ - // Prospect status - print ''; -} -// Extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - -// Fields from hook -$parameters=array('arrayfields'=>$arrayfields); -$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; -// Date creation -if (! empty($arrayfields['s.datec']['checked'])) -{ - print ''; -} -// Date modification -if (! empty($arrayfields['s.tms']['checked'])) -{ - print ''; -} -// Status -if (! empty($arrayfields['s.status']['checked'])) -{ - print ''; -} -if (! empty($arrayfields['s.import_key']['checked'])) -{ - print ''; -} -// Action column -print ''; - -print "\n"; - -print ''; -if (! empty($arrayfields['s.rowid']['checked'])) print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode", $param, '', '', $sortfield, $sortorder); -if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER["PHP_SELF"], "s.code_client", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_fournisseur", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, 'align="center"', $sortfield, $sortorder); -// Extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; -// Hook fields -$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); -$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; -if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); -print "\n"; - - -$i = 0; -$totalarray=array(); -while ($i < min($num, $limit)) -{ - $obj = $db->fetch_object($resql); - - $companystatic->id=$obj->rowid; - $companystatic->name=$obj->name; - $companystatic->name_alias=$obj->name_alias; - $companystatic->logo=$obj->logo; - $companystatic->canvas=$obj->canvas; - $companystatic->client=$obj->client; - $companystatic->status=$obj->status; - $companystatic->email=$obj->email; - $companystatic->fournisseur=$obj->fournisseur; - $companystatic->code_client=$obj->code_client; - $companystatic->code_fournisseur=$obj->code_fournisseur; - - $companystatic->code_compta_client=$obj->code_compta; - $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; - - $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; - - print ''; - if (! empty($arrayfields['s.rowid']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.nom']['checked'])) - { - $savalias = $obj->name_alias; - if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias=''; - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.name_alias']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - // Barcode - if (! empty($arrayfields['s.barcode']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Customer code - if (! empty($arrayfields['s.code_client']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Supplier code - if (! empty($arrayfields['s.code_fournisseur']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Account customer code - if (! empty($arrayfields['s.code_compta']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Account supplier code - if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Town - if (! empty($arrayfields['s.town']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - // Zip - if (! empty($arrayfields['s.zip']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - // State - if (! empty($arrayfields['state.nom']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - // Region - if (! empty($arrayfields['region.nom']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - // Country - if (! empty($arrayfields['country.code_iso']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Type ent - if (! empty($arrayfields['typent.code']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.email']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.phone']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.url']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.siren']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.siret']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.ape']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.idprof4']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.idprof5']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.idprof6']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.tva_intra']['checked'])) - { - print "\n"; - if (! $i) $totalarray['nbfield']++; - } - // Type - if (! empty($arrayfields['customerorsupplier']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) - { - // Prospect level - print '"; - if (! $i) $totalarray['nbfield']++; - } - - if (! empty($arrayfields['s.fk_stcomm']['checked'])) - { - // Prospect status - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (! empty($arrayfields['s.datec']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date modification - if (! empty($arrayfields['s.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Status - if (! empty($arrayfields['s.status']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - if (! empty($arrayfields['s.import_key']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - - // Action column - print ''; - if (! $i) $totalarray['nbfield']++; - - print ''."\n"; - $i++; -} - -$db->free($resql); - -$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; - -print "
'; - print ''; - print ''; - if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); - print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($type != '') print ''; - print ''; - $options_from = ''; // Generate in $options_from the list of each option sorted - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) - { - $options_from .= ''; - } - array_reverse($tab_level, true); // Reverse the list - $options_to = ''; // Generate in $options_to the list of each option sorted in the reversed order - foreach ($tab_level as $tab_level_sortorder => $tab_level_label) - { - $options_to .= ''; - } - - // Print these two select - print $langs->trans("From").' '; - print ' '; - print $langs->trans("to").' '; - - print ''; - $arraystcomm=array(); - foreach($prospectstatic->cacheprospectstatus as $key => $val) - { - $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); - } - print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); - print ''; - print ''; - print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1); - print ''; - print ''; - print ''; -$searchpicto=$form->showFilterButtons(); -print $searchpicto; -print '
'; - print $obj->rowid; - print "'; - print $obj->name; - print "'; - print $companystatic->name_alias; - print "'.$obj->barcode.''.$obj->code_client.''.$obj->code_fournisseur.''.$obj->code_compta.''.$obj->code_compta_fournisseur.'".$obj->town."".$obj->zip."".$obj->state_name."".$obj->region_name."'; - $tmparray=getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; - print ''; - if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); - print $typenArray[$obj->typent_code]; - print '".$obj->email."".$obj->phone."".$obj->url."".$obj->idprof1."".$obj->idprof2."".$obj->idprof3."".$obj->idprof4."".$obj->idprof5."".$obj->idprof6."".$obj->tva_intra."'; - $s=''; - if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) - { - $companystatic->name=$langs->trans("Customer"); - $companystatic->name_alias=''; - $s.=$companystatic->getNomUrl(0, 'customer', 0, 1); - } - if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) - { - if ($s) $s.=" / "; - $companystatic->name=$langs->trans("Prospect"); - $companystatic->name_alias=''; - $s.=$companystatic->getNomUrl(0, 'prospect', 0, 1); - } - if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) - { - if ($s) $s.=" / "; - $companystatic->name=$langs->trans("Supplier"); - $companystatic->name_alias=''; - $s.=$companystatic->getNomUrl(0, 'supplier', 0, 1); - } - print $s; - print ''; - print $companystatic->getLibProspLevel(); - print "
'; - print '
'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); - print '
-
'; - foreach($prospectstatic->cacheprospectstatus as $key => $val) - { - $titlealt='default'; - if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; - if ($obj->stcomm_id != $val['id']) print ''.img_action($titlealt, $val['code']).''; - } - print '
'; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''.$companystatic->getLibStatut(3).''; - print $obj->import_key; - print "'; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected=0; - if (in_array($obj->rowid, $arrayofselected)) $selected=1; - print ''; - } - print '
"; -print "
"; - -print '
'; - -llxFooter(); -$db->close(); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index ed31674cf64..8e48a606483 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -278,7 +278,7 @@ function deleteline() { } function Customer() { - $.colorbox({href:"customers.php?contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"trans("Customer");?>"}); + $.colorbox({href:"../societe/list.php?contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"trans("Customer");?>"}); } function CloseBill() { From eef95a8a783cf615cadf19bcb2a762ec1a2cf83b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 13:17:51 +0100 Subject: [PATCH 189/222] Fix syntax error --- htdocs/societe/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ad16c9adb25..d13c7c52254 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -228,7 +228,7 @@ if ($action=="change") $idcustomer = GETPOST('idcustomer', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant $posnb = (GETPOST('posnb', 'int') > 0 ? GETPOST('posnb', 'int') : 0); // $posnb is id of POS - + $sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); ?> @@ -569,7 +569,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','pre $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; -if ($user->rights->societe->creer && $contextpage != 'postlist') +if ($user->rights->societe->creer && $contextpage != 'poslist') { $typefilter=''; $label='MenuNewThirdParty'; @@ -1002,7 +1002,7 @@ while ($i < min($num, $limit)) print ''; + print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"'; } print '>'; if (! empty($arrayfields['s.rowid']['checked'])) From 0ab6b157796bf31a651021bebcf1202118a689bd Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Thu, 28 Mar 2019 17:27:30 +0100 Subject: [PATCH 190/222] FIX missing hook printFieldListFooter --- htdocs/contrat/list.php | 5 +++++ htdocs/expedition/list.php | 5 +++++ htdocs/fourn/commande/list.php | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 22e30466300..38473252377 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -802,6 +803,10 @@ while ($i < min($num, $limit)) } $db->free($resql); +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print ''; print '
'; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 6609ff358f9..b60852f205b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -623,6 +624,10 @@ if ($resql) $i++; } + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ""; print ""; print ''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index ec728ccaf07..6759a4e640c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -1159,6 +1160,10 @@ if ($resql) print ''; } + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print "\n"; print ''; print "\n"; From a52935f6e42ba2db6bf4743b1657e309e9f645ef Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Thu, 28 Mar 2019 18:29:36 +0100 Subject: [PATCH 191/222] New add fields in contact export - thirdparty fields (address, phone, email, typent) - contact field (status) --- htdocs/core/modules/modSociete.class.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 32b3b4b97fc..242389214d8 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -332,19 +332,28 @@ class modSociete extends DolibarrModules 'c.rowid'=>"IdContact",'c.civility'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction', 'c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town", 'd.nom'=>'State','co.label'=>"Country",'co.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail", + 'c.statut'=>"Status", 's.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", - 's.client'=>'Customer','s.fournisseur'=>'Supplier' + 's.client'=>'Customer','s.fournisseur'=>'Supplier', + 's.address'=>'Address','s.phone'=>'Phone','s.email'=>"Email", + 't.libelle'=>"ThirdPartyType" ); $this->export_examplevalues_array[$r]=array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 (not a supplier) or 1 (supplier)'); $this->export_TypeFields_array[$r]=array( 'c.civility'=>"List:c_civility:label:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean", 'c.address'=>"Text",'c.zip'=>"Text",'c.town'=>"Text",'d.nom'=>'Text','co.label'=>"List:c_country:label:rowid",'co.code'=>"Text",'c.phone'=>"Text", - 'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text", - 's.client'=>"Text",'s.fournisseur'=>"Text" + 'c.fax'=>"Text",'c.email'=>"Text", + 'c.statut'=>"Status", + 's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text", + 's.client'=>"Text",'s.fournisseur'=>"Text", + 's.address'=>"Text",'s.phone'=>"Text",'s.email'=>"Text", + 't.libelle'=>"Text" ); $this->export_entities_array[$r]=array( 's.rowid'=>"company",'s.nom'=>"company", 's.status'=>'company', 's.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company", - 's.fournisseur'=>"company" + 's.fournisseur'=>"company", + 's.address'=>"company", 's.phone'=>"company", 's.email'=>"company", + 't.libelle'=>"company" ); // We define here only fields that use another picto if (empty($conf->fournisseur->enabled)) { @@ -363,6 +372,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; $this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity('socpeople').')'; if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; From 50395b7dd7d94bb0c2f05c96074802fd83331dca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 18:51:04 +0100 Subject: [PATCH 192/222] New: Input field to search product always visible with focus so you can use a barcode flasher at any time --- htdocs/product/class/product.class.php | 15 +-- htdocs/takepos/css/pos.css | 32 +++-- htdocs/takepos/invoice.php | 12 +- htdocs/takepos/takepos.php | 157 ++++++++++++++++--------- 4 files changed, 141 insertions(+), 75 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f186c1d21da..cb7d40d3c7a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4062,7 +4062,8 @@ class Product extends CommonObject $linkend=''; $result.=$linkstart; - if ($withpicto) { + if ($withpicto) + { if ($this->type == Product::TYPE_PRODUCT) { $result.=(img_object(($notooltip?'':$label), 'product', ($notooltip?'class="paddingright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); } if ($this->type == Product::TYPE_SERVICE) { $result.=(img_object(($notooltip?'':$label), 'service', ($notooltip?'class="paddinright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); @@ -4151,11 +4152,11 @@ class Product extends CommonObject { // phpcs:enable global $conf, $langs; - + $langs->load('products'); if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch"); } - + if ($type == 2) { switch ($mode) { @@ -4177,9 +4178,9 @@ class Product extends CommonObject return dolGetStatus($langs->trans('Unknown')); } } - + $statuttrans=empty($status)?'status5':'status4'; - + if($status == 0){ // $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" if($type==0){ @@ -4210,8 +4211,8 @@ class Product extends CommonObject $labelstatutShort = $langs->trans('ProductStatusOnBatchShort'); } } - - + + if($mode>6){ return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0); } diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index a94e737f273..9993105e288 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -18,7 +18,6 @@ button.calcbutton { width:24%; height:24%; font-weight: bold; - color: #555555; } button.calcbutton2 { @@ -33,7 +32,6 @@ button.calcbutton2 { width:24%; height:24%; font-weight: bold; - color: #555555; } button.calcbutton3 { @@ -70,11 +68,11 @@ div.wrapper{ height:25%; margin:0; padding:1px; - border: 0.1em solid; - box-shadow: 3px 3px 2px #888; + border: 2px solid #D1D1D1; + /*box-shadow: 3px 3px 3px #bbb; */ text-align: center; box-sizing: border-box; - background-color:#f0eeee; + background-color:#fff; } div.wrapper2{ @@ -84,11 +82,11 @@ div.wrapper2{ height:25%; margin:0; /* padding:1px; */ - border: 0.1em solid; - box-shadow: 2px 2px 1px #888; + border: 2px solid #D1D1D1; + /*box-shadow: 3px 3px 3px #bbb;*/ text-align: center; box-sizing: border-box; - background-color:#f0eeee; + background-color:#fff; } button:active{ @@ -119,8 +117,26 @@ div.catwatermark{ text-align:center; font-size: 20px; display: none; + opacity: 0.8; } +table.postablelines tr td { + line-height: unset; + padding-top: 3px; + padding-bottom: 3px; +} +.posinvoiceline td { + height: 40px !important; +} +.poscolordelete { + color: #600; +} +.poscolorgreen { + color: #060; +} +.poscolorblue { + color: #006; +} @media only screen and (max-aspect-ratio: 6/4) { div.description{ min-height:20%; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 856616ee7b0..e1e5e675198 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -415,7 +415,7 @@ if (! empty($conf->use_javascript_ajax)) print '
'; -print ''; +print '
'; print ''; print 'special_code == "3") { $htmlforlines.= ' order'; } $htmlforlines.= '" id="' . $line->id . '">'; $htmlforlines.= ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; } print ''; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d652db91e70..0e80c0ba4ac 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018-2019 Nicolas ZABOURI * * 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 @@ -191,6 +191,14 @@ if ($dirins && $action == 'initmodule' && $modulename) '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') ); + if($conf->global->MAIN_FEATURES_LEVEL >= 2){ + if(!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) $arrayreplacement['Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME; + if(!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) $arrayreplacement['https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL; + if(!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) $arrayreplacement['---Put here your own copyright and developer email---'] = dol_print_date($now, '%Y').' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR; + if(!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) $arrayreplacement['1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION; + if(!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) $arrayreplacement['other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY; + } + $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); //var_dump($result); if ($result < 0) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index f8b1e83d6b6..0d073dca768 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019 Frédéric France * Copyright (C) ---Put here your own copyright and developer email--- * @@ -17,7 +17,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - /** * \defgroup mymodule Module MyModule * \brief MyModule module descriptor. @@ -27,8 +26,6 @@ * \brief Description and activation file for module MyModule */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; - - /** * Description and activation class for module MyModule */ @@ -42,15 +39,12 @@ class modMyModule extends DolibarrModules public function __construct($db) { global $langs,$conf; - $this->db = $db; - // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). $this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'mymodule'; - // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // It is used to group modules by family in module setup page $this->family = "other"; @@ -58,20 +52,16 @@ class modMyModule extends DolibarrModules $this->module_position = '90'; // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); - // Module label (no space allowed), used if translation string 'ModuleMyModuleName' not found (MyModule is name of module). $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleMyModuleDesc' not found (MyModule is name of module). $this->description = "MyModuleDescription"; // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "MyModule description (Long)"; - $this->editor_name = 'Editor name'; $this->editor_url = 'https://www.example.com'; - // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; - //Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) @@ -80,15 +70,14 @@ class modMyModule extends DolibarrModules // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' $this->picto='generic'; - // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( // Set this to 1 if module has its own trigger directory (core/triggers) - 'triggers' => 1, + 'triggers' => 0, // Set this to 1 if module has its own login method file (core/login) 'login' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions) - 'substitutions' => 1, + 'substitutions' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) 'menus' => 0, // Set this to 1 if module overwrite template dir (core/tpl) @@ -101,31 +90,28 @@ class modMyModule extends DolibarrModules 'theme' => 0, // Set this to relative path of css file if module has its own css file 'css' => array( - '/mymodule/css/mymodule.css.php', + // '/mymodule/css/mymodule.css.php', ), // Set this to relative path of js file if module must load a js on all pages 'js' => array( - '/mymodule/js/mymodule.js.php', + // '/mymodule/js/mymodule.js.php', ), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' 'hooks' => array( - 'data' => array( - 'hookcontext1', - 'hookcontext2', - ), - 'entity' => '0', + // 'data' => array( + // 'hookcontext1', + // 'hookcontext2', + // ), + // 'entity' => '0', ), // Set this to 1 if feature of module are opened to external users 'moduleforexternal' => 0, ); - // Data directories to create when module is enabled. // Example: this->dirs = array("/mymodule/temp","/mymodule/subdir"); $this->dirs = array("/mymodule/temp"); - // Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module. $this->config_page_url = array("setup.php@mymodule"); - // Dependencies // A condition to hide module $this->hidden = false; @@ -140,28 +126,23 @@ class modMyModule extends DolibarrModules $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice'); //$this->always_enabled = true; // If true, can't be disabled - // Constants // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) // Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), // 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) // ); $this->const = array( - 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + // 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) ); - // Some keys to add into the overwriting translation tables /*$this->overwrite_translation = array( 'en_US:ParentCompany'=>'Parent company or reseller', 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' )*/ - if (! isset($conf->mymodule) || ! isset($conf->mymodule->enabled)) { $conf->mymodule=new stdClass(); $conf->mymodule->enabled=0; } - - // Array to add new pages in new tabs $this->tabs = array(); // Example: @@ -189,8 +170,6 @@ class modMyModule extends DolibarrModules // 'stock' to add a tab in stock view // 'thirdparty' to add a tab in third party view // 'user' to add a tab in user view - - // Dictionaries $this->dictionaries=array(); /* Example: @@ -216,76 +195,63 @@ class modMyModule extends DolibarrModules 'tabcond'=>array($conf->mymodule->enabled,$conf->mymodule->enabled,$conf->mymodule->enabled) ); */ - - // Boxes/Widgets // Add here list of php file(s) stored in mymodule/core/boxes that contains class to show a widget. $this->boxes = array( - 0 => array( - 'file' => 'mymodulewidget1.php@mymodule', - 'note' => 'Widget provided by MyModule', - 'enabledbydefaulton' => 'Home', - ), + // 0 => array( + // 'file' => 'mymodulewidget1.php@mymodule', + // 'note' => 'Widget provided by MyModule', + // 'enabledbydefaulton' => 'Home', + // ), //1=>array('file'=>'mymodulewidget2.php@mymodule','note'=>'Widget provided by MyModule'), //2=>array('file'=>'mymodulewidget3.php@mymodule','note'=>'Widget provided by MyModule') ); - - // Cronjobs (List of cron jobs entries to add when module is enabled) // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week $this->cronjobs = array( - 0 => array( - 'label' => 'MyJob label', - 'jobtype' => 'method', - 'class' => '/mymodule/class/myobject.class.php', - 'objectname' => 'MyObject', - 'method' => 'doScheduledJob', - 'parameters' => '', - 'comment' => 'Comment', - 'frequency' => 2, - 'unitfrequency' => 3600, - 'status' => 0, - 'test' => '$conf->mymodule->enabled', - 'priority' => 50, - ), + // 0 => array( + // 'label' => 'MyJob label', + // 'jobtype' => 'method', + // 'class' => '/mymodule/class/myobject.class.php', + // 'objectname' => 'MyObject', + // 'method' => 'doScheduledJob', + // 'parameters' => '', + // 'comment' => 'Comment', + // 'frequency' => 2, + // 'unitfrequency' => 3600, + // 'status' => 0, + // 'test' => '$conf->mymodule->enabled', + // 'priority' => 50, + // ), ); // Example: $this->cronjobs=array( // 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mymodule->enabled', 'priority'=>50), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mymodule->enabled', 'priority'=>50) // ); - - // Permissions $this->rights = array(); // Permission array used by this module - $r=0; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) $this->rights[$r][1] = 'Read myobject of MyModule'; // Permission label $this->rights[$r][3] = 1; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $r++; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) $this->rights[$r][1] = 'Create/Update myobject of MyModule'; // Permission label $this->rights[$r][3] = 1; // Permission by default for new user (0/1) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $r++; $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) $this->rights[$r][1] = 'Delete myobject of MyModule'; // Permission label $this->rights[$r][3] = 1; // Permission by default for new user (0/1) $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - - // Main menu entries $this->menu = array(); // List of menus to add $r=0; - // Add here entries to declare new menus - /* BEGIN MODULEBUILDER TOPMENU */ $this->menu[$r++]=array( 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode @@ -301,9 +267,7 @@ class modMyModule extends DolibarrModules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); - /* END MODULEBUILDER TOPMENU */ - /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode @@ -334,11 +298,8 @@ class modMyModule extends DolibarrModules 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); END MODULEBUILDER LEFTMENU MYOBJECT */ - - // Exports $r=1; - /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ /* $langs->load("mymodule@mymodule"); @@ -357,7 +318,6 @@ class modMyModule extends DolibarrModules $r++; */ /* END MODULEBUILDER EXPORT MYOBJECT */ } - /** * Function called when module is enabled. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. @@ -370,22 +330,17 @@ class modMyModule extends DolibarrModules { $result=$this->_load_tables('/mymodule/sql/'); if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') - // Create extrafields include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); - //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); - $sql = array(); - return $this->_init($sql, $options); } - /** * Function called when module is disabled. * Remove from database constants, boxes and permissions from Dolibarr database. @@ -397,7 +352,6 @@ class modMyModule extends DolibarrModules public function remove($options = '') { $sql = array(); - return $this->_remove($sql, $options); } -} +} \ No newline at end of file From 822552defba8e4535289e7f537c2393d66542c59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 11:45:40 +0100 Subject: [PATCH 197/222] Use font awesome icon instead of image for navigation Better responsive on small screen --- htdocs/takepos/css/pos.css | 24 +++++- htdocs/takepos/invoice.php | 7 +- htdocs/takepos/pay.php | 1 + htdocs/takepos/takepos.php | 152 +++++++++++++++++++++++++++---------- 4 files changed, 140 insertions(+), 44 deletions(-) diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 9993105e288..53593e61035 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -240,10 +240,21 @@ table.postablelines tr td { .colorgreen { color: green; } + +.centerinmiddle { + transform: translate(0,-50%); + position: relative; + top: 50%; +} +.trunc { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + p.description_content{ padding:10px; margin:0px; - } @media screen and (min-width: 892px) { @@ -298,4 +309,13 @@ p.description_content{ .invoice{ font-size: 10px; } -} \ No newline at end of file +} + +@media screen and (max-width: 767px){ + div.wrapper { + width: 50%; + } + div.wrapper2 { + width: 25%; + } +} diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e1e5e675198..89ea0776949 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -313,7 +313,7 @@ $form = new Form($db); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 0375fe09ead..fbfa8a6e975 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -47,8 +47,15 @@ $langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter $categorie = new Categorie($db); -$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?16:$conf->global->TAKEPOS_NB_MAXCATEG); -$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?32:$conf->global->TAKEPOS_NB_MAXPRODUCT);; +$maxcategbydefaultforthisdevice=16; +$maxproductbydefaultforthisdevice=32; +if ($conf->browser->layout == 'phone') +{ + $maxcategbydefaultforthisdevice=8; + $maxproductbydefaultforthisdevice=16; +} +$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?$maxcategbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXCATEG); +$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?$maxproductbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXPRODUCT);; /* @@ -118,16 +125,60 @@ var place=""; var editaction="qty"; var editnumber=""; +/* +var app = this; +app.hasKeyboard = false; +this.keyboardPress = function() { + app.hasKeyboard = true; + $(window).unbind("keyup", app.keyboardPress); + localStorage.hasKeyboard = true; + console.log("has keyboard!") +} +$(window).on("keyup", app.keyboardPress) +if(localStorage.hasKeyboard) { + app.hasKeyboard = true; + $(window).unbind("keyup", app.keyboardPress); + console.log("has keyboard from localStorage") +} +*/ + +function ClearSearch() { + console.log("ClearSearch"); + $("#search").val(''); + browser->layer == 'classic') { ?> + setFocusOnSearchField(); + +} + +// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically +function setFocusOnSearchField() { + console.log("Call setFocusOnSearchField in page takepos.php"); + browser->layout == 'classic') { + ?> + if (app.hasKeyboard) + { + console.log("has keyboard from localStorage, so we can force focus on search field"); + $("#search").focus(); + } + +} + function PrintCategories(first) { console.log("PrintCategories"); for (i = 0; i < ; i++) { if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") { + $("#catdivdesc"+i).hide(); $("#catdesc"+i).text(""); $("#catimg"+i).attr("src","genimg/empty.png"); $("#catwatermark"+i).hide(); continue; } + $("#catdivdesc"+i).show(); $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']); $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']); $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']); @@ -135,13 +186,6 @@ function PrintCategories(first) { } } -// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically -function setFocusOnSearchField() { - browser->layout == 'classic') { ?> - $("#search").focus(); - -} - function MoreCategories(moreorless) { console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories); if (moreorless=="more") { @@ -161,18 +205,20 @@ function MoreCategories(moreorless) { } for (i = 0; i < ; i++) { if (typeof (categories[i+( * pagecategories)]) == "undefined") { + $("#catdivdesc"+i).hide(); $("#catdesc"+i).text(""); $("#catimg"+i).attr("src","genimg/empty.png"); $("#catwatermark"+i).hide(); continue; } + $("#catdivdesc"+i).show(); $("#catdesc"+i).text(categories[i+( * pagecategories)]['label']); $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+( * pagecategories)]['rowid']); $("#catdiv"+i).data("rowid",categories[i+( * pagecategories)]['rowid']); $("#catwatermark"+i).show(); } - setFocusOnSearchField(); + ClearSearch(); } function LoadProducts(position, issubcat=false) { @@ -189,6 +235,7 @@ function LoadProducts(position, issubcat=false) { jQuery.each(subcategories, function(i, val) { if (currentcat==val.fk_parent) { + $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(val.label); $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); @@ -206,6 +253,7 @@ function LoadProducts(position, issubcat=false) { //console.log("ishow"+ishow+" idata="+idata); //console.log(data[idata]); if (typeof (data[idata]) == "undefined") { + $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); @@ -213,6 +261,7 @@ function LoadProducts(position, issubcat=false) { ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell) + $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); @@ -225,7 +274,7 @@ function LoadProducts(position, issubcat=false) { } }); - setFocusOnSearchField(); + ClearSearch(); } function MoreProducts(moreorless) { @@ -255,6 +304,7 @@ function MoreProducts(moreorless) { while (ishow < maxproduct) { if (typeof (data[idata]) == "undefined") { + $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); @@ -262,6 +312,7 @@ function MoreProducts(moreorless) { } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) + $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); @@ -273,7 +324,7 @@ function MoreProducts(moreorless) { } }); - setFocusOnSearchField(); + ClearSearch(); } function ClickProduct(position) { @@ -294,7 +345,7 @@ function ClickProduct(position) { }); } - setFocusOnSearchField(); + ClearSearch(); } function deleteline() { @@ -337,13 +388,6 @@ function Refresh() { }); } -function ClearSearch() { - console.log("ClearSearch"); - $("#search").val(''); - - setFocusOnSearchField(); -} - function Search2() { console.log("Search2"); pageproducts=0; @@ -399,7 +443,7 @@ function Edit(number) { $("#price").html("trans("Price"); ?>"); }); - setFocusOnSearchField(); + ClearSearch(); return; } else { @@ -415,7 +459,7 @@ function Edit(number) { $("#reduction").html("trans("ReductionShort"); ?>"); }); - setFocusOnSearchField(); + ClearSearch(); return; } else { @@ -549,15 +593,15 @@ if (count($maincategories)==0) { // User menu and external TakePOS modules $menus = array(); $r=0; -//$menus[$r++]=array('title'=>''.$langs->trans("SearchProduct"), 'action'=>'Search();'); -$menus[$r++]=array('title'=>''.$langs->trans("Customer"), 'action'=>'Customer();'); -$menus[$r++]=array('title'=>''.$langs->trans("FreeZone"), 'action'=>'FreeZone();'); -$menus[$r++]=array('title'=>''.$langs->trans("Payment"), 'action'=>'CloseBill();'); +//$menus[$r++]=array('title'=>'
'.$langs->trans("SearchProduct").'
', 'action'=>'Search();'); +$menus[$r++]=array('title'=>'
'.$langs->trans("Customer").'
', 'action'=>'Customer();'); +$menus[$r++]=array('title'=>'
'.$langs->trans("FreeZone").'
', 'action'=>'FreeZone();'); +$menus[$r++]=array('title'=>'
'.$langs->trans("Payment").'
', 'action'=>'CloseBill();'); // BAR RESTAURANT specific menu if ($conf->global->TAKEPOS_BAR_RESTAURANT) { - $menus[$r++]=array('title'=>''.$langs->trans("Floors"), 'action'=>'Floors();'); + $menus[$r++]=array('title'=>'
'.$langs->trans("Floors").'
', 'action'=>'Floors();'); if ($conf->global->TAKEPOS_ORDER_PRINTERS) { $menus[$r++]=array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();'); @@ -565,17 +609,17 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) //add temp ticket button if ($conf->global->TAKEPOS_BAR_RESTAURANT) { - if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>''.$langs->trans("Receipt"),'action'=>'TakeposPrinting(placeid);'); - else $menus[$r++]=array('title'=>''.$langs->trans("Receipt"),'action'=>'Print(placeid);'); + if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'TakeposPrinting(placeid);'); + else $menus[$r++]=array('title'=>'
'.$langs->trans("Receipt").'
','action'=>'Print(placeid);'); } if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1) { - $menus[$r++]=array('title'=>$langs->trans("OrderNotes"), 'action'=>'TakeposOrderNotes();'); + $menus[$r++]=array('title'=>'
'.$langs->trans("OrderNotes").'
', 'action'=>'TakeposOrderNotes();'); } } if ($conf->global->TAKEPOSCONNECTOR) { - $menus[$r++]=array('title'=>$langs->trans("DOL_OPEN_DRAWER"), 'action'=>'OpenDrawer();'); + $menus[$r++]=array('title'=>'
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action'=>'OpenDrawer();'); } $hookmanager->initHooks(array('takeposfrontend')); @@ -586,8 +630,8 @@ if (!empty($reshook)) { if ($r % 3 == 2) $menus[$r++]=array('title'=>'', 'style'=>'visibility: hidden;'); -$menus[$r++]=array('title'=>''.$langs->trans("BackOffice"), 'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');'); -$menus[$r++]=array('title'=>''.$langs->trans("Logout"), 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); +$menus[$r++]=array('title'=>'
'.$langs->trans("BackOffice").'
', 'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');'); +$menus[$r++]=array('title'=>'
'.$langs->trans("Logout").'
', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); ?> @@ -624,11 +668,26 @@ $menus[$r++]=array('title'=>'< while ($count < $MAXCATEG) { ?> -
id="catdiv"> - height="100%" id="catimg" /> -
-
+
id="catdiv"> + '; + echo ''; + } + elseif ($count==($MAXCATEG-1)) { + //echo ''; + echo ''; + } + else + { + echo ''; + } + ?> + +
+
+
+
'< { ?>
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > - height="100%" id="proimg" /> -
+ '; + echo ''; + } + elseif ($count==($MAXPRODUCT-1)) { + //echo ''; + echo ''; + } + else + { + echo ''; + } + ?> + +
+
+
Date: Fri, 29 Mar 2019 12:19:23 +0100 Subject: [PATCH 198/222] New: When adding a product in POS, the line added is automatically selected so we can change immediatly qty or price --- htdocs/takepos/invoice.php | 48 +++++++++++++++++++++----------------- htdocs/takepos/takepos.php | 14 +++-------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 89ea0776949..11f68891df4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -168,7 +168,7 @@ if ($action == "addline") $price_base_type = $prod->multiprices_base_type[$customer->price_level]; } - $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $prod->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0); + $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $prod->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0); $invoice->fetch($placeid); } @@ -204,17 +204,21 @@ if ($action == "deleteline") { } } -if ($action == "updateqty") { +if ($action == "updateqty") +{ foreach($invoice->lines as $line) { - if ($line->id == $idline) { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); + if ($line->id == $idline) + { + $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } } $invoice->fetch($placeid); } -if ($action == "updateprice") { +if ($action == "updateprice") +{ foreach($invoice->lines as $line) { if ($line->id == $idline) { $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); @@ -224,7 +228,8 @@ if ($action == "updateprice") { $invoice->fetch($placeid); } -if ($action == "updatereduction") { +if ($action == "updatereduction") +{ foreach($invoice->lines as $line) { if ($line->id == $idline) { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); @@ -234,7 +239,8 @@ if ($action == "updatereduction") { $invoice->fetch($placeid); } -if ($action == "order" and $placeid != 0) { +if ($action == "order" and $placeid != 0) +{ include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $headerorder = '
' . $langs->trans('Place') . ' ' . $place . '
'; print ''; @@ -450,13 +450,19 @@ if ($placeid > 0) { $htmlforlines = ''; - $htmlforlines.= '
'; - $htmlforlines.= $line->product_label; + //if ($line->product_label) $htmlforlines.= ''.$line->product_label.''; + if (isset($line->product_type)) + { + if (empty($line->product_type)) $htmlforlines.=img_object('', 'product').' '; + else $htmlforlines.=img_object('', 'service').' '; + } + if ($line->product_label) $htmlforlines.= $line->product_label; if ($line->product_label && $line->desc) $htmlforlines.= '
'; if ($line->product_label != $line->desc) { diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 8e48a606483..24a57e17b52 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -117,9 +117,17 @@ var pageactions=0; var place=""; var editaction="qty"; var editnumber=""; + function PrintCategories(first) { + console.log("PrintCategories"); for (i = 0; i < ; i++) { - if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") break; + if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") + { + $("#catdesc"+i).text(""); + $("#catimg"+i).attr("src","genimg/empty.png"); + $("#catwatermark"+i).hide(); + continue; + } $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']); $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']); $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']); @@ -156,16 +164,19 @@ function MoreCategories(moreorless) { $("#catdiv"+i).data("rowid",categories[i+( * pagecategories)]['rowid']); $("#catwatermark"+i).show(); } + + $("#search").focus(); } function LoadProducts(position, issubcat=false) { + console.log("LoadProducts"); var maxproduct = ; $('#catimg'+position).animate({opacity: '0.5'}, 1); $('#catimg'+position).animate({opacity: '1'}, 100); if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid'); else currentcat=$('#catdiv'+position).data('rowid'); - if (currentcat==undefined) return; + if (currentcat == undefined) return; pageproducts=0; ishow=0; //product to show counter @@ -206,9 +217,12 @@ function LoadProducts(position, issubcat=false) { idata++; //Next data everytime } }); + + $("#search").focus(); } function MoreProducts(moreorless) { + console.log("MoreProducts"); var maxproduct = ; if (moreorless=="more"){ @@ -251,9 +265,12 @@ function MoreProducts(moreorless) { idata++; //Next data everytime } }); + + $("#search").focus(); } function ClickProduct(position) { + console.log("ClickProduct"); $('#proimg'+position).animate({opacity: '0.5'}, 1); $('#proimg'+position).animate({opacity: '1'}, 100); if ($('#prodiv'+position).data('iscat')==1){ @@ -269,15 +286,18 @@ function ClickProduct(position) { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } + $("#search").focus(); } function deleteline() { + console.log("Delete line"); $("#poslines").load("invoice.php?action=deleteline&place="+place+"&idline="+selectedline, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } function Customer() { + console.log("Open box to select the thirdparty"); $.colorbox({href:"../societe/list.php?contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"trans("Customer");?>"}); } @@ -288,30 +308,34 @@ function CloseBill() { } function Floors() { + console.log("Open box to select floor"); $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"trans("Floors");?>"}); } function FreeZone() { + console.log("Open box to enter a free product"); $.colorbox({href:"freezone.php?action=freezone&place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"trans("FreeZone");?>"}); } function TakeposOrderNotes() { + console.log("Open box to order notes"); $.colorbox({href:"freezone.php?action=addnote&place="+place+"&idline="+selectedline, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"trans("OrderNotes");?>"}); } function Refresh() { + console.log("Refresh"); $("#poslines").load("invoice.php?place="+place, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } -function Search() { - $("#poslines").load("invoice.php?action=search&place="+place, function() { - //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); - }); +function ClearSearch() { + console.log("ClearSearch"); + $("#search").val('').focus(); } function Search2() { + console.log("Search2"); pageproducts=0; $.getJSON('./ajax.php?action=search&term='+$('#search').val(), function(data) { for (i = 0; i < 30; i++) { @@ -329,20 +353,26 @@ function Search2() { }); } -function Edit(number){ +function Edit(number) { + + if (typeof(selectedtext) == "undefined") return; // We click on an action on the number pad but there is no line selected + var text=selectedtext+"
"; + if (number=='c'){ editnumber=""; Refresh(); return; } else if (number=='qty'){ + console.log("Edit "+number); if (editaction=='qty' && editnumber!=""){ $("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#qty").html("trans("Qty"); ?>"); }); + $("#search").focus(); return; } else { @@ -350,12 +380,14 @@ function Edit(number){ } } else if (number=='p'){ + console.log("Edit "+number); if (editaction=='p' && editnumber!=""){ $("#poslines").load("invoice.php?action=updateprice&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#price").html("trans("Price"); ?>"); }); + $("#search").focus(); return; } else { @@ -363,12 +395,14 @@ function Edit(number){ } } else if (number=='r'){ + console.log("Edit "+number); if (editaction=='r' && editnumber!=""){ $("#poslines").load("invoice.php?action=updatereduction&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#reduction").html("trans("ReductionShort"); ?>"); }); + $("#search").focus(); return; } else { @@ -400,18 +434,21 @@ function Edit(number){ } function TakeposPrintingOrder(){ + console.log("TakeposPrintingOrder"); $("#poslines").load("invoice.php?action=order&place="+place, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } function TakeposPrintingTemp(){ + console.log("TakeposPrintingTemp"); $("#poslines").load("invoice.php?action=temp&place="+place, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } function OpenDrawer(){ + console.log("OpenDrawer"); $.ajax({ type: "POST", url: 'http://global->TAKEPOS_PRINT_SERVER;?>:8111/print', @@ -466,8 +503,8 @@ $( document ).ready(function() { - - + + ''.$langs->trans("SearchProduct"), - 'action'=>'Search();'); -$menus[$r++]=array('title'=>$langs->trans("FreeZone"), - 'action'=>'FreeZone();'); -$menus[$r++]=array('title'=>''.$langs->trans("Customer"), - 'action'=>'Customer();'); -$menus[$r++]=array('title'=>''.$langs->trans("BackOffice"), - 'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');'); -$menus[$r++]=array('title'=>$langs->trans("DoPayment"), - 'action'=>'CloseBill();'); -$menus[$r++]=array('title'=>''.$langs->trans("Logout"), - 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); +//$menus[$r++]=array('title'=>''.$langs->trans("SearchProduct"), 'action'=>'Search();'); +$menus[$r++]=array('title'=>''.$langs->trans("Customer"), 'action'=>'Customer();'); +$menus[$r++]=array('title'=>''.$langs->trans("FreeZone"), 'action'=>'FreeZone();'); +$menus[$r++]=array('title'=>''.$langs->trans("Payment"), 'action'=>'CloseBill();'); // BAR RESTAURANT specific menu -if($conf->global->TAKEPOS_BAR_RESTAURANT){ - $menus[$r++]=array('title'=>$langs->trans("Floors"), 'action'=>'Floors();'); - if ($conf->global->TAKEPOS_ORDER_PRINTERS){ - $menus[$r++]=array('title'=>$langs->trans("Order"), - 'action'=>'TakeposPrintingOrder();'); +if ($conf->global->TAKEPOS_BAR_RESTAURANT) +{ + $menus[$r++]=array('title'=>''.$langs->trans("Floors"), 'action'=>'Floors();'); + if ($conf->global->TAKEPOS_ORDER_PRINTERS) + { + $menus[$r++]=array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();'); } //add temp ticket button - if ($conf->global->TAKEPOS_BAR_RESTAURANT){ - if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>$langs->trans("Receipt"),'action'=>'TakeposPrinting(placeid);'); - else $menus[$r++]=array('title'=>$langs->trans("Receipt"),'action'=>'Print(placeid);'); + if ($conf->global->TAKEPOS_BAR_RESTAURANT) + { + if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>''.$langs->trans("Receipt"),'action'=>'TakeposPrinting(placeid);'); + else $menus[$r++]=array('title'=>''.$langs->trans("Receipt"),'action'=>'Print(placeid);'); } - if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1){ - $menus[$r++]=array('title'=>$langs->trans("OrderNotes"), - 'action'=>'TakeposOrderNotes();'); + if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1) + { + $menus[$r++]=array('title'=>$langs->trans("OrderNotes"), 'action'=>'TakeposOrderNotes();'); } } -if ($conf->global->TAKEPOSCONNECTOR){ - $menus[$r++]=array( - 'title'=>$langs->trans("DOL_OPEN_DRAWER"), - 'action'=>'OpenDrawer();' - ); +if ($conf->global->TAKEPOSCONNECTOR) { + $menus[$r++]=array('title'=>$langs->trans("DOL_OPEN_DRAWER"), 'action'=>'OpenDrawer();'); } $hookmanager->initHooks(array('takeposfrontend')); @@ -543,34 +571,48 @@ if (!empty($reshook)) { $menus[$r++]=$reshook; } -?> -
-'', 'style'=>'visibility: hidden;'); -$i = 0; -foreach($menus as $menu) { - $i++; - if (count($menus)>9 and $i==9) - { - echo ''; - echo ''; - } - elseif ($i>9) echo ''; - else echo ''; -} +$menus[$r++]=array('title'=>''.$langs->trans("BackOffice"), 'action'=>'window.open(\''.(DOL_URL_ROOT ? DOL_URL_ROOT : '/').'\', \'_backoffice\');'); +$menus[$r++]=array('title'=>''.$langs->trans("Logout"), 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); + +?> + +
+ 9 and $i == 9) + { + echo ''; + echo ''; + } + elseif ($i>9) echo ''; + else echo ''; + } + + print ''."\n"; + print '
'; + print ' '; + print ''.img_picto('', 'searchclear').''; + print '
'; ?>
+ +
-
id='catdiv'> - width="100%" height="100%" id="catimg" /> +
id="catdiv"> + height="100%" id="catimg" />
@@ -582,16 +624,17 @@ foreach($menus as $menu) { ?>
+
-
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > - width="100%" height="100%" id="proimg" /> -
-
+
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > + height="100%" id="proimg" /> +
+
+
From 8d9a07de09ae80b0365fd661a3e02044d054493e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 19:02:47 +0100 Subject: [PATCH 193/222] Fix rounding --- htdocs/takepos/pay.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 3f9641b37d5..911bf6bebe3 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -117,7 +117,10 @@ else print "var received=0;"; ?> $('.change1').html(pricejs(parseFloat(received), 'MT')); $('.change1').val(parseFloat(received)); - if ((alreadypayed + parseFloat(received)) > total_ttc;?>) + alreadypaydplusreceived=price2numjs(alreadypayed + parseFloat(received)); + //console.log("already+received = "+alreadypaydplusreceived); + //console.log("total_ttc = "+total_ttc;?>); + if (alreadypaydplusreceived > total_ttc;?>) { var change=parseFloat(alreadypayed + parseFloat(received) - total_ttc;?>); $('.change2').html(pricejs(change, 'MT')); @@ -131,7 +134,7 @@ else print "var received=0;"; { $('.change2').html(pricejs(0, 'MT')); $('.change2').val(0); - if ((alreadypayed + parseFloat(received)) == total_ttc;?>) + if (alreadypaydplusreceived == total_ttc;?>) { $('.change1').removeClass('colorred'); $('.change1').addClass('colorgreen'); From 2996965c5023899ba0c99cfe38ad9945dd1f0177 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 19:33:22 +0100 Subject: [PATCH 194/222] Fix: autofocus is done only on dekstop. --- htdocs/takepos/pay.php | 5 ++++- htdocs/takepos/takepos.php | 29 +++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 911bf6bebe3..e95a8ac8346 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -205,11 +205,13 @@ $action_buttons = array( "function" =>"reset()", "span" => "style='font-size: 150%;'", "text" => "C", + "class" => "poscolorblue" ), array( "function" => "parent.$.colorbox.close();", "span" => "id='printtext'", "text" => $langs->trans("Cancel"), + "class" => "poscolordelete" ), ); $numpad=$conf->global->TAKEPOS_NUMPAD; @@ -271,8 +273,9 @@ while($i < count($paiements)){ } $class=($i==3)?"calcbutton3":"calcbutton2"; foreach($action_buttons as $button){ + $newclass = $class.($button["class"]?" ".$button["class"]:""); ?> - + diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 24a57e17b52..0375fe09ead 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -135,6 +135,13 @@ function PrintCategories(first) { } } +// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically +function setFocusOnSearchField() { + browser->layout == 'classic') { ?> + $("#search").focus(); + +} + function MoreCategories(moreorless) { console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories); if (moreorless=="more") { @@ -165,7 +172,7 @@ function MoreCategories(moreorless) { $("#catwatermark"+i).show(); } - $("#search").focus(); + setFocusOnSearchField(); } function LoadProducts(position, issubcat=false) { @@ -218,7 +225,7 @@ function LoadProducts(position, issubcat=false) { } }); - $("#search").focus(); + setFocusOnSearchField(); } function MoreProducts(moreorless) { @@ -266,7 +273,7 @@ function MoreProducts(moreorless) { } }); - $("#search").focus(); + setFocusOnSearchField(); } function ClickProduct(position) { @@ -286,7 +293,8 @@ function ClickProduct(position) { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); } - $("#search").focus(); + + setFocusOnSearchField(); } function deleteline() { @@ -331,7 +339,9 @@ function Refresh() { function ClearSearch() { console.log("ClearSearch"); - $("#search").val('').focus(); + $("#search").val(''); + + setFocusOnSearchField(); } function Search2() { @@ -372,7 +382,8 @@ function Edit(number) { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#qty").html("trans("Qty"); ?>"); }); - $("#search").focus(); + + setFocusOnSearchField(); return; } else { @@ -387,7 +398,8 @@ function Edit(number) { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#price").html("trans("Price"); ?>"); }); - $("#search").focus(); + + setFocusOnSearchField(); return; } else { @@ -402,7 +414,8 @@ function Edit(number) { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); $("#reduction").html("trans("ReductionShort"); ?>"); }); - $("#search").focus(); + + setFocusOnSearchField(); return; } else { From 458ef4df34f54638c3a6f2cd2cba6db3732ee521 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Mar 2019 20:33:41 +0100 Subject: [PATCH 195/222] Fix alignement on TakePOS receipt --- htdocs/takepos/receipt.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 262231f72b5..7f3d5bdc0cc 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -59,6 +59,17 @@ $object->fetch($facid); ?> +
'.$mysoc->name.'';?> From 1e9287c9d8d3d7e1b6aa4fdda673a6eb5e4d1dd9 Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Thu, 28 Mar 2019 23:57:17 +0100 Subject: [PATCH 196/222] 0.1 --- htdocs/langs/en_US/modulebuilder.lang | 7 +- htdocs/modulebuilder/admin/setup.php | 42 ++++++- htdocs/modulebuilder/index.php | 10 +- .../core/modules/modMyModule.class.php | 108 +++++------------- 4 files changed, 87 insertions(+), 80 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index c10f57aec43..8e2d57a03fc 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -104,4 +104,9 @@ ContentCantBeEmpty=Content of file can't be empty WidgetDesc=You can generate and edit here the widgets that will be embedded with your module. CLIDesc=You can generate here some command line scripts you want to provide with your module. CLIFile=CLI File -NoCLIFile=No CLI files \ No newline at end of file +NoCLIFile=No CLI files +UseSpecificEditorName = Use a specific editor name +UseSpecificEditorURL = Use a specific editor URL +UseSpecificFamily = Use a specific family +UseSpecificAuthor = Use a specific author +UseSpecificVersion = Use a specific initial version \ No newline at end of file diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index dfe8f681985..c409d18b2f1 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -40,7 +40,12 @@ if ($action=="update") $res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README', 'none'), 'chaine', 0, '', $conf->entity); $res2=dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTOR', GETPOST('MODULEBUILDER_ASCIIDOCTOR', 'nohtml'), 'chaine', 0, '', $conf->entity); $res3=dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTORPDF', GETPOST('MODULEBUILDER_ASCIIDOCTORPDF', 'nohtml'), 'chaine', 0, '', $conf->entity); - if ($res1 < 0 || $res2 < 0 || $res3 < 0) { + $res4=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_EDITOR_NAME', GETPOST('MODULEBUILDER_SPECIFIC_EDITOR_NAME', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res5=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_EDITOR_URL', GETPOST('MODULEBUILDER_SPECIFIC_EDITOR_URL', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res6=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_FAMILY', GETPOST('MODULEBUILDER_SPECIFIC_FAMILY', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res7=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_AUTHOR', GETPOST('MODULEBUILDER_SPECIFIC_AUTHOR', 'html'), 'chaine', 0, '', $conf->entity); + $res8=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_VERSION', GETPOST('MODULEBUILDER_SPECIFIC_VERSION', 'nohtml'), 'chaine', 0, '', $conf->entity); + if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0) { setEventMessages('ErrorFailedToSaveDate', null, 'errors'); $db->rollback(); } @@ -125,6 +130,41 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } } print '
' . $langs->trans("UseSpecificEditorName") . ''; + print ''; + print '
' . $langs->trans("UseSpecificEditorURL") . ''; + print ''; + print '
' . $langs->trans("UseSpecificFamily") . ''; + print ''; + print '
' . $langs->trans("UseSpecificAuthor") . ''; + print ''; + print '
' . $langs->trans("UseSpecificVersion") . ''; + print ''; + print '
'; @@ -315,13 +321,23 @@ var selectedline=0; var selectedtext=""; var placeid= 0 ? $placeid : 0);?>; $(document).ready(function() { - $('table tbody tr').click(function(){ - $('table tbody tr').removeClass("selected"); + var idoflineadded = ; + + $('.posinvoiceline').click(function(){ + console.log("Click done on "+this.id); + $('.posinvoiceline').removeClass("selected"); $(this).addClass("selected"); if (selectedline==this.id) return; // If is already selected - else selectedline=this.id; + else selectedline=this.id; selectedtext=$('#'+selectedline).find("td:first").html(); }); + + /* Autoselect the line */ + if (idoflineadded > 0) + { + console.log("Auto select "+idoflineadded); + $('.posinvoiceline#'+idoflineadded).click(); + } - - $('table tbody tr').click(function(){ - console.log("We click on a line"); - $('table tbody tr').removeClass("selected"); - $(this).addClass("selected"); - if (selectedline==this.id) return; // If is already selected - else selectedline=this.id; - selectedtext=$('#'+selectedline).find("td:first").html(); - }); - @@ -439,7 +443,7 @@ print '
'.$sectionwithinvoicelink; print ''; print '
'; print ''; -print ''; +print ''; print "\n"; if ($placeid > 0) diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index fbfa8a6e975..0950851054b 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -153,18 +153,10 @@ function ClearSearch() { // Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically function setFocusOnSearchField() { console.log("Call setFocusOnSearchField in page takepos.php"); - browser->layout == 'classic') { - ?> - if (app.hasKeyboard) - { + browser->layout == 'classic') { ?> console.log("has keyboard from localStorage, so we can force focus on search field"); $("#search").focus(); - } - + } function PrintCategories(first) { @@ -653,7 +645,7 @@ $menus[$r++]=array('title'=>'< print ''."\n"; print '
'; print ' '; - print ''.img_picto('', 'searchclear').''; + print ''.img_picto('', 'searchclear').''; print '
'; ?> From b0b69033b75e4aa4bea92cd4e65d79f2903b34b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 12:27:54 +0100 Subject: [PATCH 199/222] Use a background color to identify line selected --- htdocs/takepos/css/pos.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 53593e61035..716387cab3d 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -224,8 +224,9 @@ table.postablelines tr td { padding-left: 5px; } -.selected { - font-weight: bold; +tr.selected, tr.selected td { + /* font-weight: bold; */ + background-color: rgb(245,230,240) !important; } .order { color: limegreen; From b3515e9994b199e605864c8acb2accce81f7952a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 12:35:33 +0100 Subject: [PATCH 200/222] css --- htdocs/takepos/css/pos.css | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 716387cab3d..7263c050455 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -128,15 +128,7 @@ table.postablelines tr td { .posinvoiceline td { height: 40px !important; } -.poscolordelete { - color: #600; -} -.poscolorgreen { - color: #060; -} -.poscolorblue { - color: #006; -} + @media only screen and (max-aspect-ratio: 6/4) { div.description{ min-height:20%; @@ -226,7 +218,7 @@ table.postablelines tr td { tr.selected, tr.selected td { /* font-weight: bold; */ - background-color: rgb(245,230,240) !important; + background-color: rgb(210,200,190) !important; } .order { color: limegreen; @@ -241,6 +233,15 @@ tr.selected, tr.selected td { .colorgreen { color: green; } +.poscolordelete { + color: #844; +} +.poscolorgreen { + color: #060; +} +.poscolorblue { + color: #006; +} .centerinmiddle { transform: translate(0,-50%); From 76c5e965559bb83b09402cdf5e02a8203b745512 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 12:38:32 +0100 Subject: [PATCH 201/222] css --- htdocs/takepos/css/pos.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 7263c050455..041f4f56bee 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -218,7 +218,7 @@ table.postablelines tr td { tr.selected, tr.selected td { /* font-weight: bold; */ - background-color: rgb(210,200,190) !important; + background-color: rgb(240,230,210) !important; } .order { color: limegreen; From f1db09fc4f96ca60c0903cc781a551704dd310bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 13:18:12 +0100 Subject: [PATCH 202/222] Shwo field time billed and not billed on list of tasks --- htdocs/langs/en_US/projects.lang | 2 + htdocs/projet/tasks/list.php | 131 +++++++++++++++++++++++-------- 2 files changed, 99 insertions(+), 34 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 0ff4b7b1cb8..4c089ba97b4 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -57,6 +57,8 @@ NewTimeSpent=Time spent MyTimeSpent=My time spent BillTime=Bill the time spent BillTimeShort=Bill time +TimeToBill=Time not billed +TimeBilled=Time billed Tasks=Tasks Task=Task TaskDateStart=Task start date diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 2b2055fcd46..80b6888f1e3 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2016 Laurent Destailleur + * Copyright (C) 2006-2019 Laurent Destailleur * Copyright (C) 2006-2010 Regis Houssin * Copyright (C) 2018 Ferran Marcet * @@ -121,7 +121,9 @@ $arrayfields=array( 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103), 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104), 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.tobill'=>array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>110), + 't.billed'=>array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>111), + 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), //'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); @@ -203,6 +205,12 @@ $tuser=new User($db); if ($search_project_user > 0) $puser->fetch($search_project_user); if ($search_task_user > 0) $tuser->fetch($search_task_user); + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + + $title=$langs->trans("Activities"); //if ($search_task_user == $user->id) $title=$langs->trans("MyActivities"); @@ -247,13 +255,18 @@ if ($resql) else dol_print_error($db); if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found -$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. -$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate"; -$sql.= ", s.nom as name, s.rowid as socid"; -$sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; -$sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; +$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is assigned only once. +$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.bill_time,"; +$sql.= " s.nom as name, s.rowid as socid,"; +$sql.= " t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update,"; +$sql.= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; // We'll need these fields in order to filter by categ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; +// Add sum fields +if (! empty($arrayfields['t.tobill']['checked']) || ! empty($arrayfields['t.billed']['checked'])) +{ + $sql.=" , SUM(tt.task_duration * ".$db->ifsql("invoice_id IS NULL", "1", "0").") as tobill, SUM(tt.task_duration * ".$db->ifsql("invoice_id IS NULL", "0", "1").") as billed"; +} // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks @@ -265,6 +278,10 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; // We'll need this table joined to the select in order to filter by categ if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; +if (! empty($arrayfields['t.tobill']['checked']) || ! empty($arrayfields['t.billed']['checked'])) +{ + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; +} if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as ef on (t.rowid = ef.fk_object)"; if ($search_project_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; if ($search_task_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ect"; @@ -279,7 +296,7 @@ if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); if ($search_project_title) $sql .= natural_search('p.title', $search_project_title); if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref); if ($search_task_label) $sql .= natural_search('t.label', $search_task_label); -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_smonth > 0) { if ($search_syear > 0 && empty($search_sday)) @@ -321,6 +338,15 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; +if (! empty($arrayfields['t.tobill']['checked']) || ! empty($arrayfields['t.billed']['checked'])) +{ + $sql.=" GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,"; + $sql.=" s.nom, s.rowid,"; + $sql.=" t.datec, t.dateo, t.datee, t.tms,"; + $sql.=" t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; + if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; + foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); +} $sql.= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; @@ -362,27 +388,27 @@ $help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url); $param=''; -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; -if ($search_sday) $param.='&search_sday='.$search_sday; -if ($search_smonth) $param.='&search_smonth='.$search_smonth; -if ($search_syear) $param.='&search_syear=' .$search_syear; -if ($search_eday) $param.='&search_eday='.$search_eday; -if ($search_emonth) $param.='&search_emonth='.$search_emonth; -if ($search_eyear) $param.='&search_eyear=' .$search_eyear; -if ($socid) $param.='&socid='.$socid; -if ($search_all != '') $param.='&search_all='.$search_all; -if ($search_project_ref != '') $param.='&search_project_ref='.$search_project_ref; -if ($search_project_title != '') $param.='&search_project_title='.$search_project_title; -if ($search_ref != '') $param.='&search_ref='.$search_ref; -if ($search_label != '') $param.='&search_label='.$search_label; -if ($search_societe != '') $param.='&search_societe='.$search_societe; -if ($search_projectstatus != '') $param.='&search_projectstatus='.$search_projectstatus; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +if ($search_sday) $param.='&search_sday='.urlencode($search_sday); +if ($search_smonth) $param.='&search_smonth='.urlencode($search_smonth); +if ($search_syear) $param.='&search_syear=' .urlencode($search_syear); +if ($search_eday) $param.='&search_eday='.urlencode($search_eday); +if ($search_emonth) $param.='&search_emonth='.urlencode($search_emonth); +if ($search_eyear) $param.='&search_eyear=' .urlencode($search_eyear); +if ($socid) $param.='&socid='.urlencode($socid); +if ($search_all != '') $param.='&search_all='.urlencode($search_all); +if ($search_project_ref != '') $param.='&search_project_ref='.urlencode($search_project_ref); +if ($search_project_title != '') $param.='&search_project_title='.urlencode($search_project_title); +if ($search_ref != '') $param.='&search_ref='.urlencode($search_ref); +if ($search_label != '') $param.='&search_label='.urlencode($search_label); +if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe); +if ($search_projectstatus != '') $param.='&search_projectstatus='.urlencode($search_projectstatus); if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); -if ($search_public != '') $param.='&search_public='.$search_public; -if ($search_project_user != '') $param.='&search_project_user='.$search_project_user; -if ($search_task_user > 0) $param.='&search_task_user='.$search_task_user; -if ($optioncss != '') $param.='&optioncss='.$optioncss; +if ($search_public != '') $param.='&search_public='.urlencode($search_public); +if ($search_project_user != '') $param.='&search_project_user='.urlencode($search_project_user); +if ($search_task_user > 0) $param.='&search_task_user='.urlencode($search_task_user); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -477,9 +503,6 @@ if (! empty($moreforfilter)) print ''; } -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print '
' . $langs->trans("Label") . '' . $langs->trans("Qty") . '
' . $langs->trans('ReductionShort') . '' . $langs->trans('Qty') . '' . $langs->trans('TotalHTShort') . '' . $langs->trans('TotalHTShort') . '
'."\n"; @@ -546,6 +569,8 @@ if (! empty($arrayfields['t.planned_workload']['checked'])) print ''; if (! empty($arrayfields['t.progress_calculated']['checked'])) print ''; if (! empty($arrayfields['t.progress']['checked'])) print ''; +if (! empty($arrayfields['t.tobill']['checked'])) print ''; +if (! empty($arrayfields['t.billed']['checked'])) print ''; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -584,6 +609,8 @@ if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_ if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.tobill']['checked'])) print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.billed']['checked'])) print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -761,6 +788,40 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; } + // Time not billed + if (! empty($arrayfields['t.tobill']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaltobillfield']=$totalarray['nbfield']; + } + // Time billed + if (! empty($arrayfields['t.billed']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalbilledfield']=$totalarray['nbfield']; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook @@ -807,9 +868,9 @@ while ($i < min($num, $limit)) $i++; } - // Show total line -if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield'])) +if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield']) + || isset($totalarray['totaltobill']) || isset($totalarray['totalbilled'])) { print ''; $i=0; @@ -823,7 +884,9 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota } elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; - elseif ($totalarray['totalprogress_calculated'] == $i) print ''; + elseif ($totalarray['totalprogress_calculatedfield'] == $i) print ''; + elseif ($totalarray['totaltobillfield'] == $i) print ''; + elseif ($totalarray['totalbilledfield'] == $i) print ''; else print ''; } print ''; From 1b2826f476e6efcb0aeb909b17dfb34caa3d4a5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 13:26:26 +0100 Subject: [PATCH 203/222] Look and feel v10 --- htdocs/adherents/document.php | 2 +- htdocs/asset/document.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/compta/bank/document.php | 2 +- htdocs/compta/bank/various_payment/document.php | 2 +- htdocs/compta/deplacement/document.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/salaries/document.php | 2 +- htdocs/compta/sociales/document.php | 2 +- htdocs/compta/tva/document.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/don/document.php | 2 +- htdocs/expedition/document.php | 4 ++-- htdocs/expensereport/document.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/facture/document.php | 4 ++-- htdocs/holiday/document.php | 4 ++-- htdocs/loan/document.php | 2 +- htdocs/product/document.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/tasks/document.php | 6 +++--- htdocs/resource/document.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/supplier_proposal/document.php | 2 +- htdocs/user/document.php | 2 +- 28 files changed, 33 insertions(+), 33 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index d88d775e0c1..2de98e1b96a 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -113,7 +113,7 @@ if ($id > 0) print '
'; print '
'; - print '
'; + if ($obj->bill_time) + { + print convertSecondToTime($obj->tobill, 'allhourmin'); + $totalarray['totaltobill'] += $obj->tobill; + } + else + { + print ''.$langs->trans("NA").''; + } + print ''; + if ($obj->bill_time) + { + print convertSecondToTime($obj->billed, 'allhourmin'); + $totalarray['totalbilled'] += $obj->billed; + } + else + { + print ''.$langs->trans("NA").''; + } + print '
'.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'
'; + print '
'; $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 3359d5539b5..61be1ad51d6 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -117,7 +117,7 @@ if ($object->id) print '
'; print '
'; - print '
'; + print '
'; // Number of files print ''; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 18d7edd1f03..4c464db4693 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -155,7 +155,7 @@ if ($object->id > 0) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; + print '
'; // Files infos print ''; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 9c706bda200..37cbc70cd40 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; + print '
'; print ''; print ''; diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 06fc4752d31..5b887f0bd8e 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) { print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print '
'; print ''; print ''; print "
' . $langs->trans("NbOfAttachedFiles") . '' . count($filearray) . '
' . $langs->trans("TotalSizeOfAttachedFiles") . '' .dol_print_size($totalsize, 1, 1).'
\n"; diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 58cb526d566..36e8546a897 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -131,7 +131,7 @@ if ($object->id) $totalsize+=$file['size']; } - print ''; + print '
'; print ''; print ''; diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index c94a527d575..8cba95e283b 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -100,7 +100,7 @@ if ($object->id) } - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + print '
'; $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 9ddefd0ede4..44f69f512bd 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -165,7 +165,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print '
'; + print '
'; print ''; print ''; diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 5335b8fc39e..3ff92d23c1c 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -114,7 +114,7 @@ if ($object->id) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print '
'; print ''; print ''; print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 87bef4e69d1..1025f7b11ed 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -145,7 +145,7 @@ if ($object->id) } - print ''; + print '
'; print ''; print ''; diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index bb8819f9588..78a1029b2f4 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -131,7 +131,7 @@ if ($object->id) } - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print '
'; print ''; print ''; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 1f2f895fed8..86f2dc8c3c9 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -124,7 +124,7 @@ if ($object->id) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print '
'; // Company /* diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 64ecff642f7..27d97572529 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -178,7 +178,7 @@ if ($object->id) print '
'; - print '
'; + print '
'; print ''; print ''; print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; diff --git a/htdocs/don/document.php b/htdocs/don/document.php index d0308ab89f4..fcb3c87ad9d 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -157,7 +157,7 @@ if ($object->id) print '
'; print '
'; - print ''; + print '
'; // Ref /* diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index cacc6a874ac..5c178cbdaf2 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)){ $head = shipping_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("Shipment"), -1, 'sending'); - + // Build file list $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); @@ -159,7 +159,7 @@ if ($id > 0 || ! empty($ref)){ print '
'; print '
'; - print '
'; + print '
'; print ''; print ''; diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index b1be48ffc76..f5295118bda 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -114,7 +114,7 @@ if ($object->id) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print '
'; $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index a23eab2ae2c..d5aed88079a 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -154,7 +154,7 @@ if ($object->id) print '
'; print '
'; - print '
'; + print '
'; print ''; print ''; print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 2c1fce8f6d2..f933ecfdb5f 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -160,7 +160,7 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; print ''; print ''; print "
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
\n"; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index ec4003dcfb7..55075a5014f 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -160,7 +160,7 @@ if ($object->id > 0) print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); } - print ''; + print '
'; // Type print '
'.$langs->trans('Type').''; @@ -232,7 +232,7 @@ if ($object->id > 0) print '
'; - print ''; + print '
'; // Nb of files print ''; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 942b6cb98fb..a594a920e74 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -118,7 +118,7 @@ if ($object->id) //print '
'; print '
'; - print '
'.$langs->trans('NbOfAttachedFiles').''.count($filearray).'
'; + print '
'; print ''; print ''; @@ -223,7 +223,7 @@ if ($object->id) print '
'; // Info workflow - print '
'.$langs->trans("User").'
'."\n"; + print '
'."\n"; print ''; if (! empty($object->fk_user_create)) diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index eeee232befb..0b7e23bbd3f 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -143,7 +143,7 @@ if ($object->id) } - print '
'; + print '
'; print ''; print ''; print "
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
\n"; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 9c2f45c0159..94db650a519 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -223,7 +223,7 @@ if ($object->id) print '
'; print '
'; - print ''; + print '
'; print ''; print ''; diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 20b2bd708dd..51469b8d2f6 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -135,7 +135,7 @@ if ($object->id > 0) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print '
'; // Files infos print ''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 49bf3d02ad8..2b2f6ab4176 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -163,7 +163,7 @@ if ($object->id > 0) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; + print '
'; // Visibility print '
'.$langs->trans("Visibility").''; @@ -197,7 +197,7 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; // Description print '
'.$langs->trans("Description").''; @@ -266,7 +266,7 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; // Files infos print ''; diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index 5bef25f9824..5e6227a9e1d 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -113,7 +113,7 @@ if ($object->id) print '
'; print '
'; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; + print '
'; // Resource type print ''; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 2337763032c..6886c631e37 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -118,7 +118,7 @@ if ($object->id) print '
'; print '
'; - print '
'; + print '
'; // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index f226391e3f7..458ade41309 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -148,7 +148,7 @@ if ($object->id > 0) print '
'; print '
'; - print '
'; + print '
'; print ''; print ''; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 8d96157416a..63d527dc33c 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -149,7 +149,7 @@ if ($object->id) } - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print '
'; // Login print ''; From 9a34e5847434a08cdb3b8096a58cd6b9622557b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 13:39:59 +0100 Subject: [PATCH 204/222] Fix regression in mass action --- htdocs/projet/tasks/list.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 80b6888f1e3..7293850f212 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -208,7 +208,6 @@ if ($search_task_user > 0) $tuser->fetch($search_task_user); $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); $title=$langs->trans("Activities"); @@ -217,7 +216,7 @@ $title=$langs->trans("Activities"); if ($id) { $projectstatic->fetch($id); - $projectstatic->societe->fetch($projectstatic->societe->id); + $projectstatic->fetch_thirdparty(); } // Get list of project id allowed to user (in a string list separated by coma) @@ -288,6 +287,7 @@ if ($search_task_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ect $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity IN (".getEntity('project').')'; if (! $user->rights->projet->all->lire) $sql.=" AND p.rowid IN (".($projectsListId?$projectsListId:'0').")"; // public and assigned to projects, or restricted to company for external users +if (is_object($projectstatic) && $projectstatic->id > 0) $sql.=" AND p.rowid = ".$projectstatic->id; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); @@ -408,7 +408,7 @@ if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($sea if ($search_public != '') $param.='&search_public='.urlencode($search_public); if ($search_project_user != '') $param.='&search_project_user='.urlencode($search_project_user); if ($search_task_user > 0) $param.='&search_task_user='.urlencode($search_task_user); -if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -503,6 +503,7 @@ if (! empty($moreforfilter)) print ''; } +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print '
'.$langs->trans("Login").''.$object->login.' 
'."\n"; From 697a2e557639d1bb19ef7cc4f640b6a27c59bf6b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 14:34:55 +0100 Subject: [PATCH 205/222] Show time to bill and billed in list of tasks --- htdocs/core/lib/project.lib.php | 95 +++++++++++++++++------ htdocs/projet/class/task.class.php | 35 ++++++++- htdocs/projet/tasks.php | 118 +++++++++++++++++++++++------ htdocs/projet/tasks/list.php | 2 +- 4 files changed, 199 insertions(+), 51 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 92df28d9922..d7711b510da 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -334,20 +334,21 @@ function project_admin_prepare_head() /** * Show task lines with a particular parent * - * @param string $inc Line number (start to 0, then increased by recursive call) - * @param string $parent Id of parent project to show (0 to show all) - * @param Task[] $lines Array of lines - * @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature. - * @param string $var Color - * @param int $showproject Show project columns - * @param int $taskrole Array of roles of user for each tasks - * @param int $projectsListId List of id of project allowed to user (string separated with comma) - * @param int $addordertick Add a tick to move task - * @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project) + * @param string $inc Line number (start to 0, then increased by recursive call) + * @param string $parent Id of parent project to show (0 to show all) + * @param Task[] $lines Array of lines + * @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature. + * @param string $var Color + * @param int $showproject Show project columns + * @param int $taskrole Array of roles of user for each tasks + * @param int $projectsListId List of id of project allowed to user (string separated with comma) + * @param int $addordertick Add a tick to move task + * @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project) * @param string $filterprogresscalc filter text + * @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled' * @return void */ -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '') +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime=0) { global $user, $bc, $langs, $conf, $db; global $projectstatic, $taskstatic; @@ -370,12 +371,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $numlines=count($lines); // We declare counter as global because we want to edit them into recursive call - global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned; + global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned,$total_projectlinesa_tobill,$total_projectlinesa_billed; if ($level == 0) { $total_projectlinesa_spent=0; $total_projectlinesa_planned=0; $total_projectlinesa_spent_if_planned=0; + $total_projectlinesa_tobill=0; + $total_projectlinesa_billed=0; } for ($i = 0 ; $i < $numlines ; $i++) @@ -439,15 +442,25 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''."\n"; + $projectstatic->id=$lines[$i]->fk_project; + $projectstatic->ref=$lines[$i]->projectref; + $projectstatic->public=$lines[$i]->public; + $projectstatic->title=$lines[$i]->projectlabel; + $projectstatic->bill_time=$lines[$i]->bill_time; + + $taskstatic->id=$lines[$i]->id; + $taskstatic->ref=$lines[$i]->ref; + $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); + $taskstatic->projectstatus = $lines[$i]->projectstatus; + $taskstatic->progress = $lines[$i]->progress; + $taskstatic->fk_statut = $lines[$i]->status; + $taskstatic->datee = $lines[$i]->date_end; + if ($showproject) { // Project ref print "'; @@ -495,10 +505,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Date end print ''; @@ -548,6 +554,35 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } print ''; + if ($showbilltime) + { + // Time not billed + print ''; + + // Time billed + print ''; + } + // Contacts of task if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { @@ -582,7 +617,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($level >= 0) // Call sublevels { $level++; - if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); + if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime); $level--; } @@ -597,7 +632,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } - if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level <= 0) + if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0) + && $level <= 0) { print ''; print ''; @@ -617,6 +653,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %'; print ''; print ''; + if ($showbilltime) + { + print ''; + print ''; + } // Contacts of task if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 73a6d9d2493..ba7130ff031 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -729,9 +729,10 @@ class Task extends CommonObject * @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...') * @param string $filteronprojuser Filter on user that is a contact of project * @param string $filterontaskuser Filter on user assigned to task + * @param int $includebilltime Calculate also the time to bill and billed * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $includebilltime = 0) { global $conf; @@ -742,10 +743,14 @@ class Task extends CommonObject // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT "; if ($filteronprojuser > 0 || $filterontaskuser > 0) $sql.= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task - $sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus,"; + $sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.bill_time,"; $sql.= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; $sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; $sql.= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email"; + if ($includebilltime) + { + $sql.=" , SUM(tt.task_duration * ".$this->db->ifsql("invoice_id IS NULL", "1", "0").") as tobill, SUM(tt.task_duration * ".$this->db->ifsql("invoice_id IS NULL", "0", "1").") as billed"; + } $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; if ($mode == 0) @@ -756,6 +761,10 @@ class Task extends CommonObject $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; } $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; + if ($includebilltime) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; + } if ($filterontaskuser > 0) { $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2"; @@ -774,12 +783,20 @@ class Task extends CommonObject if ($filterontaskuser > 0) { $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; + if ($includebilltime) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; + } $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2"; $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; } else { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; + if ($includebilltime) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; + } } $sql.= " WHERE p.entity IN (".getEntity('project').")"; } @@ -809,6 +826,15 @@ class Task extends CommonObject if ($filteronproj) $sql.= natural_search(array("p.ref", "p.title"), $filteronproj); if ($filteronprojstatus && $filteronprojstatus != '-1') $sql.= " AND p.fk_statut IN (".$filteronprojstatus.")"; if ($morewherefilter) $sql.=$morewherefilter; + if ($includebilltime) + { + $sql.=" GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.bill_time,"; + $sql.=" t.datec, t.dateo, t.datee, t.tms,"; + $sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; + $sql.=" t.dateo, t.datee, t.planned_workload, t.rang,"; + $sql.=" s.rowid, s.nom, s.email"; + } + $sql.= " ORDER BY p.ref, t.rang, t.dateo"; //print $sql;exit; @@ -849,12 +875,17 @@ class Task extends CommonObject $tasks[$i]->projectref = $obj->ref; $tasks[$i]->projectlabel = $obj->plabel; $tasks[$i]->projectstatus = $obj->projectstatus; + $tasks[$i]->bill_time = $obj->bill_time; $tasks[$i]->label = $obj->label; $tasks[$i]->description = $obj->description; $tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated $tasks[$i]->fk_task_parent = $obj->fk_task_parent; $tasks[$i]->duration = $obj->duration_effective; $tasks[$i]->planned_workload= $obj->planned_workload; + + $tasks[$i]->tobill = $obj->tobill; + $tasks[$i]->billed = $obj->billed; + $tasks[$i]->progress = $obj->progress; $tasks[$i]->fk_statut = $obj->status; $tasks[$i]->public = $obj->public; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 915ac8b9bd4..1375a7a4844 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -19,7 +19,7 @@ /** * \file htdocs/projet/tasks.php - * \ingroup projet + * \ingroup project * \brief List all tasks of a project */ @@ -33,12 +33,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Load translation files required by the page -$langs->loadLangs(array("users", "projects")); +$langs->loadLangs(array('projects', 'users', 'companies')); + +$action = GETPOST('action', 'alpha'); +$massaction=GETPOST('massaction', 'alpha'); +$show_files=GETPOST('show_files', 'int'); +$confirm=GETPOST('confirm', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $taskref = GETPOST('taskref', 'alpha'); -$action = GETPOST('action', 'alpha'); + $backtopage=GETPOST('backtopage', 'alpha'); $cancel=GETPOST('cancel', 'alpha'); @@ -78,6 +84,8 @@ $socid=0; //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. $result = restrictedArea($user, 'projet', $id, 'projet&project'); +$diroutputmassaction=$conf->projet->dir_output . '/tasks/temp/massgeneration/'.$user->id; + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projecttaskscard','globalcard')); @@ -90,6 +98,34 @@ $planned_workload=$planned_workloadhour*3600+$planned_workloadmin*60; $userAccess=0; +$arrayfields=array( + 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), + 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), + 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), + 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), + 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), + 'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0), + 'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1), + 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>102), + 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103), + 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104), + 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105), + 't.tobill'=>array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>110), + 't.billed'=>array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>111), + 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + //'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); + } +} + /* * Actions @@ -99,24 +135,38 @@ $parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -// Purge search criteria -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers +if (empty($reshook)) { - $search_user_id=""; - $search_taskref=''; - $search_tasklabel=''; - $search_dtstartday=''; - $search_dtstartmonth=''; - $search_dtstartyear=''; - $search_dtendday=''; - $search_dtendmonth=''; - $search_dtendyear=''; - $search_planedworkload=''; - $search_timespend=''; - $search_progresscalc=''; - $search_progressdeclare=''; - $toselect=''; - $search_array_options=array(); + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers + { + $search_user_id=""; + $search_taskref=''; + $search_tasklabel=''; + $search_dtstartday=''; + $search_dtstartmonth=''; + $search_dtstartyear=''; + $search_dtendday=''; + $search_dtendmonth=''; + $search_dtendyear=''; + $search_planedworkload=''; + $search_timespend=''; + $search_progresscalc=''; + $search_progressdeclare=''; + $toselect=''; + $search_array_options=array(); + } + + // Mass actions + $objectclass='Task'; + $objectlabel='Tasks'; + $permtoread = $user->rights->projet->lire; + $permtodelete = $user->rights->projet->supprimer; + $uploaddir = $conf->projet->dir_output.'/tasks'; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } $morewherefilterarray=array(); @@ -297,11 +347,17 @@ if ($action == 'createtask' && $user->rights->projet->creer) * View */ +$now = dol_now(); $form=new Form($db); $formother=new FormOther($db); +$socstatic=new Societe($db); +$projectstatic = new Project($db); $taskstatic = new Task($db); $userstatic=new User($db); +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $title=$langs->trans("Project").' - '.$langs->trans("Tasks").' - '.$object->ref.' '.$object->name; if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Tasks"); $help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; @@ -624,7 +680,7 @@ elseif ($id > 0 || ! empty($ref)) // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). $filteronthirdpartyid = $socid; - $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter); + $tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, 1); // We load also tasks limited to a particular user $tmpuser=new User($db); if ($search_user_id > 0) $tmpuser->fetch($search_user_id); @@ -699,6 +755,15 @@ elseif ($id > 0 || ! empty($ref)) print ''; print ''; + if ($object->bill_time) + { + print ''; + + print ''; + } + if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; // Action column @@ -718,6 +783,11 @@ elseif ($id > 0 || ! empty($ref)) print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + if ($object->bill_time) + { + print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + } if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -726,11 +796,13 @@ elseif ($id > 0 || ! empty($ref)) { // Show all lines in taskarray (recursive function to go down on tree) $j=0; $level=0; - $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc); + $nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->bill_time?1:0)); } else { - print ''; + $colspan=10; + if ($object->bill_time) $colspan+=2; + print ''; } print "
"; //if ($showlineingray) print ''; - $projectstatic->id=$lines[$i]->fk_project; - $projectstatic->ref=$lines[$i]->projectref; - $projectstatic->public=$lines[$i]->public; - $projectstatic->title=$lines[$i]->projectlabel; if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); else print $projectstatic->getNomUrl(1, 'nolink'); //if ($showlineingray) print ''; @@ -468,9 +481,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } else { - $taskstatic->id=$lines[$i]->id; - $taskstatic->ref=$lines[$i]->ref; - $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); print $taskstatic->getNomUrl(1, 'withproject'); } print ''; - $taskstatic->projectstatus = $lines[$i]->projectstatus; - $taskstatic->progress = $lines[$i]->progress; - $taskstatic->fk_statut = $lines[$i]->status; - $taskstatic->datee = $lines[$i]->date_end; print dol_print_date($lines[$i]->date_end, 'dayhour'); if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); print ''; + if ($lines[$i]->bill_time) + { + print convertSecondToTime($lines[$i]->tobill, 'allhourmin'); + $total_projectlinesa_tobill += $lines[$i]->tobill; + } + else + { + print ''.$langs->trans("NA").''; + } + print ''; + if ($lines[$i]->bill_time) + { + print convertSecondToTime($lines[$i]->billed, 'allhourmin'); + $total_projectlinesa_billed += $lines[$i]->billed; + } + else + { + print ''.$langs->trans("NA").''; + } + print '
'.$langs->trans("Total").''; + print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin'); + print ''; + print convertSecondToTime($total_projectlinesa_billed, 'allhourmin'); + print ''; + print ''; + print '
'.$langs->trans("NoTasks").'
'.$langs->trans("NoTasks").'
"; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 7293850f212..a7906b63b3c 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -21,7 +21,7 @@ /** * \file htdocs/projet/tasks/list.php * \ingroup project - * \brief List all task of a project + * \brief List all tasks of a project */ require "../../main.inc.php"; From ecc7afa4e3ed9ebf3959b9aefa75e5ed28f0efe6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 15:27:00 +0100 Subject: [PATCH 206/222] Removed duplicate code --- htdocs/langs/en_US/projects.lang | 4 +- htdocs/projet/tasks/time.php | 196 ++++++++++--------------------- 2 files changed, 63 insertions(+), 137 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 4c089ba97b4..df0563383c0 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -116,7 +116,7 @@ ConfirmCloseAProject=Are you sure you want to close this project? AlsoCloseAProject=Also close project (keep it open if you still need to follow production tasks on it) ReOpenAProject=Open project ConfirmReOpenAProject=Are you sure you want to re-open this project? -ProjectContact=Project contacts +ProjectContact=Contacts of project TaskContact=Task contacts ActionsOnProject=Events on project YouAreNotContactOfProject=You are not a contact of this private project @@ -125,7 +125,7 @@ DeleteATimeSpent=Delete time spent ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent? DoNotShowMyTasksOnly=See also tasks not assigned to me ShowMyTasksOnly=View only tasks assigned to me -TaskRessourceLinks=Contacts task +TaskRessourceLinks=Contacts of task ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party NoTasks=No tasks for this project LinkedToAnotherCompany=Linked to other third party diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4f0567c51f3..7c632f1fb63 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -44,6 +44,7 @@ $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $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', 'alpha'); $id = GETPOST('id', 'int'); $projectid = GETPOST('projectid', 'int'); @@ -571,36 +572,46 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; } - // Link to create time - //if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) - //{ - if ($user->rights->projet->all->creer || $user->rights->projet->creer) - { - if ($projectstatic->public || $userWrite > 0) - { - if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project - { - $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - else // We are on tab 'Time Spent' of task - { - $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - //} + // Link to create time + if ($user->rights->projet->all->creer || $user->rights->projet->creer) + { + if ($projectstatic->public || $userWrite > 0) + { + if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project + { + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + else // We are on tab 'Time Spent' of task + { + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } } + $massactionbutton = ''; + if ($projectstatic->bill_time) + { + $arrayofmassactions = array( + 'generateinvoice'=>$langs->trans("GenerateBill"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete"); + if (in_array($massaction, array('presend','predelete','generateinvoice'))) $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + } + + // Show section with information of task. If id of task is not defined and project id defined, then $projectidforalltimes is not empty. if (empty($projectidforalltimes)) { $head=task_prepare_head($object); @@ -645,7 +656,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Date start - Date end print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; @@ -671,7 +682,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print ''; + print '
'; // Progress declared print ' - - + '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

'.$product->description_short->language[$this->lang - 1].' + diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index c735362d87f..d06f5d393d9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -888,7 +888,8 @@ if ($mode == 'marketplace') { // $options is array with filter criterias //var_dump($options); - $dolistore->getRemoteData($options); + $dolistore->getRemoteCategories(); + $dolistore->getRemoteProducts($options); print ''.$langs->trans('DOLISTOREdescriptionLong').'

'; From bb2545c7b495136e107b3b5445e206537056774f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 13:05:35 +0200 Subject: [PATCH 219/222] Clean code --- htdocs/admin/dolistore/class/dolistore.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index daa8620b783..421cef19af5 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -115,7 +115,7 @@ class Dolistore */ public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0, 'search' => '')) { - global $conf, $langs; + global $conf; $this->start = $options['start']; $this->end = $options['end']; @@ -139,7 +139,7 @@ class Dolistore // make a search to limit the id returned. if ($this->search != '') { - $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.($this->lang); // It seems for search, key start with + $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; // It seems for search, key start with // Call dol_syslog("Call API with opt2 = ".var_export($opt2, true)); From ecd049b4e6ba1cc2b45dcbcf7c676faa93d9fcd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 13:39:51 +0200 Subject: [PATCH 220/222] Debug dolistore --- htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php | 2 ++ htdocs/core/class/conf.class.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index f4ed611ac03..a91ff8e8efa 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -128,6 +128,7 @@ class PrestaShopWebservice CURLOPT_HTTPHEADER => array( 'Expect:' ) ); + dol_syslog("curl_init url=".$url); $session = curl_init($url); $curl_options = array(); @@ -142,6 +143,7 @@ class PrestaShopWebservice if (!isset($curl_options[$defkey])) $curl_options[$defkey] = $curl_params[$defkey]; + dol_syslog("curl curl_options = ".var_export($curl_options, true)); curl_setopt_array($session, $curl_options); $response = curl_exec($session); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index ecbecdeee2d..12d6b337fd0 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -659,8 +659,8 @@ class Conf if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1; - $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; - $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; // For backward compatibility if (isset($this->product)) $this->produit=$this->product; From c959c8b6453720a9b379428cb7ce254679cd31b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 18:21:00 +0200 Subject: [PATCH 221/222] Fix api with prestashop --- dev/dolibarr_changes.txt | 9 ++++ .../class/PSWebServiceLibrary.class.php | 47 ++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index d8861154f9e..5bad55fd4d2 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -8,6 +8,15 @@ ALL: Check "@CHANGE" +PrestaShopWebservice: +--------------------- +Replace + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); +With + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); + + + CKEDITOR (4.6.2): ----------------- * In ckeditor/ckeditor/contents.css diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index a91ff8e8efa..dfd3f3f36c1 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -46,7 +46,7 @@ class PrestaShopWebservice /** @var array compatible versions of PrestaShop Webservice */ const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; - const PSCOMPATIBLEVERSIONMAX = '1.6.99.99'; + const PSCOMPATIBLEVERSIONMAX = '1.7.99.99'; /** @@ -311,7 +311,9 @@ class PrestaShopWebservice if (isset($options['id'])) $url .= '/'.$options['id']; - $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + // @CHANGE LDR + //$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); foreach ($params as $p) foreach ($options as $k => $o) if (strpos($k, $p) !== false) @@ -390,6 +392,47 @@ class PrestaShopWebservice self::checkStatusCode($request['status_code']);// check the response validity return self::parseXML($request['response']); } + + /** + * Delete (DELETE) a resource. + * Unique parameter must take :

+ * 'resource' => Resource name
+ * 'id' => ID or array which contains IDs of a resource(s) you want to delete

+ * + * delete(array('resource' => 'orders', 'id' => 1)); + * // Following code will not be executed if an exception is thrown. + * echo 'Successfully deleted.'; + * } + * catch (PrestaShopWebserviceException $ex) + * { + * echo 'Error : '.$ex->getMessage(); + * } + * ?> + * + * @param array $options Array representing resource to delete. + */ + public function delete($options) + { + if (isset($options['url'])) + $url = $options['url']; + elseif (isset($options['resource']) && isset($options['id'])) + if (is_array($options['id'])) + $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; + else + $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; + if (isset($options['id_shop'])) + $url .= '&id_shop='.$options['id_shop']; + if (isset($options['id_group_shop'])) + $url .= '&id_group_shop='.$options['id_group_shop']; + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); + self::checkStatusCode($request['status_code']);// check the response validity + return true; + } } /** From 361254a4c01830586fd1ce1202d87641361bfa0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 18:23:54 +0200 Subject: [PATCH 222/222] Fix regression after renamind valdate_invoices --- htdocs/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f42289c1c4b..3fddf55924f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -497,12 +497,12 @@ if ($resql) print '
'.$langs->trans("ProgressDeclared").''; @@ -700,93 +711,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; dol_fiche_end(); - - print ''."\n"; - - $title=$langs->trans("ListTaskTimeForTask"); - //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', 0, 1); - print load_fiche_titre($title, $linktocreatetime, 'title_generic.png'); - - /* - * Form to add time spent on task - */ - - if ($action == 'createtime' && $object->id > 0 && $user->rights->projet->lire) - { - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - - // Date - print ''; - - // Contributor - print ''; - - // Note - print ''; - - // Duration - Time spent - print ''; - - // Progress declared - print ''; - - print ''; - - print '
'.$langs->trans("Date").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("NewTimeSpent").''.$langs->trans("ProgressDeclared").'
'; - //$newdate=dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); - $newdate=''; - print $form->selectDate($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0); - print ''; - print img_object('', 'user', 'class="hideonsmartphone"'); - $contactsoftask=$object->getListContactId('internal'); - if (count($contactsoftask)>0) - { - if(in_array($user->id, $contactsoftask)) $userid = $user->id; - else $userid=$contactsoftask[0]; - print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsoftask, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToTheTask"), 'maxwidth200'); - } - else - { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - print ''; - print ''; - print ''; - print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); - print ''; - print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1); - print ''; - print ''; - print '   '; - print ''; - print '
'; - print '
'; - - print '
'; - - print '
'; - } } + if ($projectstatic->id > 0) { if ($action == 'deleteline' && ! empty($projectidforalltimes)) @@ -820,17 +747,6 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } } - if (! empty($withproject) && $projectstatic->bill_time) - { - $arrayofmassactions = array( - 'generateinvoice'=>$langs->trans("GenerateBill"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete"); - if (in_array($massaction, array('presend','predelete','generateinvoice'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - } - $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); @@ -856,8 +772,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; if ($action == 'editline') print ''; elseif ($action == 'splitline') print ''; - elseif ($action == 'createtime' && empty($id) && $user->rights->projet->lire) print ''; - elseif ($massaction == 'generateinvoice' && empty($id) && $user->rights->facture->lire) print ''; + elseif ($action == 'createtime' && $user->rights->projet->lire) print ''; + elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) print ''; else print ''; print ''; print ''; @@ -869,8 +785,6 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($massaction == 'generateinvoice') { - $langs->load("bills"); - //var_dump($_REQUEST); print ''; @@ -1001,6 +915,14 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $linktocreatetime, '', $limit); } + else + { + print ''."\n"; + + $title=$langs->trans("ListTaskTimeForTask"); + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $linktocreatetime, '', $limit); + } $i = 0; while ($i < $num) @@ -1019,15 +941,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) /* * Form to add time spent */ - if ($action == 'createtime' && empty($id) && $user->rights->projet->lire) + if ($action == 'createtime' && $user->rights->projet->lire) { print ''."\n"; + if (! empty($id)) print ''; print ''; print ''; print ''; - print ''; + if (empty($id)) print ''; print ''; print ''; print ''; @@ -1049,9 +972,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; // Task - print ''; + if (empty($id)) + { + print ''; + } // Contributor print ''; print ''; print ''; From 26e3f41f7352f21d3ddbcc72c98abea864f4c430 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 16:18:47 +0100 Subject: [PATCH 208/222] Translation --- htdocs/core/tpl/notes.tpl.php | 2 +- htdocs/langs/en_US/products.lang | 4 ++-- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index e88bc059ee4..65876c7f1e5 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -74,7 +74,7 @@ if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABL else $typeofdata='textarea:12:95%'; print ''."\n"; -print '
'."\n"; +print '
'."\n"; if ($module != 'product') { // No public note yet on products print '
'."\n"; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 1a7a1539734..3304ab3b3ef 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -39,8 +39,8 @@ ServicesOnSellAndOnBuy=Services for sale and for purchase LastModifiedProductsAndServices=Last %s modified products/services LastRecordedProducts=Latest %s recorded products LastRecordedServices=Latest %s recorded services -CardProduct0=Product card -CardProduct1=Service card +CardProduct0=Product +CardProduct1=Service Stock=Stock MenuStocks=Stocks Stocks=Stocks and location (warehouse) of products diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2e8d6bf4308..a69a852d8f0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -908,7 +908,7 @@ select.selectarrowonleft option { } .linkobject { cursor: pointer; } -table.tableforfield tr>td:first-of-type { +table.tableforfield tr>td:first-of-type, div.tableforfield div.tagtr>div.tagtd:first-of-type { color: #666; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 01274a57ace..79fad7c299f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5763,7 +5763,7 @@ border-top-right-radius: 6px; .titlefield { width: auto !important; /* We want to ignor the 30%, try to use more if you can */ } - .tableforfield>tr>td:first-child { + .tableforfield>tr>td:first-child, div.tableforfield div.tagtr>div.tagtd:first-of-type { max-width: 100px; /* but no more than 100px */ } } From 5e23c4c03cc5d9c8eeac5c8899f0fc7af3590f35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 16:23:55 +0100 Subject: [PATCH 209/222] Fix self: not defined in a page --- htdocs/compta/facture/fiche-rec.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 28c6f8ec24a..fa8af87ac29 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1305,7 +1305,7 @@ else print '
'.$langs->trans("Date").''.$langs->trans("Task").''.$langs->trans("Task").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("NewTimeSpent").''; - $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); - print ''; + $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); + print ''; From 4e09867b015f6f9553cb8021a6972f4b7398dff6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 15:54:46 +0100 Subject: [PATCH 207/222] Generation of invoice for timespent works on all timesheet tabs --- htdocs/projet/tasks/time.php | 186 ++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 89 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 7c632f1fb63..f8b0e598927 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -315,114 +315,119 @@ elseif (GETPOST('project_ref', 'alpha')) $projectidforalltimes=$projectstatic->id; $withproject=1; } +elseif ($id > 0) +{ + $object->fetch($id); + $result=$projectstatic->fetch($object->fk_project); +} if ($action == 'confirm_generateinvoice') { - if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); - //->fetch_thirdparty(); - if (! ($projectstatic->thirdparty->id > 0)) + + if (! ($projectstatic->thirdparty->id > 0)) + { + setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + + $tmpinvoice = new Facture($db); + $tmptimespent=new Task($db); + $tmpproduct=new Product($db); + $fuser = new User($db); + + $db->begin(); + $idprod = GETPOST('productid', 'int'); + if ($idprod > 0) { - setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); + $tmpproduct->fetch($idprod); + + $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); + $pu_ht = empty($dataforprice['pu_ht'])?0:$dataforprice['pu_ht']; + $txtva = $dataforprice['tva_tx']; + $localtax1 = $dataforprice['localtax1']; + $localtax2 = $dataforprice['localtax2']; } else { - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $pu_ht = 0; + $txtva = get_default_tva($mysoc, $projectstatic->thirdparty); + $localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1); + $localtax2 = get_default_localtax($mysoc, $projectstatic->thirdparty, 2); + } - $tmpinvoice = new Facture($db); - $tmptimespent=new Task($db); - $tmpproduct=new Product($db); - $fuser = new User($db); + $tmpinvoice->socid = $projectstatic->thirdparty->id; + $tmpinvoice->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $tmpinvoice->fk_project = $projectstatic->id; - $db->begin(); - $idprod = GETPOST('productid', 'int'); - if ($idprod > 0) + $result = $tmpinvoice->create($user); + if ($result <= 0) + { + $error++; + setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); + } + + if (! $error) + { + $arrayoftasks=array(); + foreach($toselect as $key => $value) { - $tmpproduct->fetch($idprod); - - $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); - $pu_ht = empty($dataforprice['pu_ht'])?0:$dataforprice['pu_ht']; - $txtva = $dataforprice['tva_tx']; - $localtax1 = $dataforprice['localtax1']; - $localtax2 = $dataforprice['localtax2']; - } - else - { - $pu_ht = 0; - $txtva = get_default_tva($mysoc, $projectstatic->thirdparty); - $localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1); - $localtax2 = get_default_localtax($mysoc, $projectstatic->thirdparty, 2); + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_fk_user]['timespent']+=$object->timespent_duration; + $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600']+=($object->timespent_duration * $object->timespent_thm); } - $tmpinvoice->socid = $projectstatic->thirdparty->id; - $tmpinvoice->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $tmpinvoice->fk_project = $projectstatic->id; - - $result = $tmpinvoice->create($user); - if ($result <= 0) + foreach($arrayoftasks as $userid => $value) { - $error++; - setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); - } + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); - if (! $error) - { - $arrayoftasks=array(); - foreach($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_fk_user]['timespent']+=$object->timespent_duration; - $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600']+=($object->timespent_duration * $object->timespent_thm); - } + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent']); - foreach($arrayoftasks as $userid => $value) - { - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent']); + // Add lines + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } - - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - - // Update lineid into line of timespent - $sql ='UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql.=' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (! $result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } - } - } - - if (! $error) - { - $urltoinvoice = $tmpinvoice->getNomUrl(0); - setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $urltoinvoice), null, 'mesgs'); - //var_dump($tmpinvoice); - - $db->commit(); - } - else - { - $db->rollback(); + // Update lineid into line of timespent + $sql ='UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql.=' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (! $result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } } + + if (! $error) + { + $urltoinvoice = $tmpinvoice->getNomUrl(0); + setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $urltoinvoice), null, 'mesgs'); + //var_dump($tmpinvoice); + + $db->commit(); + } + else + { + $db->rollback(); + } + } } @@ -802,7 +807,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print $langs->trans('Mode'); print ''; - $tmparray=array('onelineperuser'=>'OneLinePerUser'); + $tmparray=array( + 'onelineperuser'=>'OneLinePerUser', + //'onelinepertask'=>'OneLinePerTask', + ); print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); print '
'; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) + if ($action != 'editconditions' && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; print '
'; @@ -1329,7 +1329,7 @@ else print ''; - if ($action != 'editmode' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) + if ($action != 'editmode' && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; print '
'; @@ -1463,7 +1463,7 @@ else print ''; - if ($action != 'editfrequency' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) + if ($action != 'editfrequency' && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('Frequency'); print 'id . '">' . img_edit($langs->trans('Edit'), 1) . '
'; print '
'; From 65844bcb06ccefced141b6fa90db7f4d33f533e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 22:31:52 +0100 Subject: [PATCH 210/222] Fix detection of current page --- htdocs/website/class/website.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 6bfbadfb197..266eac65ebc 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1106,7 +1106,9 @@ class Website extends CommonObject $pageid = 0; if (! empty($websitepagefile)) { - $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile)); + $websitepagefileshort=basename($websitepagefile); + if ($websitepagefileshort == 'index.php') $pageid = $website->fk_default_home; + else $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), $websitepagefileshort); if ($pageid > 0) { $tmppage->fetch($pageid); @@ -1173,7 +1175,7 @@ class Website extends CommonObject height: '.$HEIGHTOPTION.'px; overflow: hidden; transition: all .3s ease; - margin: 0 50px 0 0; + margin: 0 0 0 0; vertical-align: top; } .componentSelectLang'.$htmlname.':hover, .componentSelectLang'.$htmlname.':hover a { background-color: #fff; color: #000 !important; } From be21755378e595a14d836085245fd3071076ab95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2019 23:04:09 +0100 Subject: [PATCH 211/222] Add page id to help debug in header --- htdocs/core/lib/website.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 5676a7aa39c..4aac8cfda5a 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -681,6 +681,7 @@ function dolSavePageContent($filetpl, $object, $objectpage) $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; From 67c207db1281232b30ca4d595cf63560eb4b4810 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2019 11:58:49 +0100 Subject: [PATCH 212/222] NEW Better explanation for setup of WebDav module --- htdocs/admin/dav.php | 17 +++++++++++++---- htdocs/langs/en_US/admin.lang | 10 ++++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 1ab783474b8..894706576b5 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-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 @@ -36,7 +36,8 @@ $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $arrayofparameters=array( - 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), + 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), + 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) ); @@ -84,7 +85,11 @@ if ($action == 'edit') print '
'; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; - if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') + if ($key == 'DAV_ALLOW_PRIVATE_DIR') + { + print $langs->trans("AlwaysActive"); + } + elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') { print $form->selectyesno($key, $conf->global->$key, 1); } @@ -114,7 +119,11 @@ else print '
'; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; - if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') + if ($key == 'DAV_ALLOW_PRIVATE_DIR') + { + print $langs->trans("AlwaysActive"); + } + elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') { print yn($conf->global->$key); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 92431aad538..709e2267405 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -481,9 +481,11 @@ FilesAttachedToEmail=Attach file SendEmailsReminders=Send agenda reminders by emails davDescription=Setup a WebDAV server DAVSetup=Setup of module DAV -DAV_ALLOW_PUBLIC_DIR=Enable the public directory (WebDAV directory - no login required) -DAV_ALLOW_PUBLIC_DIRTooltip=The WebDAV public directory is a WebDAV directory anybody can access (in read and write mode), with no authorization required (login/password account). -DAV_ALLOW_ECM_DIR=Enable the private directory (root directory of the DMS/ECM module - login required) +DAV_ALLOW_PRIVATE_DIR=Enable the generic private directory (WebDAV dedicated directory named "private" - login required) +DAV_ALLOW_PRIVATE_DIRTooltip=The generic private directory is a WebDAV directory anybody can access with its application login/pass. +DAV_ALLOW_PUBLIC_DIR=Enable the generic public directory (WebDAV dedicated directory named "public" - no login required) +DAV_ALLOW_PUBLIC_DIRTooltip=The generic public directory is a WebDAV directory anybody can access (in read and write mode), with no authorization required (login/password account). +DAV_ALLOW_ECM_DIR=Enable the DMS/ECM private directory (root directory of the DMS/ECM module - login required) DAV_ALLOW_ECM_DIRTooltip=The root directory where all files are manually uploaded when using the DMS/ECM module. Similarly as access from the web interface, you will need a valid login/password with adecuate permissions to access it. # Modules Module0Name=Users & Groups @@ -1872,4 +1874,4 @@ DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramaticaly output DebugBarModuleActivated=Module debugbar is activated and slows dramaticaly the interface EXPORTS_SHARE_MODELS=Export models are share with everybody -ExportSetup=Setup of module Export \ No newline at end of file +ExportSetup=Setup of module Export From c1157679e8d5ceeb4ed0b0ddd0997b1096fa60b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Mar 2019 14:30:06 +0100 Subject: [PATCH 213/222] Show a chevron top/down after login --- htdocs/main.inc.php | 7 ++++++- htdocs/theme/eldy/dropdown.css.php | 5 ++--- htdocs/theme/eldy/global.inc.php | 3 +-- htdocs/theme/md/style.css.php | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1111dd49a47..805fdc90d19 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1764,7 +1764,7 @@ function top_menu_user(User $user, Translate $langs) $dropdownBody.= '
' . $langs->trans("Status").': '.$user->getLibStatut(0); $dropdownBody.= '
'; - $dropdownBody.= '
'.$langs->trans("Connection").''; + $dropdownBody.= '
'.$langs->trans("Session").''; $dropdownBody.= '
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $dropdownBody.= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; $dropdownBody.= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); @@ -1811,6 +1811,8 @@ function top_menu_user(User $user, Translate $langs) '.$userImage.' + + + '; From 9f0d712957bb116063980e7137266a86b9a99a4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 11:27:12 +0200 Subject: [PATCH 217/222] Fix style --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 7a00a5bb23b..a4fd8cb508c 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -300,7 +300,7 @@ if ($action=="valid") } else { - if ($invoice->paye) $sectionwithinvoicelink.=''.$langs->trans("Payed").''; + if ($invoice->paye) $sectionwithinvoicelink.=''.$langs->trans("Payed").''; else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated'); } $sectionwithinvoicelink.=''; From b10682e5dbda2efd1e4f62e50f81b2d18e863e26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 13:03:38 +0200 Subject: [PATCH 218/222] Fix search in dolistore --- .../admin/dolistore/class/dolistore.class.php | 85 ++++++++++++------- htdocs/admin/modules.php | 3 +- 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 26b9bcc8918..daa8620b783 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -63,7 +63,7 @@ class Dolistore $langtmp = explode('_', $langs->defaultlang); $lang = $langtmp[0]; - $lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1 + $lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1 if (! in_array($lang, array_keys($lang_array))) $lang = 'en'; $this->lang = $lang_array[$lang]; } @@ -72,10 +72,48 @@ class Dolistore * Load data from remote Dolistore market place. * This fills ->categories * - * @param array $options Options * @return void */ - public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) + public function getRemoteCategories() + { + global $conf; + + try { + $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); + dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); + // $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data. + + // Here we set the option array for the Webservice : we want categories resources + $opt = array(); + $opt['resource'] = 'categories'; + $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; + $opt['sort'] = 'id_asc'; + + // Call + dol_syslog("Call API with opt = ".var_export($opt, true)); + $xml = $this->api->get($opt); + $this->categories = $xml->categories->children(); + } catch (PrestaShopWebserviceException $e) { + // Here we are dealing with errors + $trace = $e->getTrace(); + if ($trace[0]['args'][0] == 404) die('Bad ID'); + elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); + else + { + print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'
'; + print $e->getMessage(); + } + } + } + + /** + * Load data from remote Dolistore market place. + * This fills ->products + * + * @param array $options Options. If 'categorie' is defined, we filter products on this category id + * @return void + */ + public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0, 'search' => '')) { global $conf, $langs; @@ -101,25 +139,26 @@ class Dolistore // make a search to limit the id returned. if ($this->search != '') { - $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; + $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.($this->lang); // It seems for search, key start with // Call - //var_dump($this->api); - - dol_syslog("Call API with opt = ".var_export($opt, true)); dol_syslog("Call API with opt2 = ".var_export($opt2, true)); - $xml = $this->api->get($opt2); + $products = array(); foreach ($xml->products->children() as $product) { $products[] = (int) $product['id']; } $opt['filter[id]'] = '['.implode('|', $products).']'; - } elseif ($this->categorie != 0) { + } elseif ($this->categorie != 0) { // We filter on category, so we first get list of product id in this category + // $opt2['url'] is set by default to $this->url.'/api/'.$options['resource']; $opt2['resource'] = 'categories'; $opt2['id'] = $this->categorie; + // Call + dol_syslog("Call API with opt2 = ".var_export($opt2, true)); $xml = $this->api->get($opt2); + $products = array(); foreach ($xml->category->associations->products->children() as $product) { $products[] = (int) $product->id; @@ -132,22 +171,10 @@ class Dolistore $opt['limit'] = "$this->start,$this->end"; // $opt['filter[id]'] contais list of product id that are result of search - // Call API to get the detail dol_syslog("Call API with opt = ".var_export($opt, true)); - dol_syslog("Call API with opt2 = ".var_export($opt2, true)); $xml = $this->api->get($opt); $this->products = $xml->products->children(); - - - // Here we set the option array for the Webservice : we want categories resources - $opt = array(); - $opt['resource'] = 'categories'; - $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; - $opt['sort'] = 'id_asc'; - // Call - $xml = $this->api->get($opt); - $this->categories = $xml->categories->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); @@ -184,15 +211,15 @@ class Dolistore $cat = $this->categories[$i]; if ($cat->is_root_category == 1 && $parent == 0) { $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'

    '; + .'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'"' + .'>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; $html .= self::get_categories($cat->id); $html .= "
  • \n"; } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau $select = ($cat->id == $this->categorie) ? ' selected' : ''; $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.''; + .' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" ' + .'>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; $html .= self::get_categories($cat->id); $html .= "
  • \n"; } else { @@ -240,7 +267,7 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; - $images = ''. + $images = ''. ''; } else { $images = ''; @@ -281,10 +308,10 @@ class Dolistore //output template $html .= '
    '.$newapp.$images.'

    '.$product->name->language[$this->lang] +

    '.$product->name->language[$this->lang - 1] .'
    '.$version.'

    - '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang].'
    '.$price.' '.$download_link.''; if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - print $form->selectyesno('valdate_invoices', 0, 1, 1); + print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; } else { - print $form->selectyesno('valdate_invoices', 0, 1); + print $form->selectyesno('validate_invoices', 0, 1); } if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print '     '.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").''; else print '     '.$langs->trans("OptionToSetOrderBilledNotEnabled").'';