Fix regression

This commit is contained in:
Laurent Destailleur 2020-10-25 17:19:15 +01:00
parent 8578a7cd7c
commit 6c1f60f6c0
3 changed files with 24 additions and 12 deletions

View File

@ -51,7 +51,6 @@ function shipping_prepare_head($object)
{
// delivery link
$object->fetchObjectLinked($object->id, $object->element);
var_dump($object->id);
if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
{
// Take first one element of array
@ -158,11 +157,21 @@ function delivery_prepare_head($object)
$tmpobject = $object;
}
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$tmpobject->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
$head[$h][2] = 'contact';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$objectsrc = $tmpobject;
if ($tmpobject->origin == 'commande' && $tmpobject->origin_id > 0)
{
$objectsrc = new Commande($db);
$objectsrc->fetch($tmpobject->origin_id);
}
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$tmpobject->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';

View File

@ -57,7 +57,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
// Security check
$id = GETPOST('id', 'int');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'expedition', $id, 'delivery', 'livraison');
$result = restrictedArea($user, 'expedition', $id, 'delivery', 'delivery');
$object = new Delivery($db);
$extrafields = new ExtraFields($db);
@ -87,13 +87,14 @@ if ($action == 'add')
$db->begin();
$object->date_livraison = time();
$object->note = $_POST["note"];
$object->commande_id = $_POST["commande_id"];
$object->note = GETPOST("note", 'restricthtml');
$object->note_private = GETPOST("note", 'restricthtml');
$object->commande_id = GETPOST("commande_id", 'int');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled))
{
$expedition->entrepot_id = $_POST["entrepot_id"];
$expedition->entrepot_id = GETPOST('entrepot_id');
}
// On boucle sur chaque ligne de commande pour completer objet livraison
@ -276,7 +277,6 @@ if ($action == 'create') // Create. Seems to no be used
$head = delivery_prepare_head($object);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update_extras_line">';
@ -364,7 +364,7 @@ if ($action == 'create') // Create. Seems to no be used
}
$morehtmlref .= '</div>';
$morehtmlright = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br>';
$morehtmlright = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br><br class="small">';
dol_banner_tab($expedition, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', $morehtmlright);

View File

@ -29,6 +29,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -39,6 +40,8 @@ if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/
*/
class Delivery extends CommonObject
{
use CommonIncoterm;
/**
* @var string ID to identify managed object
*/