Complete work on dol_banner

This commit is contained in:
Laurent Destailleur 2016-12-26 18:21:18 +01:00
parent b9e362833f
commit 82052450a6
7 changed files with 206 additions and 102 deletions

View File

@ -278,7 +278,7 @@ if ($action == 'add')
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int");
}
$object->note = trim($_POST["note"]);
$object->note = trim(GETPOST("note"));
if (isset($_POST["contactid"])) $object->contact = $contact;
@ -290,11 +290,6 @@ if ($action == 'add')
$object->societe = $object->thirdparty; // For backward compatibility
}
// Special for module webcal and phenix
// TODO external modules
if (! empty($conf->webcalendar->enabled) && GETPOST('add_webcal') == 'on') $object->use_webcal=1;
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
// Check parameters
if (empty($object->userownerid) && empty($_SESSION['assignedtouser']))
{

View File

@ -993,16 +993,26 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " u.login, u.rowid as user_id";
if (get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
if (get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
if (get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
$sql.= " WHERE u.rowid = a.fk_user_author";
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
if (get_class($filterobj) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if (get_class($filterobj) == 'Adherent' && $filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
if (get_class($filterobj) == 'Adherent')
{
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
if (get_class($filterobj) == 'CommandeFournisseur')
{
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
// Condition on actioncode
if (! empty($actioncode))
@ -1133,6 +1143,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
@ -1142,9 +1153,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$userstatic=new User($db);
$contactstatic = new Contact($db);
// TODO uniformize
// TODO mutualize/uniformize
$propalstatic=new Propal($db);
$orderstatic=new Commande($db);
$supplierorderstatic=new CommandeFournisseur($db);
$facturestatic=new Facture($db);
$out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
@ -1286,7 +1298,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';
// Objet lie
// TODO uniformize
// TODO mutualize/uniformize
$out.='<td>';
//var_dump($histo[$key]['elementtype']);
if (isset($histo[$key]['elementtype']))

View File

@ -101,7 +101,8 @@ function facturefourn_prepare_head($object)
*/
function ordersupplier_prepare_head($object)
{
global $db, $langs, $conf;
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
@ -159,7 +160,12 @@ function ordersupplier_prepare_head($object)
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][1].= $langs->trans("Events");
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$head[$h][1].= '/';
$head[$h][1].= $langs->trans("Agenda");
}
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove');

View File

@ -184,7 +184,7 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_fiche_end();

View File

@ -625,9 +625,9 @@ if ($id > 0 || ! empty($ref)) {
// Message if nothing to dispatch
if (! $nbproduct) {
if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED))
print $langs->trans("NoPredefinedProductToDispatch"); // No predefined line at all
print '<div class="opacitymedium">'.$langs->trans("NoPredefinedProductToDispatch").'</div>'; // No predefined line at all
else
print $langs->trans("NoMorePredefinedProductToDispatch"); // No predefined line that remain to be dispatched.
print '<div class="opacitymedium">'.$langs->trans("NoMorePredefinedProductToDispatch").'</div>'; // No predefined line that remain to be dispatched.
}
print '</form>';

View File

@ -27,6 +27,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("orders");
$langs->load("suppliers");
@ -35,11 +36,44 @@ $langs->load('stocks');
$id=GETPOST('id','int');
$ref=GETPOST('ref','alpha');
$action = GETPOST('action','alpha');
if (GETPOST('actioncode','array'))
{
$actioncode=GETPOST('actioncode','array',3);
if (! count($actioncode)) $actioncode='0';
}
else
{
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$search_agenda_label=GETPOST('search_agenda_label');
// Security check
$socid='';
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
$socid=0;
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'fournisseur',$id,'', 'commande');
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
/*
* Actions
*/
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$actioncode='';
$search_agenda_label='';
}
/*
@ -47,89 +81,143 @@ $result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
*/
$form = new Form($db);
$now=dol_now();
$object = new CommandeFournisseur($db);
if ($id > 0 || ! empty($ref))
{
$soc = new Societe($db);
$object = new CommandeFournisseur($db);
$result=$object->fetch($id,$ref);
if ($result >= 0)
{
$object->info($object->id);
$soc->fetch($object->socid);
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('',$langs->trans("Order"),$help_url);
$head = ordersupplier_prepare_head($object);
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'info', $title, 0, 'order');
/*
* Commande
*/
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $object->getLibStatut(4);
print "</td></tr>";
// Date
if ($object->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($object->date_commande)
{
print dol_print_date($object->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($object->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
}
}
print "</table>\n";
print "<br>";
print '<table width="100%"><tr><td>';
dol_print_object_info($object, 1);
print '</td></tr></table>';
print '</div>';
}
else
{
/* Order not found */
print "OrderNotFound";
}
$object->fetch($id, $ref);
$object->fetch_thirdparty();
$object->info($object->id);
}
$title=$langs->trans("SupplierOrder").' - '.$object->ref.' '.$object->name;
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('',$title,$help_url);
$now=dol_now();
$head = ordersupplier_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("SupplierOrder"), 0, 'order');
// Supplier order card
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Ref supplier
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
// 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->fournisseur->commande->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
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 valignmiddle" 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.='';
}
}
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
dol_print_object_info($object, 1);
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
// Actions buttons
$out='';
$permok=$user->rights->agenda->myactions->create;
if ($permok)
{
$out.='&originid='.$object->id.'&origin=order_supplier';
}
print '<div class="tabsAction">';
if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("AddAction").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
}
}
print '</div>';
if (!empty($object->id))
{
$param='&id='.$object->id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("ActionsOnOrder"),'','');
// List of actions on element
/*include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'project',0);*/
// List of todo actions
//show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
// List of done actions
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters);
}
llxFooter();
$db->close();

View File

@ -48,7 +48,6 @@ $search_agenda_label=GETPOST('search_agenda_label');
// Security check
$socid=0;
$id = GETPOST("id",'int');
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'projet',$id,'');
@ -80,11 +79,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$form = new Form($db);
$object = new Project($db);
$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name;
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
$help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("",$title,$help_url);
if ($id > 0 || ! empty($ref))
{
$object->fetch($id, $ref);
@ -92,6 +86,11 @@ if ($id > 0 || ! empty($ref))
$object->info($object->id);
}
$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name;
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
$help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("",$title,$help_url);
$head = project_prepare_head($object);
dol_fiche_head($head, 'agenda', $langs->trans("Project"), 0, ($object->public?'projectpub':'project'));
@ -162,6 +161,10 @@ print '</div>';
if (!empty($object->id))
{
$param='&id='.$object->id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("ActionsOnProject"),'','');
// List of actions on element