FIX better compatibility with Multicompany
This commit is contained in:
parent
f910d5ff55
commit
b73df2698d
@ -1138,7 +1138,7 @@ class Propal extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET fk_delivery_address = ".$this->fk_delivery_address;
|
||||
$sql.= " WHERE ref = '".$this->db->escape($this->ref)."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND entity = ".$this->entity;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
}
|
||||
|
||||
@ -998,7 +998,7 @@ if ($resql)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
|
||||
@ -96,9 +96,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->commande->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
$usercanread = $user->rights->commande->lire;
|
||||
$usercancreate = $user->rights->commande->creer;
|
||||
$usercanclose = $user->rights->commande->cloturer;
|
||||
$usercandelete = $user->rights->commande->supprimer;
|
||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)));
|
||||
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)));
|
||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
|
||||
|
||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -129,7 +137,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
@ -159,7 +167,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
elseif ($action == 'reopen' && $user->rights->commande->creer)
|
||||
elseif ($action == 'reopen' && $usercancreate)
|
||||
{
|
||||
if ($object->statut == Commande::STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED)
|
||||
{
|
||||
@ -176,7 +184,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Remove order
|
||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer)
|
||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete)
|
||||
{
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
@ -191,7 +199,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Remove a product line
|
||||
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer)
|
||||
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$result = $object->deleteline($user, $lineid);
|
||||
if ($result > 0)
|
||||
@ -222,13 +230,13 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Link to a project
|
||||
elseif ($action == 'classin' && $user->rights->commande->creer)
|
||||
elseif ($action == 'classin' && $usercancreate)
|
||||
{
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
|
||||
// Add order
|
||||
elseif ($action == 'add' && $user->rights->commande->creer)
|
||||
elseif ($action == 'add' && $usercancreate)
|
||||
{
|
||||
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
@ -252,6 +260,7 @@ if (empty($reshook))
|
||||
$db->begin();
|
||||
|
||||
$object->date_commande = $datecommande;
|
||||
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
|
||||
$object->note_private = GETPOST('note_private', 'none');
|
||||
$object->note_public = GETPOST('note_public', 'none');
|
||||
$object->source = GETPOST('source_id');
|
||||
@ -481,7 +490,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'classifybilled' && $user->rights->commande->creer)
|
||||
elseif ($action == 'classifybilled' && $usercancreate)
|
||||
{
|
||||
$ret=$object->classifyBilled($user);
|
||||
|
||||
@ -489,7 +498,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
elseif ($action == 'classifyunbilled' && $user->rights->commande->creer)
|
||||
elseif ($action == 'classifyunbilled' && $usercancreate)
|
||||
{
|
||||
$ret=$object->classifyUnBilled();
|
||||
if ($ret < 0) {
|
||||
@ -498,7 +507,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Positionne ref commande client
|
||||
elseif ($action == 'setref_client' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setref_client' && $usercancreate) {
|
||||
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -506,7 +515,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setremise' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setremise' && $usercancreate) {
|
||||
$result = $object->set_remise($user, GETPOST('remise'));
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -514,7 +523,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setabsolutediscount' && $usercancreate) {
|
||||
if (GETPOST('remise_id')) {
|
||||
if ($object->id > 0) {
|
||||
$object->insert_discount(GETPOST('remise_id'));
|
||||
@ -524,7 +533,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setdate' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setdate' && $usercancreate) {
|
||||
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year'));
|
||||
|
||||
@ -534,7 +543,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setdate_livraison' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setdate_livraison' && $usercancreate) {
|
||||
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
|
||||
@ -544,35 +553,35 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setmode' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setmode' && $usercancreate) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Multicurrency Code
|
||||
elseif ($action == 'setmulticurrencycode' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
}
|
||||
|
||||
// Multicurrency rate
|
||||
elseif ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
elseif ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setavailability' && $usercancreate) {
|
||||
$result = $object->availability(GETPOST('availability_id'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
elseif ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setdemandreason' && $usercancreate) {
|
||||
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
elseif ($action == 'setconditions' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setconditions' && $usercancreate) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
@ -604,7 +613,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// bank account
|
||||
elseif ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setbankaccount' && $usercancreate) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -612,7 +621,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// shipping method
|
||||
elseif ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setshippingmethod' && $usercancreate) {
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -620,23 +629,23 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// warehouse
|
||||
elseif ($action == 'setwarehouse' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setwarehouse' && $usercancreate) {
|
||||
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setremisepercent' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise($user, GETPOST('remise_percent'));
|
||||
}
|
||||
|
||||
elseif ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
|
||||
}
|
||||
|
||||
// Add a new line
|
||||
elseif ($action == 'addline' && $user->rights->commande->creer)
|
||||
elseif ($action == 'addline' && $usercancreate)
|
||||
{
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
@ -999,7 +1008,7 @@ if (empty($reshook))
|
||||
/*
|
||||
* Update a line
|
||||
*/
|
||||
elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save'))
|
||||
elseif ($action == 'updateline' && $usercancreate && GETPOST('save'))
|
||||
{
|
||||
// Clean parameters
|
||||
$date_start='';
|
||||
@ -1133,15 +1142,12 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
|
||||
} elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||
exit();
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_validate' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
@ -1195,7 +1201,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Go back to draft status
|
||||
elseif ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'confirm_modif' && $usercancreate) {
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
$qualified_for_stock_change=0;
|
||||
@ -1243,17 +1249,14 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
|
||||
elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) {
|
||||
$result = $object->cloture($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_cancel' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
@ -1310,7 +1313,7 @@ if (empty($reshook))
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
|
||||
if ($action == 'set_thirdparty' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
|
||||
@ -1321,7 +1324,7 @@ if (empty($reshook))
|
||||
|
||||
// add lines from objectlinked
|
||||
if($action == 'import_lines_from_object'
|
||||
&& $user->rights->commande->creer
|
||||
&& $usercancreate
|
||||
&& $object->statut == Commande::STATUS_DRAFT
|
||||
)
|
||||
{
|
||||
@ -1405,8 +1408,8 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->commande->dir_output;
|
||||
$permissioncreate = $user->rights->commande->creer;
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity];
|
||||
$permissioncreate = $usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
@ -1417,7 +1420,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
@ -1478,7 +1481,7 @@ $formmargin = new FormMargin($db);
|
||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($action == 'create' && $usercancreate)
|
||||
{
|
||||
print load_fiche_titre($langs->trans('CreateOrder'), '', 'title_commercial.png');
|
||||
|
||||
@ -2069,8 +2072,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
|
||||
@ -2079,7 +2082,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
if ($usercancreate)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
@ -2159,7 +2162,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Date
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
|
||||
$editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("Date", 'date', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdate') {
|
||||
@ -2180,7 +2183,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Delivery date planed
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdate_livraison') {
|
||||
@ -2202,7 +2205,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Shipping Method
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editshippingmethod') {
|
||||
@ -2220,7 +2223,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct=new FormProduct($db);
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editwarehouse') {
|
||||
@ -2234,7 +2237,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editconditions') {
|
||||
@ -2248,7 +2251,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
@ -2264,7 +2267,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Multicurrency code
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
|
||||
$editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencycode') {
|
||||
@ -2277,7 +2280,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
$editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
|
||||
$editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
@ -2298,7 +2301,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editavailability') {
|
||||
@ -2310,7 +2313,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Source reason (why we have an ordrer)
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdemandreason') {
|
||||
@ -2323,7 +2326,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// TODO Order mode (how we receive order). Not yet implemented
|
||||
/*
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editinputmode') {
|
||||
@ -2355,7 +2358,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled)) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -2373,7 +2376,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Bank Account
|
||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
@ -2497,7 +2500,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
/*
|
||||
* Form to add new line
|
||||
*/
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines')
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
@ -2528,22 +2531,19 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if ($object->statut > Commande::STATUS_DRAFT) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
|
||||
if ($usercansend) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
}
|
||||
|
||||
// Valid
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && $usercanvalidate)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
// Edit
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && $user->rights->commande->creer) {
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
}
|
||||
// Create event
|
||||
@ -2597,12 +2597,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $user->rights->commande->creer) {
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
|
||||
}
|
||||
|
||||
// Set to shipped
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $user->rights->commande->cloturer) {
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=shipped">' . $langs->trans('ClassifyShipped') . '</a></div>';
|
||||
}
|
||||
|
||||
@ -2612,31 +2612,28 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("CreateBill") . '</a></div>';
|
||||
}
|
||||
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifybilled">' . $langs->trans("ClassifyBilled") . '</a></div>';
|
||||
}
|
||||
}
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
||||
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifyunbilled">' . $langs->trans("ClassifyUnBilled") . '</a></div>';
|
||||
}
|
||||
}
|
||||
// Clone
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// Cancel order
|
||||
if ($object->statut == Commande::STATUS_VALIDATED &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
|
||||
)
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && (! empty($usercanclose) || ! empty($usercancancel)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
||||
}
|
||||
|
||||
// Delete order
|
||||
if ($user->rights->commande->supprimer) {
|
||||
if ($usercandelete) {
|
||||
if ($numshipping == 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||
} else {
|
||||
@ -2659,18 +2656,18 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Documents
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
$filedir = $conf->commande->dir_output . '/' . $comref;
|
||||
$filedir = $conf->commande->multidir_output[$object->entity] . '/' . $comref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->commande->lire;
|
||||
$delallowed = $user->rights->commande->creer;
|
||||
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
$genallowed = $usercanread;
|
||||
$delallowed = $usercancreate;
|
||||
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object);
|
||||
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||
|
||||
$compatibleImportElementsList = false;
|
||||
if($user->rights->commande->creer
|
||||
if($usercancreate
|
||||
&& $object->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
|
||||
@ -2707,7 +2704,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Presend form
|
||||
$modelmail='order_send';
|
||||
$defaulttopic='SendOrderRef';
|
||||
$diroutput = $conf->commande->dir_output;
|
||||
$diroutput = $conf->commande->multidir_output[$object->entity];
|
||||
$trackid = 'ord'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
@ -427,8 +427,8 @@ class Commande extends CommonOrder
|
||||
// in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->commande->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->commande->dir_output.'/'.$newref;
|
||||
$dirsource = $conf->commande->multidir_output[$this->entity].'/'.$oldref;
|
||||
$dirdest = $conf->commande->multidir_output[$this->entity].'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
@ -437,7 +437,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
dol_syslog("Rename ok");
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles=dol_dir_list($conf->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
$listoffiles=dol_dir_list($conf->commande->multidir_output[$this->entity].'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
foreach($listoffiles as $fileentry)
|
||||
{
|
||||
$dirsource=$fileentry['name'];
|
||||
@ -776,6 +776,7 @@ class Commande extends CommonOrder
|
||||
|
||||
// Clean parameters
|
||||
$this->brouillon = 1; // set command as draft
|
||||
if (empty($this->entity)) $this->entity = $conf->entity;
|
||||
|
||||
// $date_commande is deprecated
|
||||
$date = ($this->date_commande ? $this->date_commande : $this->date);
|
||||
@ -859,7 +860,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$this->entity;
|
||||
$sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
|
||||
$sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
|
||||
$sql.= ", ".(int) $this->fk_multicurrency;
|
||||
@ -1232,6 +1233,7 @@ class Commande extends CommonOrder
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
|
||||
$this->entity = $object->entity;
|
||||
$this->socid = $object->socid;
|
||||
$this->fk_project = $object->fk_project;
|
||||
$this->cond_reglement_id = $object->cond_reglement_id;
|
||||
@ -3320,10 +3322,10 @@ class Commande extends CommonOrder
|
||||
{
|
||||
// Remove directory with files
|
||||
$comref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->commande->dir_output && !empty($this->ref))
|
||||
if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref))
|
||||
{
|
||||
$dir = $conf->commande->dir_output . "/" . $comref ;
|
||||
$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
|
||||
$dir = $conf->commande->multidir_output[$this->entity] . "/" . $comref ;
|
||||
$file = $conf->commande->multidir_output[$this->entity] . "/" . $comref . "/" . $comref . ".pdf";
|
||||
if (file_exists($file)) // We must delete all files before deleting directory
|
||||
{
|
||||
dol_delete_preview($this);
|
||||
|
||||
@ -72,7 +72,7 @@ $object = new Commande($db);
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
@ -92,7 +92,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), -1, 'order');
|
||||
@ -174,7 +174,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$modulepart = 'commande';
|
||||
$permission = $user->rights->commande->creer;
|
||||
$permtoedit = $user->rights->commande->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
$param = '&id=' . $object->id.'&entity=' . (! empty($object->entity)?$object->entity:$conf->entity);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
|
||||
@ -235,7 +235,7 @@ $max=5;
|
||||
* Last modified orders
|
||||
*/
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
|
||||
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
|
||||
$sql.= " s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_client";
|
||||
@ -291,7 +291,7 @@ if ($resql)
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
@ -317,7 +317,7 @@ else dol_print_error($db);
|
||||
*/
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.canvas";
|
||||
@ -371,7 +371,7 @@ if (! empty($conf->commande->enabled))
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
@ -399,7 +399,7 @@ if (! empty($conf->commande->enabled))
|
||||
*/
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.canvas";
|
||||
@ -453,7 +453,7 @@ if (! empty($conf->commande->enabled))
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
@ -91,7 +91,7 @@ $id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int'));
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'commande', $id, '');
|
||||
|
||||
$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$diroutputmassaction=$conf->commande->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
@ -217,7 +217,7 @@ if (empty($reshook))
|
||||
$objectlabel='Orders';
|
||||
$permtoread = $user->rights->commande->lire;
|
||||
$permtodelete = $user->rights->commande->supprimer;
|
||||
$uploaddir = $conf->commande->dir_output;
|
||||
$uploaddir = $conf->commande->multidir_output[$conf->entity];
|
||||
$trigger_name='ORDER_SENTBYMAIL';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -928,7 +928,7 @@ if ($resql)
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
print '</td>';
|
||||
@ -1075,7 +1075,7 @@ if ($resql)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
|
||||
@ -548,7 +548,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
|
||||
</script>
|
||||
<?php
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.entity, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
@ -680,7 +680,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->commande->multidir_output[$objp->entity] . '/' . dol_sanitizeFileName($objp->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
@ -97,7 +97,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->facture->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = facture_prepare_head($object);
|
||||
dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill');
|
||||
|
||||
@ -1202,7 +1202,7 @@ if ($resql)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
|
||||
@ -1228,7 +1228,7 @@ class FormFile
|
||||
print '</a>';
|
||||
}
|
||||
// Preview link
|
||||
if (! $editline) print $this->showPreview($file, $modulepart, $filepath);
|
||||
if (! $editline) print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(! empty($object->entity)?$object->entity:$onf->entity));
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
@ -2186,10 +2186,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$original_file=$conf->adherent->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu factures
|
||||
elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output))
|
||||
elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->facture->{$lire}) $accessallowed=1;
|
||||
$original_file=$conf->facture->dir_output.'/'.$original_file;
|
||||
$original_file=$conf->facture->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu propal
|
||||
elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity]))
|
||||
@ -2198,10 +2198,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$original_file=$conf->propal->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu commande
|
||||
elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output))
|
||||
elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->commande->{$lire}) $accessallowed=1;
|
||||
$original_file=$conf->commande->dir_output.'/'.$original_file;
|
||||
$original_file=$conf->commande->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu intervention
|
||||
elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output))
|
||||
@ -2397,13 +2397,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
|
||||
// Wrapping for invoices
|
||||
elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output))
|
||||
elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->facture->dir_output.'/'.$original_file;
|
||||
$original_file=$conf->facture->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
// Wrapping for mass actions
|
||||
@ -2421,7 +2421,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->commande->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
$original_file=$conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
elseif ($modulepart == 'massfilesarea_invoices')
|
||||
{
|
||||
@ -2429,7 +2429,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
$original_file=$conf->facture->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
elseif ($modulepart == 'massfilesarea_expensereport')
|
||||
{
|
||||
@ -2513,13 +2513,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
|
||||
// Wrapping pour les commandes
|
||||
elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output))
|
||||
elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->commande->dir_output.'/'.$original_file;
|
||||
$original_file=$conf->commande->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ function commande_prepare_head(Commande $object)
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
|
||||
|
||||
@ -244,7 +244,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
|
||||
$dir = $conf->commande->dir_output;
|
||||
$dir = $conf->commande->multidir_output[$object->entity];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".odt";
|
||||
|
||||
@ -239,13 +239,13 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
$dir = $conf->commande->dir_output;
|
||||
$dir = $conf->commande->multidir_output[$conf->entity];
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->commande->dir_output . "/" . $objectref;
|
||||
$dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
}
|
||||
|
||||
|
||||
@ -281,13 +281,13 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
$dir = $conf->commande->dir_output;
|
||||
$dir = $conf->commande->multidir_output[$conf->entity];
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->commande->dir_output . "/" . $objectref;
|
||||
$dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND entity IN (".getEntity('ordernumber', 1, $object).")";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -137,9 +137,12 @@ class mod_commande_saphir extends ModeleNumRefCommandes
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get entities
|
||||
$entity = getEntity('ordernumber', 1, $object);
|
||||
|
||||
$date = ($object->date_commande ? $object->date_commande : $object->date);
|
||||
|
||||
$numFinal=get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date);
|
||||
$numFinal=get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date, 'next', false, null, $entity);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ print '<table summary="who"><tr><td>'.img_picto('', 'who.png', 'class="valigntex
|
||||
print '<font style="'.$style1.'">'.$langs->trans("CommunitySupport").'</font>';
|
||||
print '<br>'.$langs->trans("TypeOfSupport").': <font style="'.$style2.'">'.$langs->trans("TypeSupportCommunauty").'</font>';
|
||||
print '<br>'.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").': ';
|
||||
print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valigntextbottom"', 1).img_picto_common('', 'redstar', 'class="valigntextbottom"', 1).'/'.img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1);
|
||||
print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valigntextbottom minwidth50"', 1).img_picto_common('', 'redstar', 'class="valigntextbottom minwidth50"', 1).'/'.img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1);
|
||||
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user