mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Uniformize code
This commit is contained in:
parent
aec0e79653
commit
f95acb24ff
|
|
@ -29,6 +29,10 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
$langs->load("orders");
|
||||
$langs->load("sendings");
|
||||
|
|
@ -165,11 +169,10 @@ if ($id > 0 || ! empty($ref))
|
|||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
/*
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
|
||||
if ($user->rights->supplier_proposal->creer) {
|
||||
if (0) { // Do not change on shipment
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
}
|
||||
|
|
@ -185,17 +188,20 @@ if ($id > 0 || ! empty($ref))
|
|||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
// We don't have project on shipment, so we will use the project or source object instead
|
||||
// TODO Add project on shipment
|
||||
$morehtmlref .= ' : ';
|
||||
if (! empty($objectsrc->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$proj->fetch($objectsrc->fk_project);
|
||||
$morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@
|
|||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
$langs->load("sendings");
|
||||
$langs->load("companies");
|
||||
|
|
@ -110,37 +114,39 @@ if ($id > 0 || ! empty($ref))
|
|||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
/*
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
|
||||
if ($user->rights->supplier_proposal->creer) {
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
|
||||
if (0) { // Do not change on shipment
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
// We don't have project on shipment, so we will use the project or source object instead
|
||||
// TODO Add project on shipment
|
||||
$morehtmlref .= ' : ';
|
||||
if (! empty($objectsrc->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($objectsrc->fk_project);
|
||||
$morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,11 @@ if (! empty($conf->expedition_bon->enabled))
|
|||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
if (! empty($conf->stock->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
|
||||
$langs->load("sendings");
|
||||
$langs->load("bills");
|
||||
|
|
@ -312,13 +316,8 @@ else
|
|||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
// Origin of a 'livraison' (delivery) is ALWAYS 'expedition' (shipment).
|
||||
// Origin of a 'livraison' (delivery receipt) is ALWAYS 'expedition' (shipment).
|
||||
// However, origin of shipment in future may differs (commande, proposal, ...)
|
||||
// TODO REGIS:
|
||||
// Je ne suis pas d'accord, beaucoup entreprises n'utilisent pas les bons d'expéditions car ces derniers sont gérés par le transporteur,
|
||||
// donc les bons de livraisons peuvent avoir une origine différente de 'expedition'
|
||||
// les bons de livraisons et d'expéditions devraient être considérés comme des objets à part entière, voir des modules différents comme une propal ou autres.
|
||||
|
||||
$expedition=new Expedition($db);
|
||||
$result = $expedition->fetch($object->origin_id);
|
||||
$typeobject = $expedition->origin; // example: commande
|
||||
|
|
@ -369,17 +368,17 @@ else
|
|||
* Livraison
|
||||
*/
|
||||
|
||||
if ($typeobject == 'commande' && $expedition->$typeobject->id && ! empty($conf->commande->enabled))
|
||||
if ($typeobject == 'commande' && $expedition->origin_id > 0 && ! empty($conf->commande->enabled))
|
||||
{
|
||||
$objectsrc=new Commande($db);
|
||||
$objectsrc->fetch($expedition->$typeobject->id);
|
||||
$objectsrc->fetch($expedition->origin_id);
|
||||
}
|
||||
if ($typeobject == 'propal' && $expedition->$typeobject->id && ! empty($conf->propal->enabled))
|
||||
if ($typeobject == 'propal' && $expedition->origin_id > 0 && ! empty($conf->propal->enabled))
|
||||
{
|
||||
$objectsrc=new Propal($db);
|
||||
$objectsrc->fetch($expedition->$typeobject->id);
|
||||
$objectsrc->fetch($expedition->origin_id);
|
||||
}
|
||||
|
||||
|
||||
// Shipment card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
|
@ -411,10 +410,10 @@ else
|
|||
}
|
||||
} else {
|
||||
$morehtmlref .= ' : ';
|
||||
if (! empty($expeditionsrc->fk_project)) {
|
||||
if (! empty($objectsrc->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($expeditionsrc->fk_project);
|
||||
$morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $expeditionsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$proj->fetch($objectsrc->fk_project);
|
||||
$morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $objectsrc->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user