mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
code syntax contrat directory
This commit is contained in:
parent
2642e1d1b3
commit
2da97c2bac
|
|
@ -40,13 +40,17 @@ $form = new Form($db);
|
|||
// List of supported format
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
foreach ($tmptype2label as $key => $val) {
|
||||
$type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'contrat'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -78,8 +82,7 @@ print dol_get_fiche_end();
|
|||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
|
|
@ -92,8 +95,7 @@ if ($action != 'create' && $action != 'edit')
|
|||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($action == 'create') {
|
||||
print '<br><div name="topofform" id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
|
|
@ -105,8 +107,7 @@ if ($action == 'create')
|
|||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print '<div name="topofform"></div><br>';
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
|
|
|
|||
|
|
@ -40,13 +40,17 @@ $form = new Form($db);
|
|||
// List of supported format
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
foreach ($tmptype2label as $key => $val) {
|
||||
$type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'contratdet'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -78,8 +82,7 @@ print dol_get_fiche_end();
|
|||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
|
|
@ -92,8 +95,7 @@ if ($action != 'create' && $action != 'edit')
|
|||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
|
|
@ -105,8 +107,7 @@ if ($action == 'create')
|
|||
/* Edition d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
|
|
|
|||
|
|
@ -35,10 +35,11 @@ if (!empty($conf->projet->enabled)) {
|
|||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "contracts"));
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
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_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
|
|
@ -50,19 +51,27 @@ $id = GETPOST('id', 'int');
|
|||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id, '');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = 'a.datep,a.id';
|
||||
if (!$sortorder) $sortorder = 'DESC,DESC';
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'a.datep,a.id';
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC,DESC';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('agendacontract', 'globalcard'));
|
||||
|
|
@ -74,20 +83,19 @@ $hookmanager->initHooks(array('agendacontract', 'globalcard'));
|
|||
|
||||
$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');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage))
|
||||
{
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$actioncode = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
|
|
@ -102,19 +110,18 @@ if (empty($reshook))
|
|||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
}
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
if ($id > 0) {
|
||||
// Load object modContract
|
||||
$module = (!empty($conf->global->CONTRACT_ADDON) ? $conf->global->CONTRACT_ADDON : 'mod_contract_serpis');
|
||||
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php')
|
||||
{
|
||||
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') {
|
||||
$module = substr($module, 0, dol_strlen($module) - 4);
|
||||
}
|
||||
$result = dol_include_once('/core/modules/contract/'.$module.'.php');
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modCodeContract = new $module();
|
||||
}
|
||||
|
||||
|
|
@ -126,10 +133,14 @@ if ($id > 0)
|
|||
$object->fetch_thirdparty();
|
||||
|
||||
$title = $langs->trans("Agenda");
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) $title = $object->ref." - ".$title;
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) {
|
||||
$title = $object->ref." - ".$title;
|
||||
}
|
||||
llxHeader('', $title);
|
||||
|
||||
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
$langs->load("mails");
|
||||
}
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
print dol_get_fiche_head($head, 'agenda', $langs->trans("Contract"), -1, 'contract');
|
||||
|
|
@ -156,14 +167,14 @@ if ($id > 0)
|
|||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
||||
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
}
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
|
|
@ -231,21 +242,22 @@ if ($id > 0)
|
|||
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($conf->agenda->enabled))
|
||||
{
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
print '<br>';
|
||||
|
||||
$param = '&id='.$id;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
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("ActionsOnContract"), $newcardbutton, '');
|
||||
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -113,28 +113,37 @@ class Contracts extends DolibarrApi
|
|||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) {
|
||||
$search_sale = DolibarrApiAccess::$user->id;
|
||||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as t";
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
}
|
||||
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('contrat').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
}
|
||||
if ($socids) {
|
||||
$sql .= " AND t.fk_soc IN (".$socids.")";
|
||||
}
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
}
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
|
|
@ -143,8 +152,7 @@ class Contracts extends DolibarrApi
|
|||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
|
@ -155,13 +163,11 @@ class Contracts extends DolibarrApi
|
|||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i = 0;
|
||||
while ($i < $min)
|
||||
{
|
||||
while ($i < $min) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$contrat_static = new Contrat($this->db);
|
||||
if ($contrat_static->fetch($obj->rowid)) {
|
||||
|
|
@ -196,12 +202,12 @@ class Contracts extends DolibarrApi
|
|||
$this->contract->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
}
|
||||
$this->contract->lines = $lines;
|
||||
}*/
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
}
|
||||
$this->contract->lines = $lines;
|
||||
}*/
|
||||
if ($this->contract->create(DolibarrApiAccess::$user) < 0) {
|
||||
throw new RestException(500, "Error creating contract", array_merge(array($this->contract->error), $this->contract->errors));
|
||||
}
|
||||
|
|
@ -491,7 +497,9 @@ class Contracts extends DolibarrApi
|
|||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
$this->contract->$field = $value;
|
||||
}
|
||||
|
||||
|
|
@ -667,8 +675,9 @@ class Contracts extends DolibarrApi
|
|||
{
|
||||
$contrat = array();
|
||||
foreach (Contracts::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
if (!isset($data[$field])) {
|
||||
throw new RestException(400, "$field field missing");
|
||||
}
|
||||
$contrat[$field] = $data[$field];
|
||||
}
|
||||
return $contrat;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -43,7 +43,9 @@ $id = GETPOST('id', 'int');
|
|||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$object = new Contrat($db);
|
||||
|
|
@ -56,19 +58,16 @@ $hookmanager->initHooks(array('contractcard', 'globalcard'));
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
if ($result > 0 && $id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
} else {
|
||||
|
|
@ -84,10 +83,8 @@ if ($action == 'addcontact' && $user->rights->contrat->creer)
|
|||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
if ($action == 'swapstatut' && $user->rights->contrat->creer) {
|
||||
if ($object->fetch($id)) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
|
|
@ -95,13 +92,11 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
|||
}
|
||||
|
||||
// Delete contact
|
||||
if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($action == 'deletecontact' && $user->rights->contrat->creer) {
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -125,10 +120,8 @@ $userstatic = new User($db);
|
|||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
if ($object->fetch($id, $ref) > 0)
|
||||
{
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
if ($object->fetch($id, $ref) > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = contract_prepare_head($object);
|
||||
|
|
@ -146,9 +139,9 @@ if ($id > 0 || !empty($ref))
|
|||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref .= $object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
// Ref customer
|
||||
|
|
@ -213,8 +206,11 @@ if ($id > 0 || !empty($ref))
|
|||
}
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($absolute_discount) {
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
} else {
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
}
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ $id = GETPOST('id', 'int');
|
|||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
unset($_GET["action"]);
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
|
|
@ -59,18 +58,23 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "name";
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "name";
|
||||
}
|
||||
|
||||
|
||||
$object = new Contrat($db);
|
||||
$object->fetch($id, $ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
|
|
@ -97,8 +101,7 @@ $form = new Form($db);
|
|||
llxHeader('', $langs->trans("Contract"), "");
|
||||
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
if ($object->id) {
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
print dol_get_fiche_head($head, 'documents', $langs->trans("Contract"), -1, 'contract');
|
||||
|
|
@ -107,8 +110,7 @@ if ($object->id)
|
|||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file)
|
||||
{
|
||||
foreach ($filearray as $key => $file) {
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
|
|
@ -136,17 +138,18 @@ if ($object->id)
|
|||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
||||
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
}
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ $statut = GETPOST('statut') ?GETPOST('statut') : 1;
|
|||
// Security check
|
||||
$socid = 0;
|
||||
$id = GETPOST('id', 'int');
|
||||
if (!empty($user->socid)) $socid = $user->socid;
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$staticcompany = new Societe($db);
|
||||
|
|
@ -78,11 +80,9 @@ print load_fiche_titre($langs->trans("ContractsArea"), '', 'contract');
|
|||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
|
||||
{
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
|
||||
// Search contract
|
||||
if (!empty($conf->contrat->enabled))
|
||||
{
|
||||
if (!empty($conf->contrat->enabled)) {
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
|
|
@ -112,26 +112,28 @@ $vals = array();
|
|||
$sql = "SELECT count(cd.rowid) as nb, cd.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now)."')))";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) {
|
||||
$sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
$sql .= " GROUP BY cd.statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
if ($obj) {
|
||||
$nb[$obj->status] = $obj->nb;
|
||||
if ($obj->status != 5)
|
||||
{
|
||||
if ($obj->status != 5) {
|
||||
$vals[$obj->status] = $obj->nb;
|
||||
$totalinprocess += $obj->nb;
|
||||
}
|
||||
|
|
@ -147,28 +149,30 @@ if ($resql)
|
|||
$sql = "SELECT count(cd.rowid) as nb, cd.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now)."')";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) {
|
||||
$sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
$sql .= " GROUP BY cd.statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// 0 inactive, 4 active, 5 closed
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
if ($obj) {
|
||||
$nb[$obj->status.true] = $obj->nb;
|
||||
if ($obj->status != 5)
|
||||
{
|
||||
if ($obj->status != 5) {
|
||||
$vals[$obj->status.true] = $obj->nb;
|
||||
$totalinprocess += $obj->nb;
|
||||
}
|
||||
|
|
@ -189,26 +193,34 @@ print '<div class="div-table-responsive-no-min">';
|
|||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Services").'</th></tr>'."\n";
|
||||
$listofstatus = array(0, 4, 4, 5); $bool = false;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
foreach ($listofstatus as $status) {
|
||||
$dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool]) ? (int) $nb[$status.$bool] : 0));
|
||||
if ($status == ContratLigne::STATUS_INITIAL) $colorseries[$status.$bool] = '-'.$badgeStatus0;
|
||||
if ($status == ContratLigne::STATUS_OPEN && !$bool) $colorseries[$status.$bool] = $badgeStatus4;
|
||||
if ($status == ContratLigne::STATUS_OPEN && $bool) $colorseries[$status.$bool] = $badgeStatus1;
|
||||
if ($status == ContratLigne::STATUS_CLOSED) $colorseries[$status.$bool] = $badgeStatus6;
|
||||
if ($status == ContratLigne::STATUS_INITIAL) {
|
||||
$colorseries[$status.$bool] = '-'.$badgeStatus0;
|
||||
}
|
||||
if ($status == ContratLigne::STATUS_OPEN && !$bool) {
|
||||
$colorseries[$status.$bool] = $badgeStatus4;
|
||||
}
|
||||
if ($status == ContratLigne::STATUS_OPEN && $bool) {
|
||||
$colorseries[$status.$bool] = $badgeStatus1;
|
||||
}
|
||||
if ($status == ContratLigne::STATUS_CLOSED) {
|
||||
$colorseries[$status.$bool] = $badgeStatus6;
|
||||
}
|
||||
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
|
||||
print '<td class="right"><a href="services_list.php?mode='.$status.($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($status == 4 && !$bool) $bool = true;
|
||||
else $bool = false;
|
||||
if ($status == 4 && !$bool) {
|
||||
$bool = true;
|
||||
} else {
|
||||
$bool = false;
|
||||
}
|
||||
}
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<tr class="impair"><td class="center" colspan="2">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
|
|
@ -225,15 +237,16 @@ if (!empty($conf->use_javascript_ajax))
|
|||
print '</td></tr>';
|
||||
}
|
||||
$listofstatus = array(0, 4, 4, 5); $bool = false;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
foreach ($listofstatus as $status) {
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
|
||||
print '<td class="right"><a href="services_list.php?mode='.$status.($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
|
||||
if ($status == 4 && !$bool) $bool = true;
|
||||
else $bool = false;
|
||||
if ($status == 4 && !$bool) {
|
||||
$bool = true;
|
||||
} else {
|
||||
$bool = false;
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -245,36 +258,38 @@ print "</table></div><br>";
|
|||
|
||||
// Draft contracts
|
||||
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
|
||||
$sql = "SELECT c.rowid, c.ref,";
|
||||
$sql .= " s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = c.fk_soc";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql .= " AND c.statut = 0";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".$socid;
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftContracts").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
if ($num)
|
||||
{
|
||||
if ($num) {
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
//$tot_ttc = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticcontrat->ref = $obj->ref;
|
||||
|
|
@ -319,22 +334,27 @@ $sql .= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AN
|
|||
$sql .= ' sum('.$db->ifsql("cd.statut=5", 1, 0).') as nb_closed,';
|
||||
$sql .= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql .= " AND c.statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid";
|
||||
$sql .= " ORDER BY c.tms DESC";
|
||||
$sql .= " LIMIT ".$max;
|
||||
|
||||
dol_syslog("contrat/index.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
|
@ -347,8 +367,7 @@ if ($result)
|
|||
print '<th class="center" width="80" colspan="4">'.$langs->trans("Services").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -356,7 +375,9 @@ if ($result)
|
|||
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
|
||||
$staticcontrat->id = $obj->cid;
|
||||
print $staticcontrat->getNomUrl(1, 16);
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
if ($obj->nb_late) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id = $obj->socid;
|
||||
|
|
@ -388,19 +409,24 @@ $sql .= " s.nom as name,";
|
|||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql .= ") LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql .= " AND cd.fk_contrat = c.rowid";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY cd.tms DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
|
@ -410,8 +436,7 @@ if ($resql)
|
|||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("LastModifiedServices", $max).'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num, $max))
|
||||
{
|
||||
while ($i < min($num, $max)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -422,8 +447,7 @@ if ($resql)
|
|||
//if (1 == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
|
|
@ -431,8 +455,11 @@ if ($resql)
|
|||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note, 20);
|
||||
if ($obj->label) {
|
||||
print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
} else {
|
||||
print '</a> '.dol_trunc($obj->note, 20);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
|
@ -462,7 +489,9 @@ $sql .= " s.nom as name,";
|
|||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql .= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
|
|
@ -470,13 +499,16 @@ $sql .= " AND c.statut = 1";
|
|||
$sql .= " AND cd.statut = 0";
|
||||
$sql .= " AND cd.fk_contrat = c.rowid";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY cd.tms DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
|
@ -486,8 +518,7 @@ if ($resql)
|
|||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -498,8 +529,7 @@ if ($resql)
|
|||
print $staticcontrat->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
|
|
@ -507,8 +537,11 @@ if ($resql)
|
|||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note, 20);
|
||||
if ($obj->label) {
|
||||
print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
} else {
|
||||
print '</a> '.dol_trunc($obj->note, 20);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
|
@ -537,7 +570,9 @@ $sql .= " s.nom as name,";
|
|||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql .= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
|
|
@ -546,13 +581,16 @@ $sql .= " AND cd.statut = 4";
|
|||
$sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
$sql .= " AND cd.fk_contrat = c.rowid";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY cd.tms DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
|
@ -562,8 +600,7 @@ if ($resql)
|
|||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -574,8 +611,7 @@ if ($resql)
|
|||
print $staticcontrat->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
|
|
@ -583,8 +619,11 @@ if ($resql)
|
|||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note, 20);
|
||||
if ($obj->label) {
|
||||
print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
} else {
|
||||
print '</a> '.dol_trunc($obj->note, 20);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
|
|
|||
|
|
@ -76,16 +76,24 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = 'c.ref';
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'c.ref';
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC';
|
||||
}
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id', 'int');
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$diroutputmassaction = $conf->contrat->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
|
|
@ -93,7 +101,9 @@ $diroutputmassaction = $conf->contrat->dir_output.'/temp/massgeneration/'.$user-
|
|||
$staticcontrat = new Contrat($db);
|
||||
$staticcontratligne = new ContratLigne($db);
|
||||
|
||||
if ($search_status == '') $search_status = 1;
|
||||
if ($search_status == '') {
|
||||
$search_status = 1;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Contrat($db);
|
||||
|
|
@ -112,7 +122,9 @@ $fieldstosearchall = array(
|
|||
's.nom'=>"ThirdParty",
|
||||
'c.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"] = "NotePrivate";
|
||||
if (empty($user->socid)) {
|
||||
$fieldstosearchall["c.note_private"] = "NotePrivate";
|
||||
}
|
||||
|
||||
$arrayfields = array(
|
||||
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>10),
|
||||
|
|
@ -142,18 +154,23 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
|||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$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');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||
$day = '';
|
||||
$month = '';
|
||||
$year = '';
|
||||
|
|
@ -180,8 +197,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
$objectclass = 'Contrat';
|
||||
$objectlabel = 'Contracts';
|
||||
$permissiontoread = $user->rights->contrat->lire;
|
||||
|
|
@ -216,7 +232,9 @@ $sql .= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AN
|
|||
$sql .= ' SUM('.$db->ifsql("cd.statut=5", 1, 0).') as nb_closed';
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
|
|
@ -226,34 +244,60 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
if ($search_user > 0)
|
||||
{
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= ' AND c.entity IN ('.getEntity('contract').')';
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
||||
if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$db->escape($socid);
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$db->escape($socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
$sql .= dolSqlDateFilter('c.date_contrat', $day, $month, $year);
|
||||
if ($search_name) $sql .= natural_search('s.nom', $search_name);
|
||||
if ($search_email) $sql .= natural_search('s.email', $search_email);
|
||||
if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
|
||||
if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
if ($search_name) {
|
||||
$sql .= natural_search('s.nom', $search_name);
|
||||
}
|
||||
if ($search_email) {
|
||||
$sql .= natural_search('s.email', $search_email);
|
||||
}
|
||||
if ($search_contract) {
|
||||
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
}
|
||||
if (!empty($search_ref_customer)) {
|
||||
$sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
|
||||
}
|
||||
if (!empty($search_ref_supplier)) {
|
||||
$sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
}
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
|
|
@ -266,34 +310,36 @@ $sql .= " typent.code,";
|
|||
$sql .= " state.code_departement, state.nom";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
if ($search_dfyear > 0 && $search_op2df)
|
||||
{
|
||||
if ($search_op2df == '<=') $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
elseif ($search_op2df == '>=') $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
else $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
if ($search_dfyear > 0 && $search_op2df) {
|
||||
if ($search_op2df == '<=') {
|
||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
} elseif ($search_op2df == '>=') {
|
||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
} else {
|
||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
}
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
|
|
@ -302,8 +348,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -311,8 +356,7 @@ if (!$resql)
|
|||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall && !$page)
|
||||
{
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id);
|
||||
|
|
@ -329,31 +373,66 @@ $i = 0;
|
|||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
if ($socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_name)) $search_name = $soc->name;
|
||||
if (empty($search_name)) {
|
||||
$search_name = $soc->name;
|
||||
}
|
||||
}
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($sall != '') $param .= '&sall='.urlencode($sall);
|
||||
if ($search_contract != '') $param .= '&search_contract='.urlencode($search_contract);
|
||||
if ($search_name != '') $param .= '&search_name='.urlencode($search_name);
|
||||
if ($search_email != '') $param .= '&search_email='.urlencode($search_email);
|
||||
if ($search_ref_customer != '') $param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_ref_supplier != '') $param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
if ($search_op2df != '') $param .= '&search_op2df='.urlencode($search_op2df);
|
||||
if ($search_dfyear != '') $param .= '&search_dfyear='.urlencode($search_dfyear);
|
||||
if ($search_dfmonth != '') $param .= '&search_dfmonth='.urlencode($search_dfmonth);
|
||||
if ($search_sale != '') $param .= '&search_sale='.urlencode($search_sale);
|
||||
if ($search_user != '') $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
|
||||
if ($show_files) $param .= '&show_files='.urlencode($show_files);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($sall != '') {
|
||||
$param .= '&sall='.urlencode($sall);
|
||||
}
|
||||
if ($search_contract != '') {
|
||||
$param .= '&search_contract='.urlencode($search_contract);
|
||||
}
|
||||
if ($search_name != '') {
|
||||
$param .= '&search_name='.urlencode($search_name);
|
||||
}
|
||||
if ($search_email != '') {
|
||||
$param .= '&search_email='.urlencode($search_email);
|
||||
}
|
||||
if ($search_ref_customer != '') {
|
||||
$param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||
}
|
||||
if ($search_ref_supplier != '') {
|
||||
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
}
|
||||
if ($search_op2df != '') {
|
||||
$param .= '&search_op2df='.urlencode($search_op2df);
|
||||
}
|
||||
if ($search_dfyear != '') {
|
||||
$param .= '&search_dfyear='.urlencode($search_dfyear);
|
||||
}
|
||||
if ($search_dfmonth != '') {
|
||||
$param .= '&search_dfmonth='.urlencode($search_dfmonth);
|
||||
}
|
||||
if ($search_sale != '') {
|
||||
$param .= '&search_sale='.urlencode($search_sale);
|
||||
}
|
||||
if ($search_user != '') {
|
||||
$param .= '&search_user='.urlencode($search_user);
|
||||
}
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
}
|
||||
if ($search_product_category != '') {
|
||||
$param .= '&search_product_category='.urlencode($search_product_category);
|
||||
}
|
||||
if ($show_files) {
|
||||
$param .= '&show_files='.urlencode($show_files);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
|
|
@ -363,16 +442,24 @@ $arrayofmassactions = array(
|
|||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
if ($user->rights->contrat->supprimer) {
|
||||
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$url = DOL_URL_ROOT.'/contrat/card.php?action=create';
|
||||
if (!empty($socid)) $url .= '&socid='.$socid;
|
||||
if (!empty($socid)) {
|
||||
$url .= '&socid='.$socid;
|
||||
}
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
|
@ -388,17 +475,17 @@ $objecttmp = new Contrat($db);
|
|||
$trackid = 'con'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
if ($sall) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
|
||||
|
|
@ -406,16 +493,14 @@ if ($user->rights->societe->client->voir || $socid)
|
|||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view other users
|
||||
if ($user->rights->user->user->lire)
|
||||
{
|
||||
if ($user->rights->user->user->lire) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
|
||||
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$moreforfilter .= '</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view categories of products
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
{
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
|
|
@ -426,11 +511,13 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($use
|
|||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
|
|
@ -438,77 +525,75 @@ if (!empty($moreforfilter))
|
|||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
if ($massactionbutton) {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.email']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.email']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||
}
|
||||
// Zip
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
}
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Company type
|
||||
if (!empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['typent.code']['checked'])) {
|
||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) {
|
||||
// Date contract
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
//print $langs->trans('Month').': ';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.$day.'">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.$day.'">';
|
||||
}
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.$month.'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$syear = $year;
|
||||
|
|
@ -523,20 +608,17 @@ $parameters = array('arrayfields'=>$arrayfields);
|
|||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// First end date
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
|
||||
print '<td class="liste_titre nowraponall center">';
|
||||
$arrayofoperators = array('0'=>'', '='=>'=', '<='=>'<=', '>='=>'>=');
|
||||
print $form->selectarray('search_op2df', $arrayofoperators, $search_op2df, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth50imp');
|
||||
|
|
@ -547,8 +629,7 @@ if (!empty($arrayfields['lower_planned_end_date']['checked']))
|
|||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td class="liste_titre right" colspan="4"></td>';
|
||||
}
|
||||
print '<td class="liste_titre center">';
|
||||
|
|
@ -558,18 +639,42 @@ print '</td>';
|
|||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.email']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['typent.code']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
|
|
@ -598,8 +703,7 @@ $totalarray = array();
|
|||
$typenArray = array();
|
||||
$cacheCountryIDCode = array();
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$contracttmp->ref = $obj->ref;
|
||||
|
|
@ -632,11 +736,12 @@ while ($i < min($num, $limit))
|
|||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
print $contracttmp->getNomUrl(1);
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
if ($obj->nb_late) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
if (!empty($obj->note_private) || !empty($obj->note_public)) {
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'&save_lastsearch_values=1">'.img_picto($langs->trans("ViewPrivateNote"), 'note').'</a>';
|
||||
|
|
@ -652,16 +757,13 @@ while ($i < min($num, $limit))
|
|||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) {
|
||||
print '<td>'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).'</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
|
||||
print '<td>'.$obj->ref_supplier.'</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">';
|
||||
if ($obj->socid > 0) {
|
||||
// TODO Use a cache for this string
|
||||
|
|
@ -669,57 +771,63 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.email']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.email']['checked'])) {
|
||||
print '<td>'.$obj->email.'</td>';
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Zip
|
||||
if (!empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print $socstatic->country;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Type ent
|
||||
if (!empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['typent.code']['checked'])) {
|
||||
print '<td class="center">';
|
||||
if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
|
||||
if (count($typenArray) == 0) {
|
||||
$typenArray = $formcompany->typent_array(1);
|
||||
}
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
// Sales representatives
|
||||
print '<td>';
|
||||
if ($obj->socid > 0)
|
||||
{
|
||||
if ($obj->socid > 0) {
|
||||
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
|
||||
if ($listsalesrepresentatives < 0) dol_print_error($db);
|
||||
if ($listsalesrepresentatives < 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 6) {
|
||||
// We print only number
|
||||
|
|
@ -756,8 +864,7 @@ while ($i < min($num, $limit))
|
|||
print '</td>';
|
||||
}
|
||||
// Date
|
||||
if (!empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').'</td>';
|
||||
}
|
||||
// Extra fields
|
||||
|
|
@ -767,32 +874,34 @@ while ($i < min($num, $limit))
|
|||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date lower end date
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
|
||||
print '<td class="center nowrapforall">';
|
||||
print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td class="center">'.($obj->nb_initial > 0 ? $obj->nb_initial : '').'</td>';
|
||||
print '<td class="center">'.($obj->nb_running > 0 ? $obj->nb_running : '').'</td>';
|
||||
print '<td class="center">'.($obj->nb_expired > 0 ? $obj->nb_expired : '').'</td>';
|
||||
|
|
@ -800,14 +909,17 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
|
@ -824,7 +936,9 @@ print '</div>';
|
|||
print '</form>';
|
||||
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
|
||||
$hidegeneratedfilelistifempty = 0;
|
||||
}
|
||||
|
||||
// Show list of available documents
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ $id = GETPOST('id', 'int');
|
|||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$object = new Contrat($db);
|
||||
|
|
@ -70,8 +72,7 @@ llxHeader('', $langs->trans("Contract"), "");
|
|||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = contract_prepare_head($object);
|
||||
|
|
@ -89,9 +90,9 @@ if ($id > 0 || !empty($ref))
|
|||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref .= $object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
// Ref customer
|
||||
|
|
@ -104,15 +105,14 @@ if ($id > 0 || !empty($ref))
|
|||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&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.'">';
|
||||
|
|
@ -150,12 +150,18 @@ if ($id > 0 || !empty($ref))
|
|||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $object->thirdparty->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
if ($object->thirdparty->remise_percent) {
|
||||
print $langs->trans("CompanyHasRelativeDiscount", $object->thirdparty->remise_percent);
|
||||
} else {
|
||||
print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
}
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($absolute_discount) {
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
} else {
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
}
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -39,12 +39,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = "c.rowid";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "c.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
$mode = GETPOST("mode");
|
||||
$filter = GETPOST("filter");
|
||||
|
|
@ -90,22 +96,32 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||
|
||||
// Security check
|
||||
$contratid = GETPOST('id', 'int');
|
||||
if (!empty($user->socid)) $socid = $user->socid;
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $contratid);
|
||||
|
||||
if ($search_status != '')
|
||||
{
|
||||
if ($search_status != '') {
|
||||
$tmp = explode('&', $search_status);
|
||||
$mode = $tmp[0];
|
||||
if (empty($tmp[1])) $filter = '';
|
||||
else {
|
||||
if ($tmp[1] == 'filter=notexpired') $filter = 'notexpired';
|
||||
if ($tmp[1] == 'filter=expired') $filter = 'expired';
|
||||
if (empty($tmp[1])) {
|
||||
$filter = '';
|
||||
} else {
|
||||
if ($tmp[1] == 'filter=notexpired') {
|
||||
$filter = 'notexpired';
|
||||
}
|
||||
if ($tmp[1] == 'filter=expired') {
|
||||
$filter = 'expired';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$search_status = $mode;
|
||||
if ($filter == 'expired') $search_status .= '&filter=expired';
|
||||
if ($filter == 'notexpired') $search_status .= '&filter=notexpired';
|
||||
if ($filter == 'expired') {
|
||||
$search_status .= '&filter=expired';
|
||||
}
|
||||
if ($filter == 'notexpired') {
|
||||
$search_status .= '&filter=notexpired';
|
||||
}
|
||||
}
|
||||
|
||||
$staticcontrat = new Contrat($db);
|
||||
|
|
@ -142,21 +158,25 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; }
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$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');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_product_category = 0;
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||
$search_product_category = 0;
|
||||
$search_name = "";
|
||||
$search_contract = "";
|
||||
$search_service = "";
|
||||
|
|
@ -197,7 +217,9 @@ $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref
|
|||
$sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
|
||||
$sql .= " cd.rowid, cd.description, cd.statut,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " sc.fk_soc, sc.fk_user,";
|
||||
}
|
||||
$sql .= " cd.date_ouverture_prevue,";
|
||||
$sql .= " cd.date_ouverture,";
|
||||
$sql .= " cd.date_fin_validite,";
|
||||
|
|
@ -211,7 +233,9 @@ $sql .= " cd.subprice,";
|
|||
$sql .= " cd.tms as date_update";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
|
|
@ -219,50 +243,102 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
|||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
}
|
||||
$sql .= " WHERE c.entity = ".$conf->entity;
|
||||
$sql .= " AND c.rowid = cd.fk_contrat";
|
||||
if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
}
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($mode == "0") $sql .= " AND cd.statut = 0";
|
||||
if ($mode == "4") $sql .= " AND cd.statut = 4";
|
||||
if ($mode == "5") $sql .= " AND cd.statut = 5";
|
||||
if ($filter == "expired") $sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
if ($filter == "notexpired") $sql .= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
|
||||
if ($search_name) $sql .= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
|
||||
if ($search_contract) $sql .= " AND c.ref LIKE '%".$db->escape($search_contract)."%' ";
|
||||
if ($search_service) $sql .= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
|
||||
if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($mode == "0") {
|
||||
$sql .= " AND cd.statut = 0";
|
||||
}
|
||||
if ($mode == "4") {
|
||||
$sql .= " AND cd.statut = 4";
|
||||
}
|
||||
if ($mode == "5") {
|
||||
$sql .= " AND cd.statut = 5";
|
||||
}
|
||||
if ($filter == "expired") {
|
||||
$sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
}
|
||||
if ($filter == "notexpired") {
|
||||
$sql .= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
|
||||
}
|
||||
if ($search_name) {
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
|
||||
}
|
||||
if ($search_contract) {
|
||||
$sql .= " AND c.ref LIKE '%".$db->escape($search_contract)."%' ";
|
||||
}
|
||||
if ($search_service) {
|
||||
$sql .= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
|
||||
$filter_dateouvertureprevue_start = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
|
||||
$filter_dateouvertureprevue_end = dol_mktime(23, 59, 59, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
|
||||
if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) $filter_opouvertureprevue = ' BETWEEN ';
|
||||
if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) {
|
||||
$filter_opouvertureprevue = ' BETWEEN ';
|
||||
}
|
||||
|
||||
$filter_date1_start = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
|
||||
$filter_date1_end = dol_mktime(23, 59, 59, $op1month, $op1day, $op1year);
|
||||
if ($filter_date1_start != '' && $filter_op1 == -1) $filter_op1 = ' BETWEEN ';
|
||||
if ($filter_date1_start != '' && $filter_op1 == -1) {
|
||||
$filter_op1 = ' BETWEEN ';
|
||||
}
|
||||
|
||||
$filter_date2_start = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
|
||||
$filter_date2_end = dol_mktime(23, 59, 59, $op2month, $op2day, $op2year);
|
||||
if ($filter_date2_start != '' && $filter_op2 == -1) $filter_op2 = ' BETWEEN ';
|
||||
if ($filter_date2_start != '' && $filter_op2 == -1) {
|
||||
$filter_op2 = ' BETWEEN ';
|
||||
}
|
||||
|
||||
$filter_datecloture_start = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
|
||||
$filter_datecloture_end = dol_mktime(23, 59, 59, $opcloturemonth, $opclotureday, $opclotureyear);
|
||||
if ($filter_datecloture_start != '' && $filter_opcloture == -1) $filter_opcloture = ' BETWEEN ';
|
||||
if ($filter_datecloture_start != '' && $filter_opcloture == -1) {
|
||||
$filter_opcloture = ' BETWEEN ';
|
||||
}
|
||||
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_opouvertureprevue != ' BETWEEN ' && $filter_dateouvertureprevue_start != '') $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_dateouvertureprevue_end)."'";
|
||||
if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
|
||||
if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_date1_end)."'";
|
||||
if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
|
||||
if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_date2_end)."'";
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
|
||||
if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_datecloture_end)."'";
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_opouvertureprevue != ' BETWEEN ' && $filter_dateouvertureprevue_start != '') {
|
||||
$sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
|
||||
}
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_dateouvertureprevue_end)."'";
|
||||
}
|
||||
if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') {
|
||||
$sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
|
||||
}
|
||||
if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_date1_end)."'";
|
||||
}
|
||||
if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') {
|
||||
$sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
|
||||
}
|
||||
if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_date2_end)."'";
|
||||
}
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') {
|
||||
$sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
|
||||
}
|
||||
if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_datecloture_end)."'";
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
|
@ -270,12 +346,10 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
//print $sql;
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
|
|
@ -286,8 +360,7 @@ $sql .= $db->plimit($limit + 1, $offset);
|
|||
//print $sql;
|
||||
dol_syslog("contrat/services_list.php", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -297,31 +370,63 @@ $num = $db->num_rows($resql);
|
|||
/*
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->id;
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
|
||||
exit;
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->id;
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
|
||||
exit;
|
||||
}*/
|
||||
|
||||
llxHeader(null, $langs->trans("Services"));
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($search_contract) $param .= '&search_contract='.urlencode($search_contract);
|
||||
if ($search_name) $param .= '&search_name='.urlencode($search_name);
|
||||
if ($search_service) $param .= '&search_service='.urlencode($search_service);
|
||||
if ($mode) $param .= '&mode='.urlencode($mode);
|
||||
if ($filter) $param .= '&filter='.urlencode($filter);
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param .= '&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
|
||||
if (!empty($filter_op1) && $filter_op1 != -1) $param .= '&filter_op1='.urlencode($filter_op1);
|
||||
if (!empty($filter_op2) && $filter_op2 != -1) $param .= '&filter_op2='.urlencode($filter_op2);
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != -1) $param .= '&filter_opcloture='.urlencode($filter_opcloture);
|
||||
if ($filter_dateouvertureprevue != '') $param .= '&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear;
|
||||
if ($filter_date1 != '') $param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||
if ($filter_date2 != '') $param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||
if ($filter_datecloture != '') $param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.$limit;
|
||||
}
|
||||
if ($search_contract) {
|
||||
$param .= '&search_contract='.urlencode($search_contract);
|
||||
}
|
||||
if ($search_name) {
|
||||
$param .= '&search_name='.urlencode($search_name);
|
||||
}
|
||||
if ($search_service) {
|
||||
$param .= '&search_service='.urlencode($search_service);
|
||||
}
|
||||
if ($mode) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if ($filter) {
|
||||
$param .= '&filter='.urlencode($filter);
|
||||
}
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) {
|
||||
$param .= '&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
|
||||
}
|
||||
if (!empty($filter_op1) && $filter_op1 != -1) {
|
||||
$param .= '&filter_op1='.urlencode($filter_op1);
|
||||
}
|
||||
if (!empty($filter_op2) && $filter_op2 != -1) {
|
||||
$param .= '&filter_op2='.urlencode($filter_op2);
|
||||
}
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != -1) {
|
||||
$param .= '&filter_opcloture='.urlencode($filter_opcloture);
|
||||
}
|
||||
if ($filter_dateouvertureprevue != '') {
|
||||
$param .= '&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear;
|
||||
}
|
||||
if ($filter_date1 != '') {
|
||||
$param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||
}
|
||||
if ($filter_date2 != '') {
|
||||
$param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||
}
|
||||
if ($filter_datecloture != '') {
|
||||
$param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.$optioncss;
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
|
|
@ -335,7 +440,9 @@ $arrayofmassactions = array(
|
|||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
|
@ -345,24 +452,32 @@ print '<input type="hidden" name="page" value="'.$page.'">';
|
|||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$title = $langs->trans("ListOfServices");
|
||||
if ($mode == "0") $title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
|
||||
if ($mode == "4" && $filter != "expired") $title = $langs->trans("ListOfRunningServices");
|
||||
if ($mode == "4" && $filter == "expired") $title = $langs->trans("ListOfExpiredServices");
|
||||
if ($mode == "5") $title = $langs->trans("ListOfClosedServices");
|
||||
if ($mode == "0") {
|
||||
$title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
|
||||
}
|
||||
if ($mode == "4" && $filter != "expired") {
|
||||
$title = $langs->trans("ListOfRunningServices");
|
||||
}
|
||||
if ($mode == "4" && $filter == "expired") {
|
||||
$title = $langs->trans("ListOfExpiredServices");
|
||||
}
|
||||
if ($mode == "5") {
|
||||
$title = $langs->trans("ListOfClosedServices");
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
if ($sall) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$morefilter = '';
|
||||
|
||||
// If the user can view categories of products
|
||||
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
{
|
||||
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
|
|
@ -373,12 +488,14 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
|
|||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
|
|
@ -392,33 +509,62 @@ print '<div class="div-table-responsive">';
|
|||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.description']['checked'])) print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['p.description']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
|
@ -426,49 +572,41 @@ if (!empty($arrayfields['c.ref']['checked']))
|
|||
print '</td>';
|
||||
}
|
||||
// Service label
|
||||
if (!empty($arrayfields['p.description']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['p.description']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// detail lines
|
||||
if (!empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Third party
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_opouvertureprevue', $arrayofoperators, $filter_opouvertureprevue, 1);
|
||||
|
|
@ -477,8 +615,7 @@ if (!empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
|||
print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_op1', $arrayofoperators, $filter_op1, 1);
|
||||
|
|
@ -487,8 +624,7 @@ if (!empty($arrayfields['cd.date_ouverture']['checked']))
|
|||
print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1);
|
||||
|
|
@ -497,8 +633,7 @@ if (!empty($arrayfields['cd.date_fin_validite']['checked']))
|
|||
print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_opcloture', $arrayofoperators, $filter_opcloture, 1);
|
||||
|
|
@ -514,20 +649,17 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
|||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (!empty($arrayfields['cd.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) {
|
||||
// Date creation
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) {
|
||||
// Date modification
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
// Status
|
||||
print '<td class="liste_titre right">';
|
||||
$arrayofstatus = array(
|
||||
|
|
@ -552,8 +684,7 @@ $productstatic = new Product($db);
|
|||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$contractstatic->id = $obj->cid;
|
||||
|
|
@ -570,118 +701,142 @@ while ($i < min($num, $limit))
|
|||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
print $contractstatic->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Service
|
||||
if (!empty($arrayfields['p.description']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['p.description']['checked'])) {
|
||||
print '<td>';
|
||||
if ($obj->pid > 0)
|
||||
{
|
||||
if ($obj->pid > 0) {
|
||||
$productstatic->id = $obj->pid;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
$productstatic->entity = $obj->pentity;
|
||||
print $productstatic->getNomUrl(1, '', 24);
|
||||
print $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
|
||||
if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);
|
||||
if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
|
||||
print '<br>'.dol_nl2br($obj->description);
|
||||
}
|
||||
} else {
|
||||
if ($obj->type == 0) print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
|
||||
if ($obj->type == 1) print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
|
||||
if ($obj->type == 0) {
|
||||
print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
|
||||
}
|
||||
if ($obj->type == 1) {
|
||||
print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) {
|
||||
print '<td>';
|
||||
print $obj->qty;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price($obj->total_ht);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
|
||||
}
|
||||
$totalarray['val']['cd.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price($obj->total_tva);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
|
||||
}
|
||||
$totalarray['val']['cd.total_tva'] += $obj->total_tva;
|
||||
}
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price2num($obj->tva_tx).'%';
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price($obj->subprice);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1, 'customer', 28);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Start date
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : ' ');
|
||||
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0)
|
||||
print ' '.img_picto($langs->trans("Late"), "warning");
|
||||
else print ' ';
|
||||
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
|
||||
print ' '.img_picto($langs->trans("Late"), "warning");
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
|
||||
print '<td class="center">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : ' ').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// End date
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
|
||||
print '<td class="center">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : ' ');
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
|
||||
{
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24;
|
||||
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
|
||||
print img_warning($textlate);
|
||||
} else print ' ';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Close date (real end date)
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
|
|
@ -691,45 +846,50 @@ while ($i < min($num, $limit))
|
|||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['cd.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['cd.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td class="right">';
|
||||
if ($obj->cstatut == 0)
|
||||
{
|
||||
if ($obj->cstatut == 0) {
|
||||
// If contract is draft, we say line is also draft
|
||||
print $contractstatic->LibStatut(0, 5);
|
||||
} else {
|
||||
print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
|
@ -37,24 +36,24 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
|||
$langs->load("contracts");
|
||||
|
||||
$total = 0; $ilink = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
$ilink++;
|
||||
|
||||
$trclass = 'oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
||||
$trclass .= ' liste_sub_total';
|
||||
}
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Contract"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td><?php echo $langs->trans("Contract"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
||||
<td class="right"><?php
|
||||
<td class="right"><?php
|
||||
// Price of contract is not shown by default because a contract is a list of service with
|
||||
// start and end date that change with time andd that may be different that the period of reference for price.
|
||||
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
||||
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
|
||||
{
|
||||
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE)) {
|
||||
$totalcontrat = 0;
|
||||
foreach ($objectlink->lines as $linecontrat) {
|
||||
$totalcontrat = $totalcontrat + $linecontrat->total_ht;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user