From c50f2b32d8abab18bcbf7a3447128e6cfa3ae311 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Mon, 16 Mar 2020 07:58:44 +0100 Subject: [PATCH 1/5] Add substitution for "user_civility" for ODT --- .../core/class/commondocgenerator.class.php | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 279eb1f7a6b..bd3dcb01e76 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -267,33 +267,34 @@ abstract class CommonDocGenerator $object->state = getState($object->state_code, 0); } - $array_contact = array( - $array_key.'_fullname' => $object->getFullName($outputlangs, 1), - $array_key.'_lastname' => $object->lastname, - $array_key.'_firstname' => $object->firstname, - $array_key.'_address' => $object->address, - $array_key.'_zip' => $object->zip, - $array_key.'_town' => $object->town, - $array_key.'_state_id' => $object->state_id, - $array_key.'_state_code' => $object->state_code, - $array_key.'_state' => $object->state, - $array_key.'_country_id' => $object->country_id, - $array_key.'_country_code' => $object->country_code, - $array_key.'_country' => $object->country, - $array_key.'_poste' => $object->poste, - $array_key.'_socid' => $object->socid, - $array_key.'_statut' => $object->statut, - $array_key.'_code' => $object->code, - $array_key.'_email' => $object->email, - $array_key.'_jabberid' => $object->jabberid, - $array_key.'_phone_pro' => $object->phone_pro, - $array_key.'_phone_perso' => $object->phone_perso, - $array_key.'_phone_mobile' => $object->phone_mobile, - $array_key.'_fax' => $object->fax, - $array_key.'_birthday' => $object->birthday, - $array_key.'_default_lang' => $object->default_lang, - $array_key.'_note_public' => $object->note_public, - $array_key.'_note_private' => $object->note_private + $array_contact = array ( + $array_key . '_fullname' => $object->getFullName($outputlangs, 1), + $array_key . '_lastname' => $object->lastname, + $array_key . '_firstname' => $object->firstname, + $array_key . '_address' => $object->address, + $array_key . '_zip' => $object->zip, + $array_key . '_town' => $object->town, + $array_key . '_state_id' => $object->state_id, + $array_key . '_state_code' => $object->state_code, + $array_key . '_state' => $object->state, + $array_key . '_country_id' => $object->country_id, + $array_key . '_country_code' => $object->country_code, + $array_key . '_country' => $object->country, + $array_key . '_poste' => $object->poste, + $array_key . '_socid' => $object->socid, + $array_key . '_statut' => $object->statut, + $array_key . '_code' => $object->code, + $array_key . '_email' => $object->email, + $array_key . '_jabberid' => $object->jabberid, // deprecated + $array_key . '_phone_pro' => $object->phone_pro, + $array_key . '_phone_perso' => $object->phone_perso, + $array_key . '_phone_mobile' => $object->phone_mobile, + $array_key . '_fax' => $object->fax, + $array_key . '_birthday' => $object->birthday, + $array_key . '_default_lang' => $object->default_lang, + $array_key . '_note_public' => $object->note_public, + $array_key . '_note_private' => $object->note_private, + $array_key . '_civility' => $object->civility, ); // Retrieve extrafields From 5a4bd28417b27a0bb1b3e9bd2c089c397c1c45e9 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 16 Mar 2020 11:56:47 +0100 Subject: [PATCH 2/5] NEW labels on reduction buttons in cash desk --- htdocs/takepos/css/pos.css.php | 2 +- htdocs/takepos/reduction.php | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index c228b948c3b..68b88bb54fd 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -119,7 +119,7 @@ button.calcbutton2 { width: calc(25% - 2px); height: calc(25% - 2px); font-weight: bold; - font-size: 8pt; + font-size: 10pt; margin: 1px; } diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index a2d57ea3a6e..c240c1df179 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -73,6 +73,14 @@ $arrayofjs = array(); top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); $langs->loadLangs(array('main', 'bills', 'cashdesk')); + +if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { + $htmlReductionPercent = ''; + $htmlReductionAmount = ''; +} else { + $htmlReductionPercent = $langs->trans('ReductionShort') . '
%'; + $htmlReductionAmount = $langs->trans('ReductionShort') . '
' . $langs->trans('Amount'); +} ?> @@ -83,6 +91,9 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); var reductionTotal = ''; var editAction = ''; var editNumber = ''; + var htmlBtnOK = 'OK'; + var htmlReductionPercent = ''; + var htmlReductionAmount = ''; /** * Reset values @@ -94,8 +105,8 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); editAction = ''; editNumber = ''; jQuery('#reduction_total').val(reductionTotal); - jQuery("#reduction_type_percent").html(''); - jQuery('#reduction_type_amount').html(''); + jQuery("#reduction_type_percent").html(htmlReductionPercent); + jQuery('#reduction_type_amount').html(htmlReductionAmount); } /** @@ -124,14 +135,14 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); } if (editAction === 'p'){ - jQuery('#reduction_type_percent').html('OK'); - jQuery('#reduction_type_amount').html(''); + jQuery('#reduction_type_percent').html(htmlBtnOK); + jQuery('#reduction_type_amount').html(htmlReductionAmount); } else if (editAction === 'a'){ - jQuery('#reduction_type_amount').html('OK'); - jQuery("#reduction_type_percent").html(''); + jQuery('#reduction_type_amount').html(htmlBtnOK); + jQuery("#reduction_type_percent").html(htmlReductionPercent); } else { - jQuery('#reduction_type_percent').html(''); - jQuery('#reduction_type_amount').html(''); + jQuery('#reduction_type_percent').html(htmlReductionPercent); + jQuery('#reduction_type_amount').html(htmlReductionAmount); } } @@ -198,11 +209,11 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk')); print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; From f7cf5f878401171a35ebba74663afe83cef5aef2 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 17 Mar 2020 09:44:59 +0100 Subject: [PATCH 3/5] NEW add VAT rates in free zone for product/service in cash desk --- htdocs/takepos/css/pos.css.php | 16 +++++++- htdocs/takepos/freezone.php | 70 +++++++++++++++++++++++++++++----- htdocs/takepos/invoice.php | 9 ++++- 3 files changed, 83 insertions(+), 12 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 32b7d7b7104..a95288f2f51 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -50,6 +50,7 @@ top_httphead('text/css'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); else header('Cache-Control: no-cache'); +header('Cache-Control: no-cache'); require DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; @@ -119,7 +120,7 @@ button.calcbutton2 { width: calc(25% - 2px); height: calc(25% - 2px); font-weight: bold; - font-size: 8pt; + font-size: 10pt; margin: 1px; } @@ -159,6 +160,19 @@ button.actionbutton { border-width: 0; } +button.item_value { + background: #bbbbbb; + border: #000000 1px solid; + border-radius: 4px; + padding: 8px; +} + +button.item_value.selected { + background: #ffffff; + color: #000000; + font-weight: bold; +} + div[aria-describedby="dialog-info"] button:before { content: "\f788"; font-family: "Font Awesome 5 Free"; diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index e8cce00abb3..8861529d498 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/takepos/floors.php + * \file htdocs/takepos/freezone.php * \ingroup takepos * \brief Popup to enter a free line */ @@ -32,6 +32,11 @@ if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + +global $mysoc; $langs->loadLangs(array("bills", "cashdesk")); @@ -40,6 +45,20 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $idline = GETPOST('idline', 'int'); $action = GETPOST('action', 'alpha'); +// get invoice +$invoice = new Facture($db); +if ($place > 0) { + $invoice->fetch($place); +} else { + $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')'); +} + +// get default vat rate +$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal']; +$soc = new Societe($db); +if ($invoice->socid > 0) $soc->fetch($invoice->socid); +else $soc->fetch($conf->global->$constforcompanyid); +$vatRateDefault = get_default_tva($mysoc, $soc); /* * View @@ -48,18 +67,34 @@ $action = GETPOST('action', 'alpha'); $arrayofcss = array('/takepos/css/pos.css.php'); $arrayofjs = array(); -top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); - +top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); ?> @@ -72,6 +107,21 @@ if ($action == "addnote") echo ' +load_cache_vatrates("'" . $mysoc->country_code . "'"); + if ($num > 0) { + print '

'; + print $langs->trans('VAT') . ' : '; + foreach ($form->cache_vatrates as $rate) { + print ''; + } + } +} +?> diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3ca20a9ddee..93c91e2f55b 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +global $mysoc; + $langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks")); $id = GETPOST('id', 'int'); @@ -327,7 +329,12 @@ if ($action == "freezone") { $customer = new Societe($db); $customer->fetch($invoice->socid); - $tva_tx = get_default_tva($mysoc, $customer); + $tva_tx = GETPOST('tva_tx', 'alpha'); + if ($tva_tx != '') { + $tva_tx = price2num($tva_tx); + } else { + $tva_tx = get_default_tva($mysoc, $customer); + } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr); From a74dca4a203cbaf5148e16f584cf8d4b563ac002 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 17 Mar 2020 09:52:26 +0100 Subject: [PATCH 4/5] FIX resolve conflicts --- htdocs/takepos/css/pos.css.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index a95288f2f51..fb9bd1a0707 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -50,7 +50,6 @@ top_httphead('text/css'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); else header('Cache-Control: no-cache'); -header('Cache-Control: no-cache'); require DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; @@ -120,7 +119,7 @@ button.calcbutton2 { width: calc(25% - 2px); height: calc(25% - 2px); font-weight: bold; - font-size: 10pt; + font-size: 8pt; margin: 1px; } From 50a0bfef64ea1fbdbfa409ae56cc1a5ac98ab7f7 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 18 Mar 2020 09:53:13 +0100 Subject: [PATCH 5/5] NEW: Export module, add extrafields for Contract and Contract line --- htdocs/core/modules/modContrat.class.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 3b8a7aa3f8b..e50af779c5c 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -193,14 +193,20 @@ class modContrat extends DolibarrModules 'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); + $keyforselect='contrat'; $keyforelement='contract'; $keyforaliasextra='coextra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='contratdet'; $keyforelement='contract_line'; $keyforaliasextra='codextra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)'; - $this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat'; - $this->export_sql_end[$r] .=' AND co.entity IN ('.getEntity('contract').')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid'; + $this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contrat as co ON co.fk_soc = s.rowid'; + $this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contratdet as cod ON co.rowid = cod.fk_contrat'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (cod.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contrat_extrafields as coextra on (co.rowid = coextra.fk_object)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contratdet_extrafields as codextra on (cod.rowid = codextra.fk_object)'; + $this->export_sql_end[$r] .=' WHERE co.entity IN ('.getEntity('contract').')'; }