Fixed approve during validation if user has permission

Fixed error management
Fixed rendering country must be same for all tabs.
This commit is contained in:
Laurent Destailleur 2015-01-25 00:59:46 +01:00
parent aab7aacccf
commit ad68b3ca6c
9 changed files with 64 additions and 55 deletions

View File

@ -289,7 +289,8 @@ if ($socid)
if ($soc->country) if ($soc->country)
{ {
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
$img=picto_from_langcode($soc->country_code); //$img=picto_from_langcode($soc->country_code);
$img='';
print ($img?$img.' ':''); print ($img?$img.' ':'');
print $soc->country; print $soc->country;
print '</td></tr>'; print '</td></tr>';

View File

@ -266,7 +266,8 @@ if ($id > 0)
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
if (! empty($object->country_code)) 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); if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country; else print ($img?$img.' ':'').$object->country;
} }

View File

@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/modules_commandefo
/** /**
\class mod_commande_fournisseur_orchidee * Classe du modele de numerotation de reference de commande fournisseur Orchidee
\brief Classe du modele de numerotation de reference de commande fournisseur Orchidee */
*/
class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
{ {
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'

View File

@ -156,7 +156,8 @@ if ($object->fetch($id))
// Country // Country
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
$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); if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country; else print ($img?$img.' ':'').$object->country;
print '</td></tr>'; print '</td></tr>';

View File

@ -591,7 +591,6 @@ class CommandeFournisseur extends CommonOrder
else else
{ {
$this->error = $obj->error; $this->error = $obj->error;
dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error);
return -1; return -1;
} }
} }

View File

@ -130,13 +130,13 @@ if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer)
} }
// mode de reglement // 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')); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
} }
// bank account // 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')); $result=$object->setBankAccount(GETPOST('fk_account', 'int'));
} }
@ -154,17 +154,17 @@ if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->cree
} }
// Set project // Set project
else if ($action == 'classin' && $user->rights->fournisseur->commande->creer) if ($action == 'classin' && $user->rights->fournisseur->commande->creer)
{ {
$object->setProject($projectid); $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']); $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))) 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 * 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'); $langs->load('errors');
$error = 0; $error = 0;
@ -402,7 +402,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
/* /*
* Mise a jour d'une ligne dans la commande * 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"]) 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')); $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(); $object->date_commande=dol_now();
$result = $object->valid($user); $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'); $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); $result = $object->refuse($user);
if ($result > 0) 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']); $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
if ($result > 0) 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); $result=$object->delete($user);
if ($result > 0) if ($result > 0)
@ -640,7 +640,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->four
} }
// Action clone object // 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')) if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{ {
@ -666,7 +666,7 @@ else if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fourn
} }
// Receive // Receive
else if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner) if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner)
{ {
if ($_POST["type"]) 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); $result = $object->cancel($user);
if ($result > 0) if ($result > 0)
@ -710,7 +710,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->four
} }
// Line ordering // Line ordering
else if ($action == 'up' && $user->rights->fournisseur->commande->creer) if ($action == 'up' && $user->rights->fournisseur->commande->creer)
{ {
$object->line_up($_GET['rowid']); $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'])); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
exit; exit;
} }
else if ($action == 'down' && $user->rights->fournisseur->commande->creer) if ($action == 'down' && $user->rights->fournisseur->commande->creer)
{ {
$object->line_down($_GET['rowid']); $object->line_down($_GET['rowid']);
@ -743,7 +743,7 @@ else if ($action == 'down' && $user->rights->fournisseur->commande->creer)
exit; 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 // Build document
@ -765,7 +765,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) /
} }
// Delete file in doc form // 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'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("other"); $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'); 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 // Fill array 'array_options' with data from add form
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
@ -818,7 +818,7 @@ elseif ($action == 'update_extras')
/* /*
* Create an order * Create an order
*/ */
else if ($action == 'add' && $user->rights->fournisseur->commande->creer) if ($action == 'add' && $user->rights->fournisseur->commande->creer)
{ {
$error=0; $error=0;
@ -1364,6 +1364,13 @@ elseif (! empty($object->id))
if (preg_match('/^[\(]?PROV/i',$object->ref)) $newref = $object->getNextNumRef($object->thirdparty); if (preg_match('/^[\(]?PROV/i',$object->ref)) $newref = $object->getNextNumRef($object->thirdparty);
else $newref = $object->ref; else $newref = $object->ref;
if ($newref < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
else
{
$text=$langs->trans('ConfirmValidateOrder',$newref); $text=$langs->trans('ConfirmValidateOrder',$newref);
if (! empty($conf->notification->enabled)) if (! empty($conf->notification->enabled))
{ {
@ -1374,7 +1381,7 @@ elseif (! empty($object->id))
} }
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);
}
} }
/* /*

View File

@ -1,16 +1,16 @@
# Dolibarr language file - Source file is en_US - bills # Dolibarr language file - Source file is en_US - bills
Bill=Invoice Bill=Invoice
Bills=Invoices Bills=Invoices
BillsCustomers=Customer's invoices BillsCustomers=Customers invoices
BillsCustomer=Customer's invoice BillsCustomer=Customers invoice
BillsSuppliers=Supplier's invoices BillsSuppliers=Suppliers invoices
BillsCustomersUnpaid=Unpaid customer's invoices BillsCustomersUnpaid=Unpaid customers invoices
BillsCustomersUnpaidForCompany=Unpaid customer's invoices for %s BillsCustomersUnpaidForCompany=Unpaid customer's invoices for %s
BillsSuppliersUnpaid=Unpaid supplier's invoices BillsSuppliersUnpaid=Unpaid supplier's invoices
BillsSuppliersUnpaidForCompany=Unpaid supplier's invoices for %s BillsSuppliersUnpaidForCompany=Unpaid supplier's invoices for %s
BillsLate=Late payments BillsLate=Late payments
BillsStatistics=Customer's invoices statistics BillsStatistics=Customers invoices statistics
BillsStatisticsSuppliers=Supplier's invoices statistics BillsStatisticsSuppliers=Suppliers invoices statistics
DisabledBecauseNotErasable=Disabled because can not be erased DisabledBecauseNotErasable=Disabled because can not be erased
InvoiceStandard=Standard invoice InvoiceStandard=Standard invoice
InvoiceStandardAsk=Standard invoice InvoiceStandardAsk=Standard invoice

View File

@ -16,13 +16,13 @@ SupplierOrder=Supplier order
SuppliersOrders=Suppliers orders SuppliersOrders=Suppliers orders
SuppliersOrdersRunning=Current suppliers orders SuppliersOrdersRunning=Current suppliers orders
CustomerOrder=Customer order CustomerOrder=Customer order
CustomersOrders=Customer's orders CustomersOrders=Customers orders
CustomersOrdersRunning=Current customer's orders CustomersOrdersRunning=Current customer's orders
CustomersOrdersAndOrdersLines=Customer orders and order's lines CustomersOrdersAndOrdersLines=Customer orders and order's lines
OrdersToValid=Customer's orders to validate OrdersToValid=Customers orders to validate
OrdersToBill=Customer's orders delivered OrdersToBill=Customers orders delivered
OrdersInProcess=Customer's orders in process OrdersInProcess=Customers orders in process
OrdersToProcess=Customer's orders to process OrdersToProcess=Customers orders to process
SuppliersOrdersToProcess=Supplier's orders to process SuppliersOrdersToProcess=Supplier's orders to process
StatusOrderCanceledShort=Canceled StatusOrderCanceledShort=Canceled
StatusOrderDraftShort=Draft StatusOrderDraftShort=Draft

View File

@ -121,7 +121,8 @@ if ($socid)
// Country // Country
if ($object->country) { if ($object->country) {
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
$img=picto_from_langcode($object->country_code); //$img=picto_from_langcode($object->country_code);
$img='';
print ($img?$img.' ':''); print ($img?$img.' ':'');
print $object->country; print $object->country;
print '</td></tr>'; print '</td></tr>';