diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 930f9371522..50a18f5e57c 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -463,31 +463,6 @@ class Fichinter extends CommonObject } } - /** - * Set intervetnion as billed - * - * @return int <0 si ko, >0 si ok - */ - function setBilled() - { - global $conf; - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinter SET fk_statut = 2'; - $sql.= ' WHERE rowid = '.$this->id; - $sql.= " AND entity = ".$conf->entity; - $sql.= " AND fk_statut = 1"; - - if ($this->db->query($sql) ) - { - return 1; - } - else - { - dol_print_error($this->db); - return -1; - } - } - /** * Returns the label status diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 02b2b2ea7dd..437002aa23c 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -471,7 +471,22 @@ else if ($action == "addline" && $user->rights->ficheinter->creer) // Classify Billed else if ($action == 'classifybilled' && $user->rights->ficheinter->creer) { - $result=$object->setBilled(); + $result=$object->setStatut(2); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + $mesg='
'.$object->error.'
'; + } +} + +// Classify Billed +else if ($action == 'classifyunbilled' && $user->rights->ficheinter->creer) +{ + $result=$object->setStatut(1); if ($result > 0) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); @@ -485,7 +500,7 @@ else if ($action == 'classifybilled' && $user->rights->ficheinter->creer) /* * Mise a jour d'une ligne d'intervention -*/ + */ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST('save','alpha') == $langs->trans("Save")) { $objectline = new FichinterLigne($db); @@ -1289,12 +1304,12 @@ else if ($id > 0 || ! empty($ref)) print $extrafields->showInputField($key,$value); - print ''; + print '   '; } else { print $extrafields->showOutputField($key,$value); - if ($object->statut == 0 && $user->rights->ficheinter->creer) print ''.img_picto('','edit').' '.$langs->trans('Modify').''; + if ($object->statut == 0 && $user->rights->ficheinter->creer) print '   '.img_picto('','edit').' '.$langs->trans('Modify').''; } print ''."\n"; } @@ -1319,196 +1334,199 @@ else if ($id > 0 || ! empty($ref)) include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; } - - print '
'; - print ''; - print ''; - if ($action == 'editline') - { - print ''; - print ''; - } - else - { - print ''; - } - - // Intervention lines - $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; - $sql.= ' ft.date as date_intervention'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; - $sql.= ' WHERE ft.fk_fichinter = '.$object->id; - $sql.= ' ORDER BY ft.rang ASC, ft.rowid'; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - if ($num) + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print ''; + print ''; + print ''; + if ($action == 'editline') { - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; + print ''; + print ''; } - $var=true; - while ($i < $num) + else { - $objp = $db->fetch_object($resql); - $var=!$var; + print ''; + } - // Ligne en mode visu - if ($action != 'editline' || GETPOST('line_id','int') != $objp->rowid) + // Intervention lines + $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; + $sql.= ' ft.date as date_intervention'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; + $sql.= ' WHERE ft.fk_fichinter = '.$object->id; + $sql.= ' ORDER BY ft.rang ASC, ft.rowid'; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + if ($num) { - print ''; - print '
'.$langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'; - print ''; // ancre pour retourner sur la ligne - print dol_htmlentitiesbr($objp->description); + print '
'; + print ''; - // Date - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + $var=true; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; - // Duration - print ''; - - print "\n"; - - - // Icone d'edition et suppression - if ($object->statut == 0 && $user->rights->ficheinter->creer) + // Ligne en mode visu + if ($action != 'editline' || GETPOST('line_id','int') != $objp->rowid) { - print ''; - print ''; - if ($num > 1) + print ''; + print ''; + + // Duration + print ''; + + print "\n"; + + + // Icone d'edition et suppression + if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; + print ''; + if ($num > 1) + { + print ''; + } } - } - else - { - print ''; + else + { + print ''; + } + + print ''; } - print ''; + // Line in update mode + if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) + { + print ''; + print ''; + + // Date d'intervention + print ''; + + // Duration + print ''; + + print ''; + print '' . "\n"; + } + + $i++; } - // Line in update mode - if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) - { - print ''; - print '
'.dol_print_date($db->jdate($objp->date_intervention),'dayhour').'
'.$langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'.convertSecondToTime($objp->duree).''; - print 'rowid.'#'.$objp->rowid.'">'; - print img_edit(); - print ''; - print ''; - print 'rowid.'">'; - print img_delete(); - print '
'; + print ''; // ancre pour retourner sur la ligne + print dol_htmlentitiesbr($objp->description); + + // Date + print ''.dol_print_date($db->jdate($objp->date_intervention),'dayhour').''.convertSecondToTime($objp->duree).''; - if ($i > 0) - { - print 'rowid.'">'; - print img_up(); - print ''; - } - if ($i < $num-1) - { - print 'rowid.'">'; - print img_down(); - print ''; - } + print 'rowid.'#'.$objp->rowid.'">'; + print img_edit(); + print ''; print ''; + print 'rowid.'">'; + print img_delete(); + print ''; + if ($i > 0) + { + print 'rowid.'">'; + print img_up(); + print ''; + } + if ($i < $num-1) + { + print 'rowid.'">'; + print img_down(); + print ''; + } + print '  
'; + print ''; // ancre pour retourner sur la ligne + + // Editeur wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor('np_desc',$objp->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); + $doleditor->Create(); + print ''; + $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + print ''; + $form->select_duration('duration',$objp->duree); + print ''; + print '
'; - print ''; // ancre pour retourner sur la ligne + $db->free($resql); - // Editeur wysiwyg + // Add new line + if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + if (! $num) print '
'; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print "\n"; + + $var=false; + + print '\n"; + print ''; - // Date d'intervention + // Date intervention print ''; // Duration print ''; - print ''; - print '' . "\n"; + print ''; + print ''; + + if (! $num) print '
'; + print ''; // ancre + print $langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'; + // editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('np_desc',$objp->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); + $doleditor=new DolEditor('np_desc',GETPOST('np_desc','alpha'),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,ROWS_2,70); $doleditor->Create(); print ''; - $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention"); + $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')); + $form->select_date($timewithnohour,'di',1,1,0,"addinter"); print ''; - $form->select_duration('duration',$objp->duree); + $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, 1); print ''; - print '
'; } - $i++; + if ($num) print '
'; } - - $db->free($resql); - - // Add new line - if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline' && empty($conf->global->FICHINTER_DISABLE_DETAILS)) + else { - if (! $num) print '
'; - - print ''; - print ''; - print ''; - print ''; - - print ''; - print "\n"; - - $var=false; - - print '\n"; - print ''; - - // Date intervention - print ''; - - // Duration - print ''; - - print ''; - print ''; - - if (! $num) print '
'; - print ''; // ancre - print $langs->trans('Description').''.$langs->trans('Date').''.$langs->trans('Duration').' 
'; - // editeur wysiwyg - 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,70); - $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')); - $form->select_date($timewithnohour,'di',1,1,0,"addinter"); - print ''; - $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, 1); - print '
'; + dol_print_error($db); } - if ($num) print '
'; - } - else - { - dol_print_error($db); - } + print '
'."\n"; + } - print ''."\n"; + dol_fiche_end(); - print ''; print "\n"; @@ -1529,7 +1547,7 @@ else if ($id > 0 || ! empty($ref)) } // Modify - if ($object->statut == 1 && $user->rights->ficheinter->creer) + if ($object->statut == 1 && $user->rights->ficheinter->creer && empty($conf->global->FICHINTER_DISABLE_DETAILS)) { print '
'.$langs->trans("Modify").'
'; @@ -1572,6 +1590,10 @@ else if ($id > 0 || ! empty($ref)) { print '
'.$langs->trans("ClassifyBilled").'
'; } + else + { + print '
'.$langs->trans("ClassifyUnBilled").'
'; + } } } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index aa18223c0c5..6a730dbe046 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador @@ -108,8 +108,11 @@ if ($result) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],''); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$urlparam,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$urlparam,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); + } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder); print "\n"; @@ -122,8 +125,11 @@ if ($result) print ''; print ''; print ' '; - print ' '; - print ' '; + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print ' '; + print ' '; + } print ''; print "\n"; @@ -150,8 +156,11 @@ if ($result) print ''; print ''.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''; print ''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''; - print ''.dol_print_date($db->jdate($objp->dp),'dayhour')."\n"; - print ''.convertSecondToTime($objp->duree).''; + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print ''.dol_print_date($db->jdate($objp->dp),'dayhour')."\n"; + print ''.convertSecondToTime($objp->duree).''; + } print ''.$interventionstatic->LibStatut($objp->fk_statut,5).''; print "\n"; @@ -159,9 +168,13 @@ if ($result) $total += $objp->duree; $i++; } - print ''.$langs->trans("Total").''; - print ''.convertSecondToTime($total).' '; - print ''; + $rowspan=3; + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + print ''.$langs->trans("Total").''; + print ''.convertSecondToTime($total).' '; + print ''; + } print ''; print "\n"; diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 58579a74276..36ef77517f8 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -25,6 +25,7 @@ NameAndSignatureOfExternalContact=Name and signature of customer : DocumentModelStandard=Standard document model for interventions InterventionCardsAndInterventionLines=Interventions and lines of interventions ClassifyBilled=Classify "Billed" +ClassifyUnBilled=Classify "Unbilled" StatusInterInvoiced=Billed RelatedInterventions=Related interventions ShowIntervention=Show intervention