--- /tmp/dsg/dolibarr/htdocs/fichinter/github_card-rec.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_card-rec.php @@ -51,7 +51,7 @@ // Security check $id = (GETPOST('fichinterid', 'int') ?GETPOST('fichinterid', 'int') : GETPOST('id', 'int')); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); if ($user->socid) $socid = $user->socid; $objecttype = 'fichinter_rec'; if ($action == "create" || $action == "add") $objecttype = ''; @@ -131,7 +131,7 @@ if (!$error) { $object->id_origin = $id; $object->title = GETPOST('titre', 'alpha'); - $object->description = GETPOST('description', 'restricthtml'); + $object->description = GETPOST('description', 'alpha'); $object->socid = GETPOST('socid', 'alpha'); $object->fk_project = GETPOST('projectid', 'int'); $object->fk_contract = GETPOST('contractid', 'int'); @@ -256,7 +256,7 @@ print ''; print ''; - print dol_get_fiche_head(); + dol_fiche_head(); $rowspan = 4; if (!empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++; @@ -277,7 +277,7 @@ // Title print ''.$langs->trans("Title").''; - print ''; + print ''; print ''; // Note @@ -417,19 +417,20 @@ print "\n"; - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; print '     '; - print ''; + print ''; print '
'; print "\n"; - } else { + } + else { dol_print_error('', "Error, no fichinter ".$object->id); } } elseif ($action == 'selsocforcreatefrommodel') { print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'intervention'); - print dol_get_fiche_head(''); + dol_fiche_head(''); print '
'; print ''; @@ -438,7 +439,7 @@ print ''; print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; print ''; @@ -461,7 +462,7 @@ $head = fichinter_rec_prepare_head($object); - print dol_get_fiche_head($head, 'card', $langs->trans("PredefinedInterventional"), 0, 'intervention'); + dol_fiche_head($head, 'card', $langs->trans("PredefinedInterventional"), 0, 'intervention'); // Intervention card $linkback = ''.$langs->trans("BackToList").''; @@ -484,11 +485,11 @@ $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $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); + $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)) { @@ -543,15 +544,15 @@ print ''; if ($action == 'contrat') { $formcontract = new Formcontract($db); - $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); + $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 ''; @@ -595,7 +596,8 @@ } else { if ($object->frequency > 0) print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); - else print $langs->trans("NotARecurringInterventionalTemplate"); + else + print $langs->trans("NotARecurringInterventionalTemplate"); } print ''; @@ -617,12 +619,15 @@ 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"); + } 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 ''; + } + else + print ''; print ''; print ''; @@ -633,7 +638,7 @@ if ($object->frequency > 0) { print '
'; if (empty($conf->cron->enabled)) { - $txtinfoadmin = $langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name")); + $txtinfoadmin = $langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name")); print info_admin($txtinfoadmin); } print '
'; @@ -688,7 +693,8 @@ // Show product and description if (isset($object->lines[$i]->product_type)) $type = $object->lines[$i]->product_type; - else $object->lines[$i]->fk_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; @@ -714,18 +720,19 @@ if ($user->rights->ficheinter->creer) { print ''; } if ($user->rights->ficheinter->supprimer) { print ''; } print '
'; - } else print $langs->trans("ErrorRecordNotFound"); + } else + print $langs->trans("ErrorRecordNotFound"); } else { /* * List mode @@ -765,20 +772,20 @@ $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_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"; @@ -853,8 +860,10 @@ print ''; print $langs->trans("CreateFichInter").''; - } else print $langs->trans("DateIsNotEnough"); - } else print " "; + } else + print $langs->trans("DateIsNotEnough"); + } else + print " "; print ""; --- /tmp/dsg/dolibarr/htdocs/fichinter/github_card.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_card.php @@ -2,13 +2,12 @@ /* Copyright (C) 2002-2007 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2018 Regis Houssin - * Copyright (C) 2011-2020 Juanjo Menent + * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2014-2018 Charlene Benke * Copyright (C) 2015-2016 Abbes Bahfir * Copyright (C) 2018 Philippe Grand - * Copyright (C) 2020 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 @@ -58,15 +57,15 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$socid = (int) GETPOST('socid', 'int'); -$contratid = (int) GETPOST('contratid', 'int'); +$socid = GETPOST('socid', 'int'); +$contratid = GETPOST('contratid', 'int'); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $mesg = GETPOST('msg', 'alpha'); $origin = GETPOST('origin', 'alpha'); $originid = (GETPOST('originid', 'int') ?GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility -$note_public = GETPOST('note_public', 'restricthtml'); +$note_public = GETPOST('note_public', 'none'); $lineid = GETPOST('line_id', 'int'); //PDF @@ -130,7 +129,9 @@ if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } else { + } + else + { if ($object->id > 0) { // Because createFromClone modifies the object, we must clone it so that we can restore it later @@ -141,7 +142,9 @@ { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit; - } else { + } + else + { setEventMessages($object->error, $object->errors, 'errors'); $object = $orig; $action = ''; @@ -168,15 +171,20 @@ $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs); + $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->modelpdf : GETPOST('model', 'alpha'), $outputlangs); } header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } else { - $mesg = $object->error; - } - } elseif ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer) { + } + else + { + $mesg = '
'.$object->error.'
'; + } + } + + elseif ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer) + { $result = $object->setDraft($user); if ($result >= 0) { @@ -187,29 +195,35 @@ $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (!empty($newlang)) { + if (!empty($newlang)) + { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs); + $result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->modelpdf : GETPOST('model', 'alpha'), $outputlangs); } header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } else { - $mesg = $object->error; - } - } elseif ($action == 'add' && $user->rights->ficheinter->creer) { - $object->socid = $socid; - $object->duration = (int) GETPOST('duration', 'int'); - $object->fk_project = (int) GETPOST('projectid', 'int'); - $object->fk_contrat = (int) GETPOST('contratid', 'int'); - $object->author = $user->id; - $object->description = GETPOST('description', 'restricthtml'); - $object->ref = $ref; - $object->model_pdf = GETPOST('model', 'alpha'); - $object->note_private = GETPOST('note_private', 'restricthtml'); - $object->note_public = GETPOST('note_public', 'restricthtml'); + } + else + { + $mesg = '
'.$object->error.'
'; + } + } + + elseif ($action == 'add' && $user->rights->ficheinter->creer) + { + $object->socid = $socid; + $object->duration = GETPOST('duration', 'int'); + $object->fk_project = GETPOST('projectid', 'int'); + $object->fk_contrat = GETPOST('contratid', 'int'); + $object->author = $user->id; + $object->description = GETPOST('description', 'none'); + $object->ref = $ref; + $object->modelpdf = GETPOST('model', 'alpha'); + $object->note_private = GETPOST('note_private', 'none'); + $object->note_public = GETPOST('note_public', 'none'); if ($object->socid > 0) { @@ -217,9 +231,8 @@ if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) - $regs = array(); - $element = $subelement = GETPOST('origin', 'alphanohtml'); - if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin', 'alphanohtml'), $regs)) + $element = $subelement = $_POST['origin']; + if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) { $element = $regs[1]; $subelement = $regs[2]; @@ -247,16 +260,10 @@ } // Extrafields - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); - if ($ret < 0) { - $error++; - $action = 'create'; - } + $extrafields = new ExtraFields($db); $array_options = $extrafields->getOptionalsFromPost($object->table_element); - $object->array_options = $array_options; + $object->array_options = $array_options; $id = $object->create($user); @@ -361,12 +368,12 @@ $result = $object->addline( $user, - $id, - $desc, - $date_intervention, - $duration, - $array_options - ); + $id, + $desc, + $date_intervention, + $duration, + $array_options + ); if ($result < 0) { @@ -376,50 +383,63 @@ } } } - } else { - $mesg = $srcobject->error; - $error++; - } - } else { - $mesg = $object->error; - $error++; - } - } else { - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); - if ($ret < 0) { - $error++; - $action = 'create'; - } - - if (!$error) - { - // Extrafields - $array_options = $extrafields->getOptionalsFromPost($object->table_element); - - $object->array_options = $array_options; - - $result = $object->create($user); - if ($result > 0) - { - $id = $result; // Force raffraichissement sur fiche venant d'etre cree - } else { - $langs->load("errors"); - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'create'; - } - } - } - } else { - $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")); - $action = 'create'; - } - } elseif ($action == 'update' && $user->rights->ficheinter->creer) { + } + else + { + $mesg = $srcobject->error; + $error++; + } + } + else + { + $mesg = $object->error; + $error++; + } + } + else + { + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost(null, $object); + if ($ret < 0) { + $error++; + $action = 'create'; + } + + if (!$error) + { + // Extrafields + $array_options = $extrafields->getOptionalsFromPost($object->table_element); + + $object->array_options = $array_options; + + $result = $object->create($user); + if ($result > 0) + { + $id = $result; // Force raffraichissement sur fiche venant d'etre cree + } + else + { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create'; + } + } + } + } + else + { + $mesg = '
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")).'
'; + $action = 'create'; + } + } + + elseif ($action == 'update' && $user->rights->ficheinter->creer) + { $object->socid = $socid; - $object->fk_project = (int) GETPOST('projectid', 'int'); - $object->fk_contrat = (int) GETPOST('contratid', 'int'); + $object->fk_project = GETPOST('projectid', 'int'); + $object->fk_contrat = GETPOST('contratid', 'int'); $object->author = $user->id; - $object->description = GETPOST('description', 'restricthtml'); + $object->description = GETPOST('description', 'alpha'); $object->ref = $ref; $result = $object->update($user); @@ -440,7 +460,9 @@ { $result = $object->set_contrat($user, GETPOST('contratid', 'int')); if ($result < 0) dol_print_error($db, $object->error); - } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->ficheinter->supprimer) + } + + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->ficheinter->supprimer) { $result = $object->delete($user); if ($result < 0) { @@ -449,7 +471,9 @@ header('Location: '.DOL_URL_ROOT.'/fichinter/list.php?leftmenu=ficheinter&restore_lastsearch_values=1'); exit; - } elseif ($action == 'setdescription' && $user->rights->ficheinter->creer) + } + + elseif ($action == 'setdescription' && $user->rights->ficheinter->creer) { $result = $object->set_description($user, GETPOST('description')); if ($result < 0) dol_print_error($db, $object->error); @@ -458,41 +482,42 @@ // Add line elseif ($action == "addline" && $user->rights->ficheinter->creer) { - if (!GETPOST('np_desc', 'restricthtml') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) + if (!GETPOST('np_desc', 'none') && empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) { - $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")); + $mesg = '
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")).'
'; $error++; } if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && !GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int')) { - $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Duration")); + $mesg = '
'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Duration")).'
'; $error++; } if (empty($conf->global->FICHINTER_WITHOUT_DURATION) && GETPOST('durationhour', 'int') >= 24 && GETPOST('durationmin', 'int') > 0) { - $mesg = $langs->trans("ErrorValueTooHigh"); + $mesg = '
'.$langs->trans("ErrorValueTooHigh").'
'; $error++; } if (!$error) { $db->begin(); - $desc = GETPOST('np_desc', 'restricthtml'); + $desc = GETPOST('np_desc', 'none'); $date_intervention = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int')); - $duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ? convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0; + $duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ?convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0; + // Extrafields $extrafields->fetch_name_optionals_label($object->table_element_line); $array_options = $extrafields->getOptionalsFromPost($object->table_element_line); - $result = $object->addline( + $result = $object->addline( $user, - $id, - $desc, - $date_intervention, - $duration, - $array_options - ); + $id, + $desc, + $date_intervention, + $duration, + $array_options + ); // Define output language $outputlangs = $langs; @@ -509,10 +534,12 @@ { $db->commit(); - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->model_pdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } else { + } + else + { $mesg = $object->error; $db->rollback(); } @@ -523,10 +550,13 @@ elseif ($action == 'classifybilled' && $user->rights->ficheinter->creer) { $result = $object->setStatut(2); - if ($result > 0) { + if ($result > 0) + { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } else { + } + else + { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -539,36 +569,26 @@ { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } else { - $mesg = $object->error; + } + else + { + $mesg = '
'.$object->error.'
'; } } // Classify Done elseif ($action == 'classifydone' && $user->rights->ficheinter->creer) { - $result = $object->setStatut(3); - if ($result > 0) - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - // Reopen - elseif ($action == 'confirm_reopen' && $user->rights->ficheinter->creer) - { - $result = $object->setStatut(Fichinter::STATUS_VALIDATED); - if ($result > 0) - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - else { - $mesg = $object->error; - } + $result = $object->setStatut(3); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } } /* @@ -576,24 +596,26 @@ */ elseif ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST('save', 'alpha') == $langs->trans("Save")) { $objectline = new FichinterLigne($db); - if ($objectline->fetch($lineid) <= 0) { + if ($objectline->fetch($lineid) <= 0) + { dol_print_error($db); exit; } - if ($object->fetch($objectline->fk_fichinter) <= 0) { + if ($object->fetch($objectline->fk_fichinter) <= 0) + { dol_print_error($db); exit; } $object->fetch_thirdparty(); - $desc = GETPOST('np_desc', 'restricthtml'); + $desc = GETPOST('np_desc'); $date_inter = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int')); $duration = convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')); - $objectline->datei = $date_inter; - $objectline->desc = $desc; - $objectline->duration = $duration; + $objectline->datei = $date_inter; + $objectline->desc = $desc; + $objectline->duration = $duration; // Extrafields $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -601,44 +623,11 @@ $objectline->array_options = $array_options; $result = $objectline->update($user); - if ($result < 0) { - dol_print_error($db); - exit; - } - - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (!empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->model_pdf, $outputlangs); - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; - } - - /* - * Supprime une ligne d'intervention AVEC confirmation - */ - elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->ficheinter->creer) - { - $objectline = new FichinterLigne($db); - if ($objectline->fetch($lineid) <= 0) - { - dol_print_error($db); - exit; - } - $result = $objectline->deleteline($user); - - if ($object->fetch($objectline->fk_fichinter) <= 0) - { - dol_print_error($db); - exit; - } + if ($result < 0) + { + dol_print_error($db); + exit; + } // Define output language $outputlangs = $langs; @@ -650,15 +639,30 @@ $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->model_pdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; } /* - * Set position of lines - */ - elseif ($action == 'up' && $user->rights->ficheinter->creer) - { - $object->line_up($lineid); + * Supprime une ligne d'intervention AVEC confirmation + */ + elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->ficheinter->creer) + { + $objectline = new FichinterLigne($db); + if ($objectline->fetch($lineid) <= 0) + { + dol_print_error($db); + exit; + } + $result = $objectline->deleteline($user); + + if ($object->fetch($objectline->fk_fichinter) <= 0) + { + dol_print_error($db); + exit; + } // Define output language $outputlangs = $langs; @@ -670,13 +674,15 @@ $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->model_pdf, $outputlangs); - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$lineid); - exit; - } elseif ($action == 'down' && $user->rights->ficheinter->creer) - { - $object->line_down($lineid); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); + } + + /* + * Set position of lines + */ + elseif ($action == 'up' && $user->rights->ficheinter->creer) + { + $object->line_up($lineid); // Define output language $outputlangs = $langs; @@ -688,7 +694,27 @@ $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->model_pdf, $outputlangs); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$lineid); + exit; + } + + elseif ($action == 'down' && $user->rights->ficheinter->creer) + { + $object->line_down($lineid); + + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) fichinter_create($db, $object, $object->modelpdf, $outputlangs); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$lineid); exit; @@ -713,7 +739,7 @@ $object->oldcopy = dol_clone($object); // Fill array 'array_options' with data from update form - $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (!$error) @@ -736,21 +762,24 @@ if ($result > 0 && $id > 0) { $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); - $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); - $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); + $result = $object->add_contact($contactid, GETPOST('type', 'int'), GETPOST('source', 'alpha')); } if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } else { + } + else + { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); - } else { - $mesg = $object->error; + $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + } + else + { + $mesg = '
'.$object->error.'
'; } } } @@ -770,7 +799,8 @@ { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } else { + } + else { dol_print_error($db); } } @@ -797,11 +827,7 @@ print load_fiche_titre($langs->trans("AddIntervention"), '', 'intervention'); - if ($error > 0) { - dol_htmloutput_errors($mesg); - } else { - dol_htmloutput_mesg($mesg); - } + dol_htmloutput_mesg($mesg); if ($socid) $res = $soc->fetch($socid); @@ -816,11 +842,13 @@ $subelement = $regs[2]; } - if ($element == 'project') - { - $projectid = GETPOST('originid', 'int'); - } else { - // For compatibility + if ($element == 'project') + { + $projectid = GETPOST('originid', 'int'); + } + else + { + // For compatibility if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; } @@ -847,13 +875,14 @@ $soc = $objectsrc->thirdparty; - $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private', 'restricthtml'))); - $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public', 'restricthtml')); + $note_private = (!empty($objectsrc->note) ? $objectsrc->note : (!empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private', 'none'))); + $note_public = (!empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public', 'none')); // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } - } else { + } + else { $projectid = GETPOST('projectid', 'int'); } @@ -881,7 +910,7 @@ print ''; print ''; - print dol_get_fiche_head(''); + dol_fiche_head(''); print '
'; @@ -903,27 +932,27 @@ $langs->load("project"); - print ''; - } + $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid'); + if ($numprojet == 0) + { + print '   '; + } + print ''; + } // Contract if ($conf->contrat->enabled) { $langs->load("contracts"); print ''; } - // Model - print ''; - print ''; - print '"; - - // Public note - print ''; - print ''; - print ''; - - // Private note - if (empty($user->socid)) - { - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) + // Model + print ''; + print ''; + print '"; + + // Public note + print ''; + print ''; + print ''; + + // Private note + if (empty($user->socid)) + { + print ''; + print ''; + print ''; + } + + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); } - // Show link to origin object - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) - { - $newclassname = $classname; - if ($newclassname == 'Propal') $newclassname = 'CommercialProposal'; - print ''; - - // Amount - /* Hide amount because we only copy services so amount may differ than source + // Show link to origin object + if (!empty($origin) && !empty($originid) && is_object($objectsrc)) + { + $newclassname = $classname; + if ($newclassname == 'Propal') $newclassname = 'CommercialProposal'; + print ''; + + // Amount + /* Hide amount because we only copy services so amount may differ than source print ''; print '"; if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE @@ -999,24 +1028,24 @@ print '"; } */ - } - - print '
'.$langs->trans("Project").''; - /* Fix: If a project must be linked to any companies (suppliers or not), project must be not be set as limited to customer but must be not linked to any particular thirdparty + print '
'.$langs->trans("Project").''; + /* Fix: If a project must be linked to any companies (suppliers or not), project must be not be set as limited to customer but must be not linked to any particular thirdparty if ($societe->fournisseur==1) $numprojet=select_projects(-1,$_POST["projectid"],'projectid'); else $numprojet=select_projects($societe->id,$_POST["projectid"],'projectid'); */ - $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid'); - if ($numprojet == 0) - { - print '   '; - } - print '
'.$langs->trans("Contract").''; - $numcontrat = $formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1, 1); + $numcontrat = $formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1); if ($numcontrat == 0) { print '   '; @@ -931,53 +960,53 @@ print '
'.$langs->trans("DefaultModel").''; - $liste = ModelePDFFicheinter::liste_modeles($db); - print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF); - print "
'.$langs->trans('NotePublic').''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); - print $doleditor->Create(1); - //print ''; - print '
'.$langs->trans('NotePrivate').''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); - print $doleditor->Create(1); - //print ''; - print '
'.$langs->trans("DefaultModel").''; + $liste = ModelePDFFicheinter::liste_modeles($db); + print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF); + print "
'.$langs->trans('NotePublic').''; + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + //print ''; + print '
'.$langs->trans('NotePrivate').''; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + //print ''; + print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
' . $langs->trans('AmountHT') . '' . price($objectsrc->total_ht) . '
' . $langs->trans('AmountVAT') . '' . price($objectsrc->total_tva) . "
' . $langs->trans('MulticurrencyAmountTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
'; - - if (is_object($objectsrc)) - { - print ''; - print ''; + } + + print ''; + + if (is_object($objectsrc)) + { + print ''; + print ''; } elseif ($origin == 'project' && !empty($projectid)) { print ''; } - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; print ''; - print '     '; - print ''; + print '     '; + print ''; print '
'; print ''; @@ -1032,11 +1061,13 @@ print ''; } - } else { + } + else + { print '
'; print ''; - print dol_get_fiche_head(''); + dol_fiche_head(''); if (is_object($objectsrc)) { @@ -1052,18 +1083,19 @@ print ''; print ''; - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; print ''; print ''; - print '     '; - print ''; + print '     '; + print ''; print '
'; print '
'; } -} elseif ($id > 0 || !empty($ref)) +} +elseif ($id > 0 || !empty($ref)) { /* * Affichage en mode visu @@ -1075,15 +1107,11 @@ $soc = new Societe($db); $soc->fetch($object->socid); - if ($error > 0) { - dol_htmloutput_errors($mesg); - } else { - dol_htmloutput_mesg($mesg); - } + dol_htmloutput_mesg($mesg); $head = fichinter_prepare_head($object); - print dol_get_fiche_head($head, 'card', $langs->trans("InterventionCard"), -1, 'intervention'); + dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), -1, 'intervention'); $formconfirm = ''; @@ -1106,7 +1134,9 @@ $error++; setEventMessages($object->error, $object->errors, 'errors'); } - } else { + } + else + { $numref = $object->ref; } $text = $langs->trans('ConfirmValidateIntervention', $numref); @@ -1118,12 +1148,6 @@ if ($action == 'modify') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify', '', 0, 1); - } - - // Confirm back to open - if ($action == 'reopen') - { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Reopen'), $langs->trans('ConfirmReopenIntervention', $object->ref), 'confirm_reopen', '', 0, 1); } // Confirm deletion of line @@ -1171,46 +1195,46 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->ficheinter->creer) - { - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; - } - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $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 .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project').' '; + if ($user->rights->ficheinter->creer) + { + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $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 .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - - print '
'; - print '
'; - print '
'; - - print ''; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) { @@ -1265,50 +1289,54 @@ if ($action == 'contrat') { $formcontract = new Formcontract($db); - $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1, 1); - } else { + $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 ''.$projet->title.''; - print $contratstatic->getNomUrl(0, '', 1); - } else { - print " "; - } + { + $contratstatic = new Contrat($db); + $contratstatic->fetch($object->fk_contrat); + //print ''.$projet->title.''; + print $contratstatic->getNomUrl(0, '', 1); + } + else + { + print " "; + } } print ''; print ''; } - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'; + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print ''; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + // Duration + print ''; + print ''; + print ''; + } + + print "
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
"; print '
'; - print '
'; - print '
'; - print '
'; - - print ''; - - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) - { - // Duration - print ''; - print ''; - print ''; - } - - print "
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
"; - - print '
'; - print '
'; - print '
'; - - print '

'; + print '
'; + print ''; + + print '

'; if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) @@ -1331,10 +1359,13 @@ print '
'; print ''; print ''; - if ($action == 'editline') { + if ($action == 'editline') + { print ''; print ''; - } else { + } + else + { print ''; } @@ -1343,9 +1374,8 @@ $sql .= ' ft.date as date_intervention'; $sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql .= ' WHERE ft.fk_fichinter = '.$object->id; - if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) { + if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) $sql .= ' AND ft.duree <> 0'; - } $sql .= ' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid'; $resql = $db->query($sql); @@ -1358,13 +1388,8 @@ { print '
'; print ''; + print ''; - - // No. - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - print ''; print ''; print ''; @@ -1372,18 +1397,15 @@ print ''; print "\n"; } - while ($i < $num) { + while ($i < $num) + { $objp = $db->fetch_object($resql); + // Ligne en mode visu - if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) { + if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) + { print ''; - - // No. - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - print '\n"; - // Icon to edit and delete + + // Econ to edit and delete if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; - } else { + } + else + { print ''; } @@ -1443,12 +1468,6 @@ if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id', 'int') == $objp->rowid) { print ''; - - // No. - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - print ''; - // Duration - print ''; - - print ''; + // Duration + print ''; + + print ''; print ''."\n"; $line = new FichinterLigne($db); @@ -1501,68 +1520,56 @@ { if (!$num) { - print '
'; - print '
'.$langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').' 
'.($i + 1).''; print ''; // ancre pour retourner sur la ligne print dol_htmlentitiesbr($objp->description); @@ -1396,7 +1418,8 @@ print "'; @@ -1423,7 +1446,9 @@ } } print ' 
'.($i + 1).''; print ''; // ancre pour retourner sur la ligne @@ -1460,26 +1479,26 @@ // Date d'intervention print ''; - if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) { - print $form->selectDate($db->jdate($objp->date_intervention), 'di', 0, 0, 0, "date_intervention"); - } else { - print $form->selectDate($db->jdate($objp->date_intervention), 'di', 1, 1, 0, "date_intervention"); - } + if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) { + print $form->selectDate($db->jdate($objp->date_intervention), 'di', 0, 0, 0, "date_intervention"); + } else { + print $form->selectDate($db->jdate($objp->date_intervention), 'di', 1, 1, 0, "date_intervention"); + } print ''; - if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { - $selectmode = 'select'; - if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) - $selectmode = 'text'; - $form->select_duration('duration', $objp->duree, 0, $selectmode); - } - print ''; - print ''; - print ''; + if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { + $selectmode = 'select'; + if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) + $selectmode = 'text'; + $form->select_duration('duration', $objp->duree, 0, $selectmode); + } + print ''; + print ''; + print '
'; - print ''; - - // No. - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - - print ''; - print ''; - print ''; - print ''; - print "\n"; + print '
'; - print ''; // ancre - print $langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').' 
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; } print ''."\n"; - - // No. - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; - } - - print ''; - - // Date intervention - print ''; + + // Date intervention + print ''; - // Duration - print ''; - - print ''; + // Duration + print ''; + + print ''; print ''; //Line extrafield @@ -1577,14 +1584,16 @@ } if ($num) print '
'; + print ''; // ancre + print $langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').' 
'.($i + 1).''; - // editeur wysiwyg - if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) { - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'restricthtml'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%'); - $doleditor->Create(); - } - print ''; + print ''; + // editeur wysiwyg + if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'alpha'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%'); + $doleditor->Create(); + } + print ''; $now = dol_now(); $timearray = dol_getdate($now); if (!GETPOST('diday', 'int')) { - $timewithnohour = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']); - } else { - $timewithnohour = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int')); - } - if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) { - print $form->selectDate($timewithnohour, 'di', 0, 0, 0, "addinter"); - } else { - print $form->selectDate($timewithnohour, 'di', 1, 1, 0, "addinter"); - } + $timewithnohour = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']); + } else { + $timewithnohour = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int')); + } + if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) { + print $form->selectDate($timewithnohour, 'di', 0, 0, 0, "addinter"); + } else { + print $form->selectDate($timewithnohour, 'di', 1, 1, 0, "addinter"); + } print ''; - if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { - $selectmode = 'select'; - if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) { - $selectmode = 'text'; - } - $form->select_duration('duration', (!GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int')) ? 3600 : (60 * 60 * GETPOST('durationhour', 'int') + 60 * GETPOST('durationmin', 'int')), 0, $selectmode); - } - print ''; + if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { + $selectmode = 'select'; + if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) { + $selectmode = 'text'; + } + $form->select_duration('duration', (!GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int')) ? 3600 : (60 * 60 * GETPOST('durationhour', 'int') + 60 * GETPOST('durationmin', 'int')), 0, $selectmode); + } + print '
'; - } else { + } + else + { dol_print_error($db); } print '
'."\n"; } - print dol_get_fiche_end(); + dol_fiche_end(); print "\n"; @@ -1597,36 +1606,27 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook + // modified by hook if (empty($reshook)) { if ($user->socid == 0) { - if ($action != 'editdescription' && ($action != 'presend')) { - // Validate - if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) { - print '
'.$langs->trans("Validate").'
'; - } - } - - // Modify - if ($object->statut == Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate))) + if ($action != 'editdescription' && ($action != 'presend')) { + // Validate + if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) { + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) { + print '
'.$langs->trans("Validate").'
'; + } + } + + // Modify + if ($object->statut == Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate))) { print '
'; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) print $langs->trans("Modify"); else print $langs->trans("SetToDraft"); print '
'; - } - - // Reopen - if ($object->statut >= Fichinter::STATUS_CLOSED) - { - if ($user->rights->ficheinter->creer) - { - print '
'.$langs->trans('Reopen').'
'; - } else print '
'.$langs->trans('Reopen').'
'; } // Send @@ -1636,12 +1636,13 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) { print '
'.$langs->trans('SendMail').'
'; - } else print '
'.$langs->trans('SendMail').'
'; + } + else print '
'.$langs->trans('SendMail').'
'; } } // create intervention model - if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) { + if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) { print '
'; print ''.$langs->trans("ChangeIntoRepeatableIntervention").''; print '
'; @@ -1673,14 +1674,16 @@ if ($object->statut != Fichinter::STATUS_BILLED) { print '
'.$langs->trans("InterventionClassifyBilled").'
'; - } else { + } + else + { print '
'.$langs->trans("InterventionClassifyUnBilled").'
'; } } } // Done - if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > Fichinter::STATUS_DRAFT && $object->statut < Fichinter::STATUS_CLOSED) + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > Fichinter::STATUS_DRAFT && $object->statut < Fichinter::STATUS_CLOSED) { print '
'.$langs->trans("InterventionClassifyDone").'
'; } @@ -1693,7 +1696,7 @@ // Delete if (($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { - print '
'.$langs->trans('Delete').'
'; } } @@ -1714,7 +1717,7 @@ $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->rights->ficheinter->lire; $delallowed = $user->rights->ficheinter->creer; - print $formfile->showdocuments('ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + print $formfile->showdocuments('ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter')); --- /tmp/dsg/dolibarr/htdocs/fichinter/github_contact.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_contact.php @@ -36,7 +36,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); // Security check if ($user->socid) $socid = $user->socid; @@ -46,8 +46,8 @@ $result = $object->fetch($id, $ref); if (!$result) { - print 'Record not found'; - exit; + print 'Record not found'; + exit; } /* @@ -56,18 +56,19 @@ if ($action == 'addcontact' && $user->rights->ficheinter->creer) { - if ($result > 0 && $id > 0) - { - $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); - $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); - $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); - } + if ($result > 0 && $id > 0) + { + $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); + $result = $object->add_contact($contactid, GETPOST('type', 'int'), GETPOST('source', 'alpha')); + } if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } else { + } + else + { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); @@ -82,7 +83,7 @@ // Toggle the status of a contact elseif ($action == 'swapstatut' && $user->rights->ficheinter->creer) { - $result = $object->swapContactStatus(GETPOST('ligne', 'int')); + $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } // Deletes a contact @@ -94,7 +95,8 @@ { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } else { + } + else { dol_print_error($db); } } @@ -119,7 +121,7 @@ $object->fetch_thirdparty(); $head = fichinter_prepare_head($object); - print dol_get_fiche_head($head, 'contact', $langs->trans("InterventionCard"), -1, 'intervention'); + dol_fiche_head($head, 'contact', $langs->trans("InterventionCard"), -1, 'intervention'); // Intervention card @@ -135,42 +137,42 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->ficheinter->creer) - { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $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 .= '
'; - $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 .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project').' '; + if ($user->rights->ficheinter->creer) + { + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $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 .= '
'; + $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 .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; @@ -181,8 +183,8 @@ $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); foreach ($dirtpls as $reldir) { - $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); - if ($res) break; + $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); + if ($res) break; } } --- /tmp/dsg/dolibarr/htdocs/fichinter/github_document.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_document.php @@ -43,7 +43,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); // Security check @@ -53,8 +53,8 @@ // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); +$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 $offset = $limit * $page; @@ -92,7 +92,7 @@ $head = fichinter_prepare_head($object); - print dol_get_fiche_head($head, 'documents', $langs->trans("InterventionCard"), -1, 'intervention'); + dol_fiche_head($head, 'documents', $langs->trans("InterventionCard"), -1, 'intervention'); // Build file list @@ -117,60 +117,62 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->commande->creer) - { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $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 .= '
'; - $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 .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project').' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $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 .= '
'; + $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 .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; + print '
'; + print '
'; - print ''; - print ''; - print ''; - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + print ''; + print ''; + print ''; + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; - print '
'; + print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); - $modulepart = 'ficheinter'; - $permission = $user->rights->ficheinter->creer; - $permtoedit = $user->rights->ficheinter->creer; - $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} else { + $modulepart = 'ficheinter'; + $permission = $user->rights->ficheinter->creer; + $permtoedit = $user->rights->ficheinter->creer; + $param = '&id='.$object->id; + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; +} +else +{ print $langs->trans("ErrorUnknown"); } --- /tmp/dsg/dolibarr/htdocs/fichinter/github_index.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_index.php @@ -68,16 +68,16 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo { - // Search ficheinter - $var = false; - print '
'; - print ''; - print '
'; - print ''; - print ''; - print ''; - print "
'.$langs->trans("Search").'
'; - print $langs->trans("Intervention").':

\n"; + // Search ficheinter + $var = false; + print '
'; + print ''; + print '
'; + print ''; + print ''; + print ''; + print "
'.$langs->trans("Search").'
'; + print $langs->trans("Intervention").':

\n"; } @@ -97,90 +97,92 @@ $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - $total = 0; - $totalinprocess = 0; - $dataseries = array(); - $vals = array(); - $bool = false; - // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) - while ($i < $num) - { - $row = $db->fetch_row($resql); - if ($row) - { - //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) - { - $bool = (!empty($row[2]) ?true:false); - if (!isset($vals[$row[1].$bool])) $vals[$row[1].$bool] = 0; - $vals[$row[1].$bool] += $row[0]; - $totalinprocess += $row[0]; - } - $total += $row[0]; - } - $i++; - } - $db->free($resql); - - include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; - - print '
'; - print ''; - print ''."\n"; - $listofstatus = array(0, 1, 3); - $bool = false; - foreach ($listofstatus as $status) - { - $dataseries[] = array($fichinterstatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool]) ? (int) $vals[$status.$bool] : 0)); - if ($status == 3 && !$bool) $bool = true; - else $bool = false; - - if ($status == Fichinter::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; - if ($status == Fichinter::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; - if ($status == Fichinter::STATUS_BILLED) $colorseries[$status] = $badgeStatus4; - if ($status == Fichinter::STATUS_CLOSED) $colorseries[$status] = $badgeStatus6; - } - if ($conf->use_javascript_ajax) - { - print ''; - } - $bool = false; - foreach ($listofstatus as $status) - { - if (!$conf->use_javascript_ajax) - { - print ''; - print ''; - print ''; - print "\n"; - if ($status == 3 && !$bool) $bool = true; - else $bool = false; - } - } - //if ($totalinprocess != $total) - //print ''; - print ''; - print "
'.$langs->trans("Statistics").' - '.$langs->trans("Interventions").'
'; - - include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; - $dolgraph = new DolGraph(); - $dolgraph->SetData($dataseries); - $dolgraph->SetDataColor(array_values($colorseries)); - $dolgraph->setShowLegend(2); - $dolgraph->setShowPercent(1); - $dolgraph->SetType(array('pie')); - $dolgraph->setHeight('200'); - $dolgraph->draw('idgraphstatus'); - print $dolgraph->show($total ? 0 : 1); - - print '
'.$fichinterstatic->LibStatut($status, $bool, 0).''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; - print $fichinterstatic->LibStatut($status, $bool, 3); - print ''; - print '
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'

"; -} else { - dol_print_error($db); + $num = $db->num_rows($resql); + $i = 0; + + $total = 0; + $totalinprocess = 0; + $dataseries = array(); + $vals = array(); + $bool = false; + // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) + while ($i < $num) + { + $row = $db->fetch_row($resql); + if ($row) + { + //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) + { + $bool = (!empty($row[2]) ?true:false); + if (!isset($vals[$row[1].$bool])) $vals[$row[1].$bool] = 0; + $vals[$row[1].$bool] += $row[0]; + $totalinprocess += $row[0]; + } + $total += $row[0]; + } + $i++; + } + $db->free($resql); + + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + + print '
'; + print ''; + print ''."\n"; + $listofstatus = array(0, 1, 3); + $bool = false; + foreach ($listofstatus as $status) + { + $dataseries[] = array($fichinterstatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool]) ? (int) $vals[$status.$bool] : 0)); + if ($status == 3 && !$bool) $bool = true; + else $bool = false; + + if ($status == Fichinter::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == Fichinter::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == Fichinter::STATUS_BILLED) $colorseries[$status] = $badgeStatus4; + if ($status == Fichinter::STATUS_CLOSED) $colorseries[$status] = $badgeStatus6; + } + if ($conf->use_javascript_ajax) + { + print ''; + } + $bool = false; + foreach ($listofstatus as $status) + { + if (!$conf->use_javascript_ajax) + { + print ''; + print ''; + print ''; + print "\n"; + if ($status == 3 && !$bool) $bool = true; + else $bool = false; + } + } + //if ($totalinprocess != $total) + //print ''; + print ''; + print "
'.$langs->trans("Statistics").' - '.$langs->trans("Interventions").'
'; + + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + $dolgraph = new DolGraph(); + $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); + $dolgraph->setShowLegend(2); + $dolgraph->setShowPercent(1); + $dolgraph->SetType(array('pie')); + $dolgraph->setHeight('200'); + $dolgraph->draw('idgraphstatus'); + print $dolgraph->show($total ? 0 : 1); + + print '
'.$fichinterstatic->LibStatut($status, $bool, 0).''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; + print $fichinterstatic->LibStatut($status, $bool, 3); + print ''; + print '
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'

"; +} +else +{ + dol_print_error($db); } @@ -202,7 +204,7 @@ $resql = $db->query($sql); if ($resql) { - print '
'; + print '
'; print ''; print ''; print ''; @@ -251,7 +253,7 @@ $resql = $db->query($sql); if ($resql) { - print '
'; + print '
'; print '
'.$langs->trans("DraftFichinter").'
'; print ''; print ''; @@ -296,7 +298,8 @@ } } print "
'.$langs->trans("LastModifiedInterventions", $max).'

"; -} else dol_print_error($db); +} +else dol_print_error($db); /* @@ -321,7 +324,7 @@ { $num = $db->num_rows($resql); - print '
'; + print '
'; print ''; print ''; print ''; @@ -366,7 +369,8 @@ } print "
'.$langs->trans("FichinterToProcess").' '.$num.'

"; - } else dol_print_error($db); + } + else dol_print_error($db); } print '
'; --- /tmp/dsg/dolibarr/htdocs/fichinter/github_info.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_info.php @@ -64,7 +64,7 @@ $object->info($object->id); $head = fichinter_prepare_head($object); -print dol_get_fiche_head($head, 'info', $langs->trans('InterventionCard'), -1, 'intervention'); +dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), -1, 'intervention'); // Intervention card $linkback = ''.$langs->trans("BackToList").''; @@ -124,7 +124,7 @@ print ''; -print dol_get_fiche_end(); +dol_fiche_end(); llxFooter(); $db->close(); --- /tmp/dsg/dolibarr/htdocs/fichinter/github_list.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_list.php @@ -40,7 +40,7 @@ if (!empty($conf->projet->enabled)) $langs->load("projects"); if (!empty($conf->contrat->enabled)) $langs->load("contracts"); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); @@ -65,8 +65,8 @@ $diroutputmassaction = $conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); +$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 $offset = $limit * $page; @@ -85,7 +85,7 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); +$extrafields->fetch_name_optionals_label('fichinter'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); @@ -95,10 +95,9 @@ 's.nom'=>"ThirdParty", 'f.description'=>'Description', 'f.note_public'=>'NotePublic', - 'fd.description'=>'DescriptionOfLine', ); if (empty($user->socid)) $fieldstosearchall["f.note_private"] = "NotePrivate"; -if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['fd.description']); +if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']); // Definition of fields for list $arrayfields = array( @@ -109,16 +108,20 @@ 'f.description'=>array('label'=>'Description', 'checked'=>1), 'f.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>'DateModificationShort', 'checked'=>0, 'position'=>500), - 'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))), - 'f.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES))), 'f.fk_statut'=>array('label'=>'Status', 'checked'=>1, 'position'=>1000), 'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), 'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), 'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), ); // Extra fields -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; - +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } +} $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -174,10 +177,10 @@ $objectstatic = new Fichinter($db); $companystatic = new Societe($db); if (!empty($conf->projet->enabled)) { - $projetstatic = new Project($db); + $projetstatic = new Project($db); } if (!empty($conf->contrat->enabled)) { - $contratstatic = new Contrat($db); + $contratstatic = new Contrat($db); } $title = $langs->trans("ListOfInterventions"); @@ -189,22 +192,22 @@ $atleastonefieldinlines = 0; foreach ($arrayfields as $tmpkey => $tmpval) { - if (preg_match('/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey]['checked'])) - { - $atleastonefieldinlines++; - break; - } + if (preg_match('/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey]['checked'])) + { + $atleastonefieldinlines++; + break; + } } $sql = "SELECT"; -$sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,"; +$sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; $sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus"; if (!empty($conf->projet->enabled)) { - $sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title"; + $sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title"; } if (!empty($conf->contrat->enabled)) { - $sql .= ", c.rowid as contrat_id, c.ref as contrat_ref, c.ref_customer as contrat_ref_supplier, c.ref_supplier as contrat_ref_supplier"; + $sql .= ", c.rowid as contrat_id, c.ref as contrat_ref, c.ref_customer as contrat_ref_supplier, c.ref_supplier as contrat_ref_supplier"; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -216,10 +219,10 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if (!empty($conf->projet->enabled)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr on f.fk_projet = pr.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr on f.fk_projet = pr.rowid"; } if (!empty($conf->contrat->enabled)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat as c on f.fk_contrat = c.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat as c on f.fk_contrat = c.rowid"; } 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 (f.rowid = ef.fk_object)"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; @@ -234,10 +237,10 @@ $sql .= natural_search('s.nom', $search_company); } if ($search_projet_ref) { - $sql .= natural_search('pr.ref', $search_projet_ref); + $sql .= natural_search('pr.ref', $search_projet_ref); } if ($search_contrat_ref) { - $sql .= natural_search('c.ref', $search_contrat_ref); + $sql .= natural_search('c.ref', $search_contrat_ref); } if ($search_desc) { if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= natural_search(array('f.description', 'fd.description'), $search_desc); @@ -309,17 +312,14 @@ $arrayofmassactions = array( 'generate_doc'=>$langs->trans("ReGeneratePDF"), 'builddoc'=>$langs->trans("PDFMerge"), - //'presend'=>$langs->trans("SendByMail"), + //'presend'=>$langs->trans("SendByMail"), ); if ($user->rights->ficheinter->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - - $url = DOL_URL_ROOT.'/fichinter/card.php?action=create'; - if (!empty($socid)) $url .= '&socid='.$socid; - $newcardbutton = dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fichinter/card.php?action=create', '', $user->rights->ficheinter->creer); // Lines of title fields print '
'."\n"; @@ -377,18 +377,18 @@ print ''; print ''; } - if (!empty($arrayfields['pr.ref']['checked'])) - { - print ''; - print ''; - print ''; - } - if (!empty($arrayfields['c.ref']['checked'])) - { - print ''; - print ''; - print ''; - } + if (!empty($arrayfields['pr.ref']['checked'])) + { + print ''; + print ''; + print ''; + } + if (!empty($arrayfields['c.ref']['checked'])) + { + print ''; + print ''; + print ''; + } if (!empty($arrayfields['f.description']['checked'])) { print ''; @@ -411,18 +411,6 @@ if (!empty($arrayfields['f.tms']['checked'])) { // Date modification - print ''; - print ''; - } - if (!empty($arrayfields['f.note_public']['checked'])) - { - // Note public - print ''; - print ''; - } - if (!empty($arrayfields['f.note_private']['checked'])) - { - // Note private print ''; print ''; } @@ -436,18 +424,18 @@ print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); print ''; } - // Fields of detail line + // Fields of detail line if (!empty($arrayfields['fd.description']['checked'])) { - print ' '; + print ' '; } if (!empty($arrayfields['fd.date']['checked'])) { - print ' '; + print ' '; } if (!empty($arrayfields['fd.duree']['checked'])) { - print ' '; + print ' '; } print ''; $searchpicto = $form->showFilterButtons(); @@ -470,8 +458,6 @@ print $hookmanager->resPrint; if (!empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (!empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - if (!empty($arrayfields['f.note_public']['checked'])) print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap '); - if (!empty($arrayfields['f.note_private']['checked'])) print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (!empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['fd.description']['checked'])) print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], ''); if (!empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center '); @@ -544,31 +530,31 @@ print ''; if (!$i) $totalarray['nbfield']++; } - if (!empty($arrayfields['pr.ref']['checked'])) - { - print ''; - $projetstatic->id = $obj->projet_id; - $projetstatic->ref = $obj->projet_ref; - $projetstatic->title = $obj->projet_title; - if ($projetstatic->id > 0) { - print $projetstatic->getNomUrl(1, ''); - } - print ''; - if (!$i) $totalarray['nbfield']++; - } - if (!empty($arrayfields['c.ref']['checked'])) - { - print ''; - $contratstatic->id = $obj->contrat_id; - $contratstatic->ref = $obj->contrat_ref; - $contratstatic->ref_customer = $obj->contrat_ref_customer; - $contratstatic->ref_supplier = $obj->contrat_ref_supplier; - if ($contratstatic->id > 0) { - print $contratstatic->getNomUrl(1, ''); - print ''; - } - if (!$i) $totalarray['nbfield']++; - } + if (!empty($arrayfields['pr.ref']['checked'])) + { + print ''; + $projetstatic->id = $obj->projet_id; + $projetstatic->ref = $obj->projet_ref; + $projetstatic->title = $obj->projet_title; + if ($projetstatic->id > 0) { + print $projetstatic->getNomUrl(1, ''); + } + print ''; + if (!$i) $totalarray['nbfield']++; + } + if (!empty($arrayfields['c.ref']['checked'])) + { + print ''; + $contratstatic->id = $obj->contrat_id; + $contratstatic->ref = $obj->contrat_ref; + $contratstatic->ref_customer = $obj->contrat_ref_customer; + $contratstatic->ref_supplier = $obj->contrat_ref_supplier; + if ($contratstatic->id > 0) { + print $contratstatic->getNomUrl(1, ''); + print ''; + } + if (!$i) $totalarray['nbfield']++; + } if (!empty($arrayfields['f.description']['checked'])) { print ''.dol_trunc(dolGetFirstLineOfText($obj->description), 48).''; @@ -597,22 +583,6 @@ print ''; if (!$i) $totalarray['nbfield']++; } - // Note public - if (!empty($arrayfields['f.note_public']['checked'])) - { - print ''; - print dol_escape_htmltag($obj->note_public); - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Note private - if (!empty($arrayfields['f.note_private']['checked'])) - { - print ''; - print dol_escape_htmltag($obj->note_private); - print ''; - if (!$i) $totalarray['nbfield']++; - } // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { @@ -622,20 +592,20 @@ // Fields of detail of line if (!empty($arrayfields['fd.description']['checked'])) { - print ''.dolGetFirstLineOfText($obj->descriptiondetail).''; - if (!$i) $totalarray['nbfield']++; + print ''.dolGetFirstLineOfText($obj->descriptiondetail).''; + if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['fd.date']['checked'])) { - print ''.dol_print_date($db->jdate($obj->dp), 'dayhour')."\n"; - if (!$i) $totalarray['nbfield']++; + print ''.dol_print_date($db->jdate($obj->dp), 'dayhour')."\n"; + if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['fd.duree']['checked'])) { - print ''.convertSecondToTime($obj->duree, 'allhourmin').''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; - $totalarray['val']['fd.duree'] += $obj->duree; + print ''.convertSecondToTime($obj->duree, 'allhourmin').''; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; + $totalarray['val']['fd.duree'] += $obj->duree; } // Action column print ''; @@ -680,7 +650,9 @@ $delallowed = $user->rights->ficheinter->creer; print $formfile->showdocuments('massfilesarea_interventions', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} else { +} +else +{ dol_print_error($db); } --- /tmp/dsg/dolibarr/htdocs/fichinter/github_note.php +++ /tmp/dsg/dolibarr/htdocs/fichinter/client_note.php @@ -36,7 +36,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); // Security check if ($user->socid) $socid = $user->socid; @@ -67,7 +67,7 @@ $object->fetch_thirdparty(); $head = fichinter_prepare_head($object); - print dol_get_fiche_head($head, 'note', $langs->trans('InterventionCard'), -1, 'intervention'); + dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), -1, 'intervention'); // Intervention card $linkback = ''.$langs->trans("BackToList").''; @@ -82,40 +82,40 @@ // Project if (!empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->commande->creer) - { - if ($action != 'classify') { - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $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 .= ''; - $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 .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; - } else { - $morehtmlref .= ''; - } - } + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project').' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $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 .= '
'; + $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 .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } $morehtmlref .= ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; @@ -125,7 +125,7 @@ print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); } llxFooter();