diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 3cb9f407ce6..9e57830b94d 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -38,8 +38,10 @@ $langs->load("admin"); $langs->load("accountancy"); // Security check -if (! $user->admin) - accessforbidden(); +if (empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount)) +{ + accessforbidden(); +} $action = GETPOST('action', 'alpha'); @@ -135,31 +137,14 @@ $var = true; /* * Main Options */ + print ''; print ''; -print ''; +print ''; print "\n"; $var = ! $var; -print ''; -print ''; -if (! $conf->use_javascript_ajax) { - print '"; -} else { - print ''; -} -print ""; - $num = count($main_option); if ($num) { foreach ( $main_option as $key ) { @@ -221,8 +206,29 @@ if ($num2) { print ''; print ''; print "\n"; + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) + { print ''; + } + + print ''; + print ''; + if (! $conf->use_javascript_ajax) { + print '"; + } else { + print ''; + } + print ""; foreach ( $model_option as $key ) { $var = ! $var; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 0173ac931cc..84234b2d535 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -41,8 +41,10 @@ $langs->load("accountancy"); $langs->load("salaries"); // Security check -if (! $user->admin) +if (empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount)) +{ accessforbidden(); +} $action = GETPOST('action', 'alpha'); @@ -51,6 +53,7 @@ $list = array ( 'ACCOUNTING_LIMIT_LIST_VENTILATION', 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc + 'ACCOUNTING_MANAGE_ZERO', 'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT' ); @@ -71,6 +74,7 @@ $list_account = array ( 'DONATION_ACCOUNTINGACCOUNT' ); + /* * Actions */ @@ -180,6 +184,7 @@ if ($action == 'setdisabledirectinput') { } } + /* * View */ @@ -200,173 +205,193 @@ print ''; dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron'); -print '
' . $langs->trans('MainOptions') . '' . $langs->trans('Options') . '
' . $langs->trans("Selectformat") . ''; - print $langs->trans("NotAvailableWhenAjaxDisabled"); - print "'; - $listformat = array ( - 'csv' => $langs->trans("csv"), - 'txt' => $langs->trans("txt") - ); - print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0); - - print '
' . $langs->trans('OtherOptions') . '
' . $langs->trans('OptionsDeactivatedForThisExportModel') . '
' . $langs->trans("Selectformat") . ''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print "'; + $listformat = array ( + 'csv' => $langs->trans("csv"), + 'txt' => $langs->trans("txt") + ); + print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0); + + print '
'; - -// Cas du parametre ACCOUNTING_MODE - -print ''; -print ''; -print "\n"; -print ''; -print '\n"; -print ''; -print '\n"; - -print "
' . $langs->trans('OptionMode') . '' . $langs->trans('Description') . '
' . $langs->trans('OptionModeTrue') . '' . nl2br($langs->trans('OptionModeTrueDesc')); -// Write info on way to count VAT -// if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) -// { -// // print "
\n"; -// // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); -// } -// else -// { -// // print "
\n"; -// // print nl2br($langs->trans('OptionModeTrueInfoExpert')); -// } -print "
' . $langs->trans('OptionModeVirtual') . '' . nl2br($langs->trans('OptionModeVirtualDesc')) . "
\n"; - -print "
\n"; +if (! empty($user->admin)) +{ + print ''; + + // Cas du parametre ACCOUNTING_MODE + + print ''; + print ''; + print "\n"; + print ''; + print '\n"; + print ''; + print '\n"; + + print "
' . $langs->trans('OptionMode') . '' . $langs->trans('Description') . '
' . $langs->trans('OptionModeTrue') . '' . nl2br($langs->trans('OptionModeTrueDesc')); + // Write info on way to count VAT + // if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) + // { + // // print "
\n"; + // // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); + // } + // else + // { + // // print "
\n"; + // // print nl2br($langs->trans('OptionModeTrueInfoExpert')); + // } + print "
' . $langs->trans('OptionModeVirtual') . '' . nl2br($langs->trans('OptionModeVirtualDesc')) . "
\n"; + + print "
\n"; +} + /* * Define Chart of accounts */ -print ''; -$var = true; +if (! empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount)) +{ + print '
'; + $var = true; + + print ''; + print ''; + print "\n"; + $var = ! $var; + print ''; + print ""; + print ""; + print "
'; + print $langs->trans("Chartofaccounts") . '
" . $langs->trans("Selectchartofaccounts") . ""; + print '"; + print "
"; -print ''; -print ''; -print $langs->trans("Chartofaccounts") . ''; -print "\n"; -$var = ! $var; -print ''; -print "" . $langs->trans("Selectchartofaccounts") . ""; -print ""; -print '"; -print ""; -print ""; -print "
\n"; /* * Others params */ print ''; print ''; -print ''; +print ''; print "\n"; -foreach ( $list as $key ) { - $var = ! $var; - - print ''; - - // Param - $label = $langs->trans($key); - print ''; - - // Value - print ''; +if (! empty($user->admin)) +{ + // TO DO Mutualize code for yes/no constants + $var = ! $var; + print ""; + print ''; + if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { + print ''; + } else { + print ''; + } + print ''; + + $var = ! $var; + print ""; + print ''; + if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { + print ''; + } else { + print ''; + } + print ''; + + $var = ! $var; + print ""; + print ''; + if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { + print ''; + } else { + print ''; + } + print ''; } -foreach ( $list_account as $key ) { - $var = ! $var; - - print ''; - - // Param - $label = $langs->trans($key); - print ''; - - // Value - print ''; -} +// Param a user $user->rights->accountancy->chartofaccount can access +if (! empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount)) +{ + foreach ( $list as $key ) { + $var = ! $var; + + if ($key != 'ACCOUNTING_MANAGE_ZERO') + { + print ''; + + // Param + $label = $langs->trans($key); + print ''; + + // Value + print ''; + } + if ($key == 'ACCOUNTING_MANAGE_ZERO') + { + $var = ! $var; + print ""; + print ''; + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + print ''; + } else { + print ''; + } + print ''; + } + } -// TO DO Mutualize code for yes/no constants -$var = ! $var; -print ""; -print ''; -if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { - print ''; -} else { - print ''; + foreach ( $list_account as $key ) { + $var = ! $var; + + print ''; + + // Param + $label = $langs->trans($key); + print ''; + + // Value + print ''; + } } -print ''; - -$var = ! $var; -print ""; -print ''; -if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { - print ''; -} else { - print ''; -} -print ''; - -$var = ! $var; -print ""; -print ''; -if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { - print ''; -} else { - print ''; -} -print ''; - -$var = ! $var; -print ""; -print ''; -if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - print ''; -} else { - print ''; -} -print ''; print "
' . $langs->trans('OtherOptions') . '' . $langs->trans('OtherOptions') . '
'; - print ''; - print '
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
'; - print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1); - print '
'; + print ''; + print '
' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print '
'; + print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1); + print '
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print '
' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print '
' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print '
\n"; diff --git a/htdocs/accountancy/admin/journal.php b/htdocs/accountancy/admin/journal.php index b511c6dfd1a..ac3cceee2d5 100644 --- a/htdocs/accountancy/admin/journal.php +++ b/htdocs/accountancy/admin/journal.php @@ -38,8 +38,10 @@ require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; $langs->load("accountancy"); // Security check -if (! $user->admin) - accessforbidden(); +if (empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount)) +{ + accessforbidden(); +} $action = GETPOST('action', 'alpha'); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 554a1677c2a..7d640968eb1 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -45,7 +45,7 @@ $langs->load("accountancy"); if (empty($conf->accounting->enabled)) { accessforbidden(); } -if (! $user->rights->accounting->ventilation->read) +if (! $user->rights->accounting->bind->write) accessforbidden(); // search & action GETPOST diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 903b3bdf9f1..9e1022ae5cc 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -225,7 +225,7 @@ if ($action == 'delbookkeepingyearconfirm') { } else { - setEventMessages("NothingDeleted", null, 'warnings'); + setEventMessages("NoRecordDeleted", null, 'warnings'); Header("Location: list.php"); exit; } @@ -321,7 +321,7 @@ if ($action == 'delbookkeepingyear') { 'default' => $deljournal ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 250); print $formconfirm; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 3a8dd3bec51..8d9aad6d7a3 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -202,7 +202,7 @@ if ($action == 'delbookkeepingyear') { 'default' => $delyear ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 250); print $formconfirm; } diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index c49dd7ce78a..8d2a838a151 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -43,7 +43,7 @@ if ($user->societe_id > 0) /* * Actions */ -if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { +if ($action == 'ventil' && $user->rights->accounting->bind->write) { if (! GETPOST('cancel', 'alpha')) { $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql .= " SET fk_code_ventilation = " . $codeventil; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 5d52c8b75d5..586d08acad0 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -43,7 +43,7 @@ if (empty($conf->accounting->enabled)) { } if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->read) +if (! $user->rights->accounting->bind->write) accessforbidden(); // Filter diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 2a69c4ee91e..faa1ce7cd62 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -82,7 +82,7 @@ if (! $sortorder) { // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->dispatch) +if (! $user->rights->accounting->bind->write) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 0145a803778..2e149437cd5 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -84,7 +84,7 @@ if (! $sortorder) { // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->dispatch) +if (! $user->rights->accounting->bind->write) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 28ca975f089..d23f0eb8081 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -75,10 +75,6 @@ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, print "
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("ProductsBinding").''); -print "
\n"; -print "
\n"; -$step++; //$textlink=''.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Modules")."-".$langs->transnoentitiesnoconv("Accountancy").''; $textlink=''.$langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuBankCash").''; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink); @@ -121,6 +117,9 @@ print '
'; print "
\n"; $step = 0; +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("ProductsBinding").'')."
\n"; +print "
\n"; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."
\n"; print "
\n"; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index e0eb900b1c1..68afa60c400 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -44,7 +44,7 @@ $id = GETPOST('id'); if ($user->societe_id > 0) accessforbidden(); -if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { +if ($action == 'ventil' && $user->rights->accounting->bind->write) { if (! GETPOST('cancel', 'alpha')) { $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql .= " SET fk_code_ventilation = " . $codeventil; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 4b6e5f6183a..63153328d14 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -41,7 +41,7 @@ if (empty($conf->accounting->enabled)) { } if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->read) +if (! $user->rights->accounting->bind->write) accessforbidden(); // Filter diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 271aa62cc1d..6e0ac7fcc13 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -80,7 +80,7 @@ if (! $sortorder) { // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->dispatch) +if (! $user->rights->accounting->bind->write) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index dd695fd4a5f..984fc119f61 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -84,7 +84,7 @@ if (! $sortorder) { // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->dispatch) +if (! $user->rights->accounting->bind->write) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 3b7facc9dc8..b9c994fba28 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -262,23 +262,6 @@ if ($action == 'setforcedate') } } -if ($action == 'set_INVOICE_AUTO_FILLJS') -{ - $freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} /* @@ -750,20 +733,6 @@ print '\n"; print ''; -// Add js auto fill amount on paiement form -$var=! $var; -print '
'; -print ''; -print ''; -print ''; -print $langs->trans("JSOnPaimentBill"); -print ''; -print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); -print ''; -print ''; -print "\n"; -print '
'; - $var=! $var; print '
'; print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 8ce904aad7c..93f7c301519 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -69,7 +69,7 @@ if ($action == 'setmod') dolibarr_set_const($db, "PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity); } -if ($action == 'set_FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') +if ($action == 'setparams') { $freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'); // No alpha here, we want exact string @@ -77,16 +77,31 @@ if ($action == 'set_FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') if (! $res > 0) $error++; - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else + if ($error) { setEventMessages($langs->trans("Error"), null, 'errors'); } + + /* + $freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string + + $res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if ($error) + { + setEventMessages($langs->trans("Error"), null, 'errors'); + }*/ + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + } + /* * View */ @@ -235,6 +250,10 @@ print "
"; print load_fiche_titre($langs->trans("OtherOptions"),'',''); +print ''; +print ''; +print ''; + print ''; print ''; print ''; @@ -244,20 +263,32 @@ print "\n"; // Allow payments on different thirdparties bills but same parent company $var=! $var; -print ''; -print ''; -print ''; print '\n"; -print ''; + +// Add js auto fill amount on paiement form +/* always on now +$var=! $var; +print '\n"; +*/ print '
'.$langs->trans("Parameter").'
'; print $langs->trans("PaymentOnDifferentThirdBills"); print ''; print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS,1); print ''; -print ''; print "
'; +print $langs->trans("JSOnPaimentBill"); +print ''; +print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); +print ''; +print "
'; +print '
'; +print ''; +print '
'; + +print ''; + dol_fiche_end(); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 4b0039c0a21..2c8c8d32334 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $langs->load('companies'); $langs->load('bills'); $langs->load('banks'); +$langs->load('multicurrency'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm'); @@ -433,7 +434,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie '; print ' });'."\n"; - if(!empty($conf->global->INVOICE_AUTO_FILLJS)){ + if (!empty($conf->use_javascript_ajax)){ //Add js for AutoFill print ' $(document).ready(function () {'; print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ @@ -515,10 +516,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie dol_fiche_end(); + /* * List of unpaid invoices */ - $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_total_ttc, f.type, '; + + $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, '; $sql.= ' f.datef as df, f.fk_soc as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; @@ -572,12 +575,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''.$arraytitle.''; print ''.$langs->trans('Date').''; - print ''.$langs->trans('AmountTTC').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; - print ''.$alreadypayedlabel.''; if (!empty($conf->multicurrency->enabled)) print ''.$multicurrencyalreadypayedlabel.''; - print ''.$remaindertopay.''; if (!empty($conf->multicurrency->enabled)) print ''.$multicurrencyremaindertopay.''; + print ''.$langs->trans('AmountTTC').''; + print ''.$alreadypayedlabel.''; + print ''.$remaindertopay.''; print ''.$langs->trans('PaymentAmount').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').''; print ' '; @@ -624,12 +628,35 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date print ''.dol_print_date($db->jdate($objp->df),'day')."\n"; - - // Price - print ''.price($sign * $objp->total_ttc).''; - + + // Currency + print ''.$objp->multicurrency_code."\n"; + // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) print ''.price($sign * $objp->multicurrency_total_ttc).''; + if (!empty($conf->multicurrency->enabled)) + { + print ''; + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $objp->multicurrency_total_ttc); + print ''; + + // Multicurrency Price + print ''; + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) + { + print price($sign * $multicurrency_payment); + if ($multicurrency_creditnotes) print '+'.price($multicurrency_creditnotes); + if ($multicurrency_deposits) print '+'.price($multicurrency_deposits); + } + print ''; + + // Multicurrency Price + print ''; + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay); + print ''; + } + + // Price + print ''.price($sign * $objp->total_ttc).''; // Received or paid back print ''.price($sign * $paiement); @@ -637,25 +664,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($deposits) print '+'.price($deposits); print ''; - // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) - { - print ''.price($sign * $multicurrency_payment); - if ($multicurrency_creditnotes) print '+'.price($multicurrency_creditnotes); - if ($multicurrency_deposits) print '+'.price($multicurrency_deposits); - print ''; - } - // Remain to take or to pay back print ''.price($sign * $remaintopay).''; //$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits)); - // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) - { - print ''.price($sign * $multicurrency_remaintopay).''; - } - // Amount print ''; @@ -665,7 +677,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($action != 'add_paiement') { - if(!empty($conf->global->INVOICE_AUTO_FILLJS)) + if (!empty($conf->use_javascript_ajax)) print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); print ''; print ''; @@ -678,7 +690,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ""; // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) + if (! empty($conf->multicurrency->enabled)) { print ''; @@ -686,17 +698,20 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $namef = 'multicurrency_amount_'.$objp->facid; $nameRemain = 'multicurrency_remain_'.$objp->facid; - if ($action != 'add_paiement') + if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { - if(!empty($conf->global->INVOICE_AUTO_FILLJS)) - print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); - print ''; - print ''; - } - else - { - print ''; - print ''; + if ($action != 'add_paiement') + { + if (!empty($conf->use_javascript_ajax)) + print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); + print ''; + print ''; + } + else + { + print ''; + print ''; + } } print ""; } @@ -727,16 +742,16 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { // Print total print ''; - print ''.$langs->trans('TotalTTC').''; - print ''.price($sign * $total_ttc).''; + print ''.$langs->trans('TotalTTC').''; if (!empty($conf->multicurrency->enabled)) print ''; + if (!empty($conf->multicurrency->enabled)) print ''; + if (!empty($conf->multicurrency->enabled)) print ''; + print ''.price($sign * $total_ttc).''; print ''.price($sign * $totalrecu); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecudeposits) print '+'.price($totalrecudeposits); print ''; - if (!empty($conf->multicurrency->enabled)) print ''; print ''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).''; - if (!empty($conf->multicurrency->enabled)) print ''; print ''; if (!empty($conf->multicurrency->enabled)) print ''; print ' '; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 871f6a2d209..ceac1fc4b44 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4102,6 +4102,11 @@ class Form $out=''; $out.= '