From dec4e1f6a675745e4b2e64fde2441bf468bfe134 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Dec 2018 16:49:54 +0100 Subject: [PATCH 1/3] New option use currency on document + toggle - change with toogle - new option use currency on document for online payment --- htdocs/admin/multicurrency.php | 62 ++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 9843c6a4fb0..7995b2957af 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -61,10 +61,9 @@ if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg)) } } -if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg)) +if ($action == 'setobject') { - $code=$reg[1]; - if (dolibarr_del_const($db, $code, 0) > 0) + if (dolibarr_set_const($db, GETPOST('value', 'alpha'), GETPOST('status', 'alpha'),'chaine',0,'',$conf->entity) > 0) { header("Location: ".$_SERVER["PHP_SELF"]); exit; @@ -181,30 +180,57 @@ dol_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurren print ''; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''; print ''; print ''; -print ''; print ''; print ''; -print ''; + +//Online payment with currency on document +print ''; +print ''; +print ''; /* TODO uncomment when the functionality will integrated From 8adecf06893f8b4eb7456da22ff9a4649201906b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Dec 2018 17:09:38 +0100 Subject: [PATCH 2/3] Update multicurrency.php --- htdocs/admin/multicurrency.php | 50 ++++++++++++---------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 7995b2957af..77686afc42d 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -61,9 +61,10 @@ if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg)) } } -if ($action == 'setobject') +if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg)) { - if (dolibarr_set_const($db, GETPOST('value', 'alpha'), GETPOST('status', 'alpha'),'chaine',0,'',$conf->entity) > 0) + $code=$reg[1]; + if (dolibarr_del_const($db, $code, 0) > 0) { header("Location: ".$_SERVER["PHP_SELF"]); exit; @@ -186,51 +187,36 @@ print ''; print ''; print ''; print ''; print ''; print ''; print ''; //Online payment with currency on document print ''; print ''; print ''; /* TODO uncomment when the functionality will integrated From b9baaafe19fa9905bbfb28ce89c3293cb37cfa66 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Dec 2018 17:15:11 +0100 Subject: [PATCH 3/3] Update multicurrency.php --- htdocs/admin/multicurrency.php | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 77686afc42d..0a64145e9a4 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -45,36 +45,6 @@ $action = GETPOST('action', 'alpha'); * Actions */ - -if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg)) -{ - $code=$reg[1]; - $value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1); - if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } -} - -if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg)) -{ - $code=$reg[1]; - if (dolibarr_del_const($db, $code, 0) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } -} - if ($action == 'add_currency') { $error=0;
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Status").'
'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").''; -print '
'; -print ''; -print ''; -print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE",$conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE,1); -print ''; -print '
'; +print '
'; +if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE)) +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +print ''; print '
'.$langs->transnoentitiesnoconv("multicurrency_useOriginTx").''; -print '
'; -print ''; -print ''; -print $form->selectyesno("MULTICURRENCY_USE_ORIGIN_TX",$conf->global->MULTICURRENCY_USE_ORIGIN_TX,1); -print ''; -print '
'; +print '
'; +if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX)) +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +print ''; +print '
'.$langs->transnoentitiesnoconv("multicurrency_useCurrency").''; +if (!empty($conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT)) +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +print ''; print '
'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").''; -if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE)) -{ - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE", $arrval, $conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE); } -else -{ - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); -} -print ''; print '
'.$langs->transnoentitiesnoconv("multicurrency_useOriginTx").''; -if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX)) -{ - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MULTICURRENCY_USE_ORIGIN_TX'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MULTICURRENCY_USE_ORIGIN_TX", $arrval, $conf->global->MULTICURRENCY_USE_ORIGIN_TX); } -else -{ - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); -} -print ''; print '
'.$langs->transnoentitiesnoconv("multicurrency_useCurrency").''; -if (!empty($conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT)) -{ - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT", $arrval, $conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT); } -else -{ - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); -} -print ''; print '