From ad68b3ca6ca97a5d9d415daa94c999608ae9304d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Jan 2015 00:59:46 +0100 Subject: [PATCH] Fixed approve during validation if user has permission Fixed error management Fixed rendering country must be same for all tabs. --- htdocs/categories/categorie.php | 3 +- htdocs/comm/card.php | 3 +- .../mod_commande_fournisseur_orchidee.php | 5 +- htdocs/fourn/card.php | 3 +- .../class/fournisseur.commande.class.php | 1 - htdocs/fourn/commande/card.php | 79 ++++++++++--------- htdocs/langs/en_US/bills.lang | 12 +-- htdocs/langs/en_US/orders.lang | 10 +-- htdocs/societe/agenda.php | 3 +- 9 files changed, 64 insertions(+), 55 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index a77751fcb29..61ab169029f 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -289,7 +289,8 @@ if ($socid) if ($soc->country) { print ''.$langs->trans('Country').''; - $img=picto_from_langcode($soc->country_code); + //$img=picto_from_langcode($soc->country_code); + $img=''; print ($img?$img.' ':''); print $soc->country; print ''; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 9d4eb9567c1..74e29fcd3b2 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -266,7 +266,8 @@ if ($id > 0) print ''.$langs->trans("Country").''; if (! empty($object->country_code)) { - $img=picto_from_langcode($object->country_code); + //$img=picto_from_langcode($object->country_code); + $img=''; if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); else print ($img?$img.' ':'').$object->country; } diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index c0f89f51efa..7f74ce095c0 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/modules_commandefo /** - \class mod_commande_fournisseur_orchidee - \brief Classe du modele de numerotation de reference de commande fournisseur Orchidee -*/ + * Classe du modele de numerotation de reference de commande fournisseur Orchidee + */ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders { var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 102dd092857..5dfd3b62dc5 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -156,7 +156,8 @@ if ($object->fetch($id)) // Country print ''.$langs->trans("Country").''; - $img=picto_from_langcode($object->country_code); + //$img=picto_from_langcode($object->country_code); + $img=''; if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); else print ($img?$img.' ':'').$object->country; print ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7e8196531c4..d95816a1511 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -591,7 +591,6 @@ class CommandeFournisseur extends CommonOrder else { $this->error = $obj->error; - dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error); return -1; } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 220dc02b4d7..2f4e3f45782 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -130,13 +130,13 @@ if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer) } // mode de reglement -else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) +if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } // bank account -else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) +if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); } @@ -154,17 +154,17 @@ if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->cree } // Set project -else if ($action == 'classin' && $user->rights->fournisseur->commande->creer) +if ($action == 'classin' && $user->rights->fournisseur->commande->creer) { $object->setProject($projectid); } -else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer) +if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer) { $result = $object->set_remise($user, $_POST['remise_percent']); } -else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver) +if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver) { if (in_array($object->statut, array(1, 2, 5, 6, 7, 9))) { @@ -191,7 +191,7 @@ else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver) /* * Add a line into product */ -else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) +if ($action == 'addline' && $user->rights->fournisseur->commande->creer) { $langs->load('errors'); $error = 0; @@ -402,7 +402,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) /* * Mise a jour d'une ligne dans la commande */ -else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer && ! GETPOST('cancel')) +if ($action == 'update_line' && $user->rights->fournisseur->commande->creer && ! GETPOST('cancel')) { if ($_POST["elrowid"]) { @@ -473,7 +473,7 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer } } -else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) +if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) { $result = $object->deleteline(GETPOST('lineid')); @@ -506,7 +506,7 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r } } -else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider) +if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider) { $object->date_commande=dol_now(); $result = $object->valid($user); @@ -542,7 +542,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn } } -else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) +if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) { $idwarehouse=GETPOST('idwarehouse', 'int'); @@ -593,7 +593,7 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou } } -else if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) +if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) { $result = $object->refuse($user); if ($result > 0) @@ -607,7 +607,7 @@ else if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->four } } -else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) +if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); if ($result > 0) @@ -625,7 +625,7 @@ else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fo } -else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->commande->supprimer) +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->commande->supprimer) { $result=$object->delete($user); if ($result > 0) @@ -640,7 +640,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->four } // Action clone object -else if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) +if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) { if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) { @@ -666,7 +666,7 @@ else if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fourn } // Receive -else if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner) +if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner) { if ($_POST["type"]) @@ -695,7 +695,7 @@ else if ($action == 'livraison' && $user->rights->fournisseur->commande->recepti } } -else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) +if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { $result = $object->cancel($user); if ($result > 0) @@ -710,7 +710,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->four } // Line ordering -else if ($action == 'up' && $user->rights->fournisseur->commande->creer) +if ($action == 'up' && $user->rights->fournisseur->commande->creer) { $object->line_up($_GET['rowid']); @@ -726,7 +726,7 @@ else if ($action == 'up' && $user->rights->fournisseur->commande->creer) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid'])); exit; } -else if ($action == 'down' && $user->rights->fournisseur->commande->creer) +if ($action == 'down' && $user->rights->fournisseur->commande->creer) { $object->line_down($_GET['rowid']); @@ -743,7 +743,7 @@ else if ($action == 'down' && $user->rights->fournisseur->commande->creer) exit; } -else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post +if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post { // Build document @@ -765,7 +765,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) / } // Delete file in doc form -else if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisseur->commande->creer) +if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisseur->commande->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("other"); @@ -776,7 +776,7 @@ else if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisse else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } -elseif ($action == 'update_extras') +if ($action == 'update_extras') { // Fill array 'array_options' with data from add form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -818,7 +818,7 @@ elseif ($action == 'update_extras') /* * Create an order */ -else if ($action == 'add' && $user->rights->fournisseur->commande->creer) +if ($action == 'add' && $user->rights->fournisseur->commande->creer) { $error=0; @@ -1280,7 +1280,7 @@ if ($action=="create") $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; } - + print ''.$langs->trans('NotePublic').''; print ''; $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -1364,17 +1364,24 @@ elseif (! empty($object->id)) if (preg_match('/^[\(]?PROV/i',$object->ref)) $newref = $object->getNextNumRef($object->thirdparty); else $newref = $object->ref; - $text=$langs->trans('ConfirmValidateOrder',$newref); - if (! empty($conf->notification->enabled)) + if ($newref < 0) { - require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; - $notify=new Notify($db); - $text.='
'; - $text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid); + setEventMessages($object->error, $object->errors, 'errors'); + $action=''; } + else + { + $text=$langs->trans('ConfirmValidateOrder',$newref); + if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid); + } - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1); - + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1); + } } /* @@ -1566,7 +1573,7 @@ elseif (! empty($object->id)) print ''; print ''; } - + // Delivery date planed print ''; print '
'; @@ -1993,7 +2000,7 @@ elseif (! empty($object->id)) $ws_key = $object->thirdparty->webservices_key; $ws_user = GETPOST('ws_user','alpha'); $ws_password = GETPOST('ws_password','alpha'); - + // NS and Authentication parameters $ws_ns = 'http://www.dolibarr.org/ns/'; $ws_authentication = array( @@ -2012,11 +2019,11 @@ elseif (! empty($object->id)) $mode = "init"; $error_occurred = true; //Don't allow to set the user/pass if thirdparty fields are not filled } else if ($mode != "init" && (empty($ws_user) || empty($ws_password))) { - setEventMessage($langs->trans("ErrorFieldsRequired"), 'errors'); + setEventMessage($langs->trans("ErrorFieldsRequired"), 'errors'); $mode = "init"; } - if ($mode == "init") + if ($mode == "init") { //Table/form header print ''; @@ -2124,7 +2131,7 @@ elseif (! empty($object->id)) } } - + // Ensure that price is equal and warn user if it's not $supplier_price = price($result_product["product"]["price_net"]); //Price of client tab in supplier dolibarr $local_price = NULL; //Price of supplier as stated in product suppliers tab on this dolibarr, NULL if not found diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 9429a682857..5a805f4f6a1 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -1,16 +1,16 @@ # Dolibarr language file - Source file is en_US - bills Bill=Invoice Bills=Invoices -BillsCustomers=Customer's invoices -BillsCustomer=Customer's invoice -BillsSuppliers=Supplier's invoices -BillsCustomersUnpaid=Unpaid customer's invoices +BillsCustomers=Customers invoices +BillsCustomer=Customers invoice +BillsSuppliers=Suppliers invoices +BillsCustomersUnpaid=Unpaid customers invoices BillsCustomersUnpaidForCompany=Unpaid customer's invoices for %s BillsSuppliersUnpaid=Unpaid supplier's invoices BillsSuppliersUnpaidForCompany=Unpaid supplier's invoices for %s BillsLate=Late payments -BillsStatistics=Customer's invoices statistics -BillsStatisticsSuppliers=Supplier's invoices statistics +BillsStatistics=Customers invoices statistics +BillsStatisticsSuppliers=Suppliers invoices statistics DisabledBecauseNotErasable=Disabled because can not be erased InvoiceStandard=Standard invoice InvoiceStandardAsk=Standard invoice diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 3eab6893735..4127de804c6 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -16,13 +16,13 @@ SupplierOrder=Supplier order SuppliersOrders=Suppliers orders SuppliersOrdersRunning=Current suppliers orders CustomerOrder=Customer order -CustomersOrders=Customer's orders +CustomersOrders=Customers orders CustomersOrdersRunning=Current customer's orders CustomersOrdersAndOrdersLines=Customer orders and order's lines -OrdersToValid=Customer's orders to validate -OrdersToBill=Customer's orders delivered -OrdersInProcess=Customer's orders in process -OrdersToProcess=Customer's orders to process +OrdersToValid=Customers orders to validate +OrdersToBill=Customers orders delivered +OrdersInProcess=Customers orders in process +OrdersToProcess=Customers orders to process SuppliersOrdersToProcess=Supplier's orders to process StatusOrderCanceledShort=Canceled StatusOrderDraftShort=Draft diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index a6ba3d7b1cf..19d943798ce 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -121,7 +121,8 @@ if ($socid) // Country if ($object->country) { print '';
'.$langs->trans('Country').''; - $img=picto_from_langcode($object->country_code); + //$img=picto_from_langcode($object->country_code); + $img=''; print ($img?$img.' ':''); print $object->country; print '