Debug MO module
This commit is contained in:
parent
1f6a86e166
commit
b0ea276233
@ -72,14 +72,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0);
|
||||
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$permissionnote=$user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
|
||||
|
||||
/*
|
||||
@ -457,7 +457,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->bom->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
@ -532,7 +532,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
if (! empty($object->lines) && $object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
{
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
}
|
||||
@ -555,7 +555,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
if (! empty($object->lines) && $object->status == $object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
{
|
||||
print '</table>';
|
||||
}
|
||||
@ -565,8 +565,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Buttons for actions
|
||||
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
@ -584,7 +584,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($user->rights->bom->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
}
|
||||
@ -619,7 +619,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->bom->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&object=bom">' . $langs->trans("ToClone") . '</a>';
|
||||
}
|
||||
@ -638,7 +638,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
*/
|
||||
|
||||
if ($user->rights->bom->delete)
|
||||
if ($permissiontodelete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
|
||||
@ -667,21 +667,27 @@ class FormFile
|
||||
{
|
||||
$submodulepart = $modulepart;
|
||||
|
||||
// For normalized standard modules
|
||||
$file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$modulepart.'.php', 0);
|
||||
// modulepart = 'nameofmodule' or 'nameofmodule:nameofsubmodule'
|
||||
$tmp=explode(':', $modulepart);
|
||||
if (! empty($tmp[1])) {
|
||||
$modulepart=$tmp[0];
|
||||
$submodulepart=$tmp[1];
|
||||
}
|
||||
|
||||
// For normalized standard modules
|
||||
$file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$res=include_once $file;
|
||||
}
|
||||
// For normalized external modules. modulepart = 'nameofmodule' or 'nameofmodule:nameofsubmodule'
|
||||
// For normalized external modules.
|
||||
else
|
||||
{
|
||||
$tmp=explode(':', $modulepart);
|
||||
if (! empty($tmp[2])) $submodulepart=$tmp[2];
|
||||
$file=dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
|
||||
$file=dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
|
||||
$res=include_once $file;
|
||||
}
|
||||
$class='ModelePDF'.ucfirst($submodulepart);
|
||||
|
||||
if (class_exists($class))
|
||||
{
|
||||
$modellist=call_user_func($class.'::liste_modeles', $this->db);
|
||||
|
||||
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||
/**
|
||||
* Class to build documents using ODF templates generator
|
||||
*/
|
||||
class doc_generic_bom_odt extends ModelePDFBoms
|
||||
class doc_generic_bom_odt extends ModelePDFBom
|
||||
{
|
||||
/**
|
||||
* Issuer
|
||||
|
||||
@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
|
||||
/**
|
||||
* Parent class for boms models
|
||||
*/
|
||||
abstract class ModelePDFBoms extends CommonDocGenerator
|
||||
abstract class ModelePDFBom extends CommonDocGenerator
|
||||
{
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@ -62,7 +62,7 @@ class modMrp extends DolibarrModules
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "Module to Manage Manufacturing Orders (MO)";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'dolibarr';
|
||||
$this->version = 'experimental';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||
/**
|
||||
* Class to build documents using ODF templates generator
|
||||
*/
|
||||
class doc_generic_mo_odt extends ModelePDFMos
|
||||
class doc_generic_mo_odt extends ModelePDFMo
|
||||
{
|
||||
/**
|
||||
* Issuer
|
||||
|
||||
@ -23,10 +23,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/modules_mrp.php
|
||||
* \ingroup bom
|
||||
* \brief File that contains parent class for mos models
|
||||
* and parent class for mos numbering models
|
||||
* \file htdocs/core/modules/mrp/modules_mo.php
|
||||
* \ingroup mrp
|
||||
* \brief File that contains parent class for MOs models
|
||||
* and parent class for MOs numbering models
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
|
||||
/**
|
||||
* Parent class for mos models
|
||||
*/
|
||||
abstract class ModelePDFMos extends CommonDocGenerator
|
||||
abstract class ModelePDFMo extends CommonDocGenerator
|
||||
{
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@ -102,14 +102,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
|
||||
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit = $user->rights->mymodule->myobject->write; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && $object->status == 0);
|
||||
$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
|
||||
|
||||
|
||||
@ -404,7 +404,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
if (! empty($object->lines) && $object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
{
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
}
|
||||
@ -457,9 +457,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Modify
|
||||
if (! empty($user->rights->mymodule->myobject->write))
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -467,13 +467,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (! empty($user->rights->mymodule->myobject->write))
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a>'."\n";
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=myobject">' . $langs->trans("ToClone") . '</a>'."\n";
|
||||
}
|
||||
|
||||
/*
|
||||
if ($user->rights->mymodule->myobject->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($object->status == 1)
|
||||
{
|
||||
@ -487,7 +487,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
*/
|
||||
|
||||
// Delete (need delete permission, or if draft, just need create/modify permission)
|
||||
if (! empty($user->rights->mymodule->myobject->delete) || (! empty($object->fields['status']) && $object->status == $object::STATUS_DRAFT && ! empty($user->rights->mymodule->myobject->write)))
|
||||
if ($permissiontodelete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
|
||||
@ -90,14 +90,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0);
|
||||
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$permissionnote=$user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->mrp->write; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit=$user->rights->mrp->write; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd=$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0);
|
||||
$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
|
||||
|
||||
/*
|
||||
@ -132,6 +132,12 @@ if (empty($reshook))
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='MO_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_MO_TO';
|
||||
$trackid='mo'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Action to move up and down lines of object
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
@ -143,12 +149,6 @@ if (empty($reshook))
|
||||
{
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='MO_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_MO_TO';
|
||||
$trackid='mo'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -159,6 +159,7 @@ if (empty($reshook))
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formfile=new FormFile($db);
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
llxHeader('', $langs->trans('Mo'), '');
|
||||
@ -299,6 +300,46 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of validation
|
||||
if ($action == 'validate')
|
||||
{
|
||||
// We check that object has a temporary ref
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV') {
|
||||
$object->fetch_product();
|
||||
$numref = $object->getNextNumRef($object->thirdparty);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateMo', $numref);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
|
||||
}*/
|
||||
|
||||
$formquestion=array();
|
||||
if (! empty($conf->bom->enabled))
|
||||
{
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
@ -332,7 +373,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->mrp->write)
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
@ -366,7 +407,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak='fk_warehouse';
|
||||
@ -407,14 +448,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
if (! empty($object->lines) && $object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
{
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
}
|
||||
|
||||
if (! empty($object->lines))
|
||||
{
|
||||
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1);
|
||||
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/mrp/tpl');
|
||||
}
|
||||
|
||||
// Form to add new line
|
||||
@ -423,14 +464,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if ($action != 'editline')
|
||||
{
|
||||
// Add products/services form
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
$object->formAddObjectLine(1, $mysoc, $soc, '/mrp/tpl');
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
if (! empty($object->lines) && $object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
|
||||
{
|
||||
print '</table>';
|
||||
}
|
||||
@ -451,10 +492,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Send
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
|
||||
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
|
||||
|
||||
if ($user->rights->bom->write && $object->status == MO::STATUS_VALIDATED)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
|
||||
}
|
||||
|
||||
// Modify
|
||||
if (! empty($user->rights->mrp->write))
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
}
|
||||
@ -477,13 +523,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (! empty($user->rights->mrp->write))
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->fk_soc . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->fk_soc . '&action=clone&object=mo">' . $langs->trans("ToClone") . '</a>';
|
||||
}
|
||||
|
||||
// Delete (need delete permission, or if draft, just need create/modify permission)
|
||||
if (! empty($user->rights->mrp->delete) || (! empty($object->fields['status']) && $object->status == $object::STATUS_DRAFT && ! empty($user->rights->mrp->write)))
|
||||
if ($permissiontodelete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
@ -507,14 +553,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents
|
||||
/*$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $objref . '/' . $objref . '.pdf';
|
||||
$filedir = $conf->mrp->dir_output . '/' . $objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->rights->mrp->create; // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('mrp', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
*/
|
||||
print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('mo'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user