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)
{
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 $soc->country;
print '</td></tr>';

View File

@ -266,7 +266,8 @@ if ($id > 0)
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
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;
}

View File

@ -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'

View File

@ -156,7 +156,8 @@ if ($object->fetch($id))
// Country
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);
else print ($img?$img.' ':'').$object->country;
print '</td></tr>';

View File

@ -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;
}
}

View File

@ -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 '</td></tr>';
}
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';
$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.='<br>';
$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.='<br>';
$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 '</td>';
print '</tr>';
}
// Delivery date planed
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -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 '<table class="border" width="100%">';
@ -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

View File

@ -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

View File

@ -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

View File

@ -121,7 +121,8 @@ if ($socid)
// Country
if ($object->country) {
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 $object->country;
print '</td></tr>';