* Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file fichinter/card-rec.php * \ingroup intervention * \brief Page to show predefined fichinter */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinterrec.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (!empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } if (!empty($conf->contrat->enabled)) { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcontract.class.php'; } // Load translation files required by the page $langs->loadLangs(array("interventions", "admin", "compta", "bills")); // Security check $id = (GETPOST('fichinterid', 'int') ?GETPOST('fichinterid', 'int') : GETPOST('id', 'int')); $action = GETPOST('action', 'alpha'); if ($user->socid) $socid = $user->socid; $objecttype = 'fichinter_rec'; if ($action == "create" || $action == "add") $objecttype = ''; $result = restrictedArea($user, 'ficheinter', $id, $objecttype); if ($page == -1) $page = 0; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $offset = $limit * $page; if ($sortorder == "") $sortorder = "DESC"; if ($sortfield == "") $sortfield = "f.datec"; $object = new FichinterRec($db); $extrafields = new ExtraFields($db); $arrayfields = array( 'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1), 'f.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), 'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1), 'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1), 'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1), 'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1), 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), ); /* * Actions */ // Create predefined intervention if ($action == 'add') { if (!GETPOST('titre')) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); $action = "create"; $error++; } if (!GETPOST('socid')) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Customer")), null, 'errors'); $action = "create"; $error++; } // gestion des fréquences et des échéances $frequency = GETPOST('frequency', 'int'); $reyear = GETPOST('reyear'); $remonth = GETPOST('remonth'); $reday = GETPOST('reday'); $rehour = GETPOST('rehour'); $remin = GETPOST('remin'); $nb_gen_max = (GETPOST('nb_gen_max', 'int') ?GETPOST('nb_gen_max', 'int') : 0); if (GETPOST('frequency')) { if (empty($reyear) || empty($remonth) || empty($reday)) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); $action = "create"; $error++; } if ($nb_gen_max === '') { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("MaxPeriodNumber")), null, 'errors'); $action = "create"; $error++; } } if (!$error) { $object->id_origin = $id; $object->title = GETPOST('titre', 'alpha'); $object->description = GETPOST('description', 'alpha'); $object->socid = GETPOST('socid', 'alpha'); $object->fk_project = GETPOST('projectid', 'int'); $object->fk_contract = GETPOST('contractid', 'int'); $object->frequency = $frequency; $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); $object->nb_gen_max = $nb_gen_max; $object->auto_validate = GETPOST('auto_validate', 'int'); $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); $object->date_when = $date_next_execution; if ($object->create($user) > 0) { $id = $object->id; $action = ''; } else { setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; } } } elseif ($action == 'createfrommodel') { $newinter = new Fichinter($db); // on récupère les enregistrements $object->fetch($id); // on transfert les données de l'un vers l'autre if ($object->socid > 0) { $newinter->socid = $object->socid; $newinter->fk_project = $object->fk_project; $newinter->fk_contrat = $object->fk_contrat; } else { $newinter->socid = GETPOST("socid"); } $newinter->entity = $object->entity; $newinter->duree = $object->duree; $newinter->description = $object->description; $newinter->note_private = $object->note_private; $newinter->note_public = $object->note_public; // on créer un nouvelle intervention $extrafields->fetch_name_optionals_label($newinter->table_element); $array_options = $extrafields->getOptionalsFromPost($newinter->table_element); $newinter->array_options = $array_options; $newfichinterid = $newinter->create($user); if ($newfichinterid > 0) { // Now we add line of details foreach ($object->lines as $line) { $newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, ''); } // on update le nombre d'inter crée à partir du modèle $object->updateNbGenDone(); //on redirige vers la fiche d'intervention nouvellement crée header('Location: '.DOL_URL_ROOT.'/fichinter/card.php?id='.$newfichinterid); exit; } else { setEventMessages($newinter->error, $newinter->errors, 'errors'); $action = ''; } } elseif ($action == 'delete' && $user->rights->ficheinter->supprimer) { // delete modele $object->fetch($id); $object->delete(); $id = 0; header('Location: '.$_SERVER["PHP_SELF"]); exit; } elseif ($action == 'setfrequency' && $user->rights->ficheinter->creer) { // Set frequency and unit frequency $object->fetch($id); $object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha')); } elseif ($action == 'setdate_when' && $user->rights->ficheinter->creer) { // Set next date of execution $object->fetch($id); $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); if (!empty($date)) $object->setNextDate($date); } elseif ($action == 'setnb_gen_max' && $user->rights->ficheinter->creer) { // Set max period $object->fetch($id); $object->setMaxPeriod(GETPOST('nb_gen_max', 'int')); } /* * View */ llxHeader('', $langs->trans("RepeatableIntervention"), 'ch-fichinter.html#s-fac-fichinter-rec'); $form = new Form($db); $companystatic = new Societe($db); if (!empty($conf->contrat->enabled)) { $contratstatic = new Contrat($db); } if (!empty($conf->projet->enabled)) { $projectstatic = new Project($db); } $now = dol_now(); $tmparray = dol_getdate($now); $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day /* * Create mode */ if ($action == 'create') { print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'intervention'); $object = new Fichinter($db); // Source invoice //$object = new Managementfichinter($db); // Source invoice if ($object->fetch($id, $ref) > 0) { print '
'; print ''; print ''; print ''; dol_fiche_head(); $rowspan = 4; if (!empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++; if (!empty($conf->contrat->enabled) && $object->fk_contrat > 0) $rowspan++; print ''; $object->fetch_thirdparty(); // Third party print ''; // Title print ''; // Note print ''; // Author print ""; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { // Duration print ''; print ''; print ''; } // Project if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); print ""; } // Contrat if (!empty($conf->contrat->enabled)) { $formcontract = new FormContract($db); print ""; } print "
'.$langs->trans("Customer").''; print $form->select_company($object->thirdparty->id, 'socid', '', 0, 1); //.$object->thirdparty->getNomUrl(1,'customer'). print ''; print $langs->trans("Comment"); print '
'.$langs->trans("Title").''; print ''; print ''; print ''; print '
".$langs->trans("Author")."".$user->getFullName($langs)."
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
".$langs->trans("Project").""; $projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project; $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''); print '   '; print $langs->trans("AddProject").''; print "
".$langs->trans("Contract").""; $contractid = GETPOST('contractid') ?GETPOST('contractid') : $object->fk_contract; $numcontract = $formcontract->select_contract($object->thirdparty->id, $contractid, 'contracttid'); print "
"; print '

'; /// frequency & duration // Autogeneration $title = $langs->trans("Recurrence"); print load_fiche_titre($title, '', 'calendar'); print ''; // Frequency print '"; // First date of execution for cron print ""; // Number max of generation print ""; print "
'; print $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')); print ""; print ' '; print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm')); print "
".$langs->trans('NextDateToExecution').""; if ($date_next_execution != "") { $date_next_execution = (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); } print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1); print "
".$langs->trans("MaxPeriodNumber").""; print ''; print "
"; print '
'; $title = $langs->trans("ProductsAndServices"); if (empty($conf->service->enabled)) { $title = $langs->trans("Products"); } elseif (empty($conf->product->enabled)) { $title = $langs->trans("Services"); } print load_fiche_titre($title, '', ''); /* * Fichinter lines */ print ''; print ''; print "
'; $sql = 'SELECT l.rowid, l.description, l.duree'; $sql .= " FROM ".MAIN_DB_PREFIX."fichinterdet as l"; $sql .= " WHERE l.fk_fichinter= ".$object->id; //$sql.= " AND l.fk_product is null "; $sql .= " ORDER BY l.rang"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; $total = 0; echo ''; if ($num) { print ''; print ''; print ''; print "\n"; } while ($i < $num) { $objp = $db->fetch_object($result); print ''; // Show product and description print ''; print ""; $i++; } $db->free($result); } else { print $db->error(); } print "
'.$langs->trans("Description").''.$langs->trans("Duration").'
'; print ''; // ancre pour retourner sur la ligne $text = img_object($langs->trans('Service'), 'service'); print $text.' '.nl2br($objp->description); // Duration print ''.convertSecondToTime($objp->duree).'
"; print '
\n"; dol_fiche_end(); print '
'; print '     '; print ''; print '
'; print "
\n"; } else { dol_print_error('', "Error, no fichinter ".$object->id); } } elseif ($action == 'selsocforcreatefrommodel') { print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'intervention'); dol_fiche_head(''); print '
'; print ''; print ''; print '
'.$langs->trans("ThirdParty").''; print $form->select_company('', 'socid', '', 1, 1); print '
'; dol_fiche_end(); print '
'; print ''; print ''; print ''; print '
'; print '
'; } else { /* * View mode * */ if ($id > 0) { if ($object->fetch($id) > 0) { $object->fetch_thirdparty(); $author = new User($db); $author->fetch($object->user_author); $head = fichinter_rec_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("PredefinedInterventional"), 0, 'intervention'); // Intervention card $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; // Thirdparty $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->ficheinter->creer) { if ($action != 'classify') { $morehtmlref .= ''; $morehtmlref .= img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } if ($action == 'classify') { $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref .= ''; $morehtmlref .= '
'; } else { $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); $morehtmlref .= 'trans('ShowProject').'">'; $morehtmlref .= $proj->ref; $morehtmlref .= ''; } else { $morehtmlref .= ''; } } } $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; print '
'; print ''; print ""; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { // Duration print ''; print ''; } print '"; // Contract if (!empty($conf->contrat->enabled)) { $langs->load('contracts'); print ''; print ''; print ''; } print "
".$langs->trans("Author").''.$author->getFullName($langs)."
'.$langs->trans("TotalDuration").''; print convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); print '
'.$langs->trans("Description").''.nl2br($object->description)."
'; print ''; if ($action != 'contrat') { print ''; } print '
'; print $langs->trans('Contract'); print 'id.'">'; print img_edit($langs->trans('SetContract'), 1); print '
'; print '
'; if ($action == 'contrat') { $formcontract = new Formcontract($db); $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); } else { if ($object->fk_contrat) { $contratstatic = new Contrat($db); $contratstatic->fetch($object->fk_contrat); print $contratstatic->getNomUrl(0, '', 1); } else { print " "; } } print '
"; print '
'; print '
'; print '
'; print '
'; print ''; $title = $langs->trans("Recurrence"); print load_fiche_titre($title, '', 'calendar'); print '
'; // if "frequency" is empty or = 0, the reccurence is disabled print ''; // Date when print ''; print ''; // Max period / Rest period print ''; print ''; print '
'; print ''; if ($action != 'editfrequency' && $user->rights->ficheinter->creer) { print ''; } print '
'; print $langs->trans('Frequency'); print ''; print img_edit($langs->trans('Edit'), 1).'
'; print '
'; if ($action == 'editfrequency') { print '
'; print ''; print ''; print ''; print ''; print ''; print '
'; print ' '; print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); print '
'; } else { if ($object->frequency > 0) print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); else print $langs->trans("NotARecurringInterventionalTemplate"); } print '
'; if ($user->rights->ficheinter->creer && ($action == 'date_when' || $object->frequency > 0)) { print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); } else { print $langs->trans("NextDateToExecution"); } print ''; if ($action == 'date_when' || $object->frequency > 0) { print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); } print '
'; if ($user->rights->ficheinter->creer && ($action == 'nb_gen_max' || $object->frequency > 0)) { print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer); } else print $langs->trans("MaxPeriodNumber"); print ''; if ($action == 'nb_gen_max' || $object->frequency > 0) { print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max : '', $object, $user->rights->facture->creer); } else print ''; print '
'; // Frequencry/Recurring section if ($object->frequency > 0) { print '
'; if (empty($conf->cron->enabled)) { $txtinfoadmin = $langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name")); print info_admin($txtinfoadmin); } print '
'; print ''; // Nb of generation already done print ''; print ''; print ''; // Date last print ''; print ''; print '
'.$langs->trans("NbOfGenerationDone").''; print $object->nb_gen_done ? $object->nb_gen_done : '0'; print '
'; print $langs->trans("DateLastGeneration"); print ''; print dol_print_date($object->date_last_gen, 'dayhour'); print '
'; print '
'; } print '
'; print '
'; print '
'; print '

'; /* * Lines */ $title = $langs->trans("ProductsAndServices"); if (empty($conf->service->enabled)) { $title = $langs->trans("Products"); } elseif (empty($conf->product->enabled)) { $title = $langs->trans("Services"); } print load_fiche_titre($title); print ''; print ''; print ''; print ''; print ''; $num = count($object->lines); $i = 0; while ($i < $num) { // Show product and description if (isset($object->lines[$i]->product_type)) $type = $object->lines[$i]->product_type; else $object->lines[$i]->fk_product_type; // Try to enhance type detection using date_start and date_end for free lines when type // was not saved. if (!empty($objp->date_start)) $type = 1; if (!empty($objp->date_end)) $type = 1; // Show line print ''; print ''; print ''; print "\n"; $i++; } print '
'.$langs->trans("Description").''.$langs->trans("Duration").'
'; $text = img_object($langs->trans('Service'), 'service'); print $text.' '.nl2br($object->lines[$i]->desc); print ''.convertSecondToTime($object->lines[$i]->duree).'
'; /** * Barre d'actions */ print '
'; if ($user->rights->ficheinter->creer) { print ''; } if ($user->rights->ficheinter->supprimer) { print ''; } print '
'; } else print $langs->trans("ErrorRecordNotFound"); } else { /* * List mode */ $sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title,"; $sql .= " f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,"; $sql .= " f.date_last_gen, f.date_when, f.datec"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter_rec as f"; $sql .= " , ".MAIN_DB_PREFIX."societe as s "; if (!$user->rights->societe->client->voir && !$socid) { $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.entity = ".$conf->entity; 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 ($search_ref) $sql .= natural_search('f.titre', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_frequency == '1') $sql .= ' AND f.frequency > 0'; if ($search_frequency == '0') $sql .= ' AND (f.frequency IS NULL or f.frequency = 0)'; //$sql .= " ORDER BY $sortfield $sortorder, rowid DESC "; // $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); print_barre_liste($langs->trans("RepeatableIntervention"), $page, $_SERVER['PHP_SELF'], "&socid=$socid", $sortfield, $sortorder, '', $num, '', 'intervention'); print ''.$langs->trans("ToCreateAPredefinedIntervention").'

'; $i = 0; print ''; print ''; print_liste_field_titre("Ref", $_SERVER['PHP_SELF'], "f.titre", "", "", 'width="200px"', $sortfield, $sortorder, 'left '); print_liste_field_titre("Company", $_SERVER['PHP_SELF'], "s.nom", "", "", 'width="200px"', $sortfield, $sortorder, 'left '); if (!empty($conf->contrat->enabled)) { print_liste_field_titre("Contract", $_SERVER['PHP_SELF'], "f.fk_contrat", "", "", 'width="100px"', $sortfield, $sortorder, 'left '); } if (!empty($conf->projet->enabled)) { print_liste_field_titre("Project", $_SERVER['PHP_SELF'], "f.fk_project", "", "", 'width="100px"', $sortfield, $sortorder, 'left '); } print_liste_field_titre("Duration", $_SERVER['PHP_SELF'], 'f.duree', '', '', 'width="50px"', $sortfield, $sortorder, 'right '); // Recurring or not print_liste_field_titre("Frequency", $_SERVER['PHP_SELF'], "f.frequency", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); print_liste_field_titre("NbOfGenerationDone", $_SERVER['PHP_SELF'], "f.nb_gen_done", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); print_liste_field_titre("DateLastGeneration", $_SERVER['PHP_SELF'], "f.date_last_gen", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); print_liste_field_titre("NextDateToIntervention", $_SERVER['PHP_SELF'], "f.date_when", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); print ''; print "\n"; // les filtres à faire ensuite if ($num > 0) { while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); print ''; print '\n"; if ($objp->socid) { $companystatic->id = $objp->socid; $companystatic->name = $objp->name; print ''; } else { print ''; } if (!empty($conf->contrat->enabled)) { print ''; } if (!empty($conf->projet->enabled)) { print ''; } print ''; print ''; print ''; print ''; print ''; } else { print ''.$langs->trans('NA').''; print ''; print ''; print ''; } if ($user->rights->ficheinter->creer) { // Action column print '"; print "\n"; $i++; } } } else { print ''; } print "
'; print img_object($langs->trans("ShowIntervention"), "intervention").' '.$objp->title; print "'.$companystatic->getNomUrl(1, 'customer').''.$langs->trans("None").''; if ($objp->fk_contrat > 0) { $contratstatic->fetch($objp->fk_contrat); print $contratstatic->getNomUrl(1); } print ''; if ($objp->fk_project > 0) { $projectstatic->fetch($objp->fk_project); print $projectstatic->getNomUrl(1); } print ''.convertSecondToTime($objp->duree).''.yn($objp->frequency ? 1 : 0).''; if ($objp->frequency) { print $objp->nb_gen_done.($objp->nb_gen_max > 0 ? ' / '.$objp->nb_gen_max : ''); print ''; print dol_print_date($db->jdate($objp->date_last_gen), 'day'); print ''; print dol_print_date($db->jdate($objp->date_when), 'day'); print ''; print ''.$langs->trans('NA').''; print ''; print ''.$langs->trans('NA').''; print ''; if ($user->rights->ficheinter->creer) { if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { print ''; print $langs->trans("CreateFichInter").''; } else print $langs->trans("DateIsNotEnough"); } else print " "; print "
'.$langs->trans("NoneF").'
"; $db->free($resql); } else { dol_print_error($db); } } } llxFooter(); $db->close();