From 385f462929f4ce2092ed302861cd35257154c469 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Jul 2011 17:14:58 +0000 Subject: [PATCH] Uniformize code --- htdocs/fichinter/fiche.php | 306 ++++++++++++++++++------------------- 1 file changed, 153 insertions(+), 153 deletions(-) diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 530ff8bc91c..39c9a121147 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -23,7 +23,7 @@ * \file htdocs/fichinter/fiche.php * \brief Fichier fiche intervention * \ingroup ficheinter - * \version $Id: fiche.php,v 1.164 2011/07/02 16:48:32 eldy Exp $ + * \version $Id: fiche.php,v 1.165 2011/07/02 17:14:58 eldy Exp $ */ require("../main.inc.php"); @@ -51,16 +51,16 @@ $mesg=GETPOST("msg"); // Load object if defined $fichinterid=0; -$fichinter = new Fichinter($db); +$object = new Fichinter($db); if ($id > 0 || ! empty($_GET["ref"])) { - $result=$fichinter->fetch($id,$_GET["ref"]); + $result=$object->fetch($id,$_GET["ref"]); if (! $result > 0) { dol_print_error($db); exit; } - $fichinterid=$fichinter->id; + $fichinterid=$object->id; } // Security check @@ -81,77 +81,77 @@ if ($action != 'create' && $action != 'add' && $action != 'classifybilled' && ! if ($action == 'confirm_validate' && $_REQUEST['confirm'] == 'yes') { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $fichinter->fetch_thirdparty(); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); - $result = $fichinter->setValid($user, $conf->fichinter->outputdir); + $result = $object->setValid($user, $conf->fichinter->outputdir); if ($result >= 0) { // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs); - Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id); + $result=fichinter_create($db, $object, $_REQUEST['model'], $outputlangs); + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else { - $mesg='
'.$fichinter->error.'
'; + $mesg='
'.$object->error.'
'; } } if ($action == 'confirm_modify' && $_REQUEST['confirm'] == 'yes') { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $fichinter->fetch_thirdparty(); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); - $result = $fichinter->setDraft($user); + $result = $object->setDraft($user); if ($result >= 0) { // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $fichinter, (empty($_REQUEST['model'])?$fichinter->model:$_REQUEST['model']), $outputlangs); - Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id); + $result=fichinter_create($db, $object, (empty($_REQUEST['model'])?$object->model:$_REQUEST['model']), $outputlangs); + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else { - $mesg='
'.$fichinter->error.'
'; + $mesg='
'.$object->error.'
'; } } if ($_POST["action"] == 'add') { - $fichinter = new Fichinter($db); + $object = new Fichinter($db); - $fichinter->socid = $_POST["socid"]; - $fichinter->duree = $_POST["duree"]; - $fichinter->fk_project = $_POST["projectid"]; - $fichinter->author = $user->id; - $fichinter->description = $_POST["description"]; - $fichinter->ref = $_POST["ref"]; - $fichinter->modelpdf = $_POST["model"]; + $object->socid = $_POST["socid"]; + $object->duree = $_POST["duree"]; + $object->fk_project = $_POST["projectid"]; + $object->author = $user->id; + $object->description = $_POST["description"]; + $object->ref = $_POST["ref"]; + $object->modelpdf = $_POST["model"]; - if ($fichinter->socid > 0) + if ($object->socid > 0) { - $result = $fichinter->create(); + $result = $object->create(); if ($result > 0) { $id=$result; // Force raffraichissement sur fiche venant d'etre cree @@ -160,7 +160,7 @@ if ($_POST["action"] == 'add') else { $langs->load("errors"); - $mesg='
'.$langs->trans($fichinter->error).'
'; + $mesg='
'.$langs->trans($object->error).'
'; $action = 'create'; $_GET["socid"] = $_POST["socid"]; } @@ -174,16 +174,16 @@ if ($_POST["action"] == 'add') if ($_POST["action"] == 'update') { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); + $object = new Fichinter($db); + $object->fetch($id); - $fichinter->socid = $_POST["socid"]; - $fichinter->fk_project = $_POST["projectid"]; - $fichinter->author = $user->id; - $fichinter->description = $_POST["description"]; - $fichinter->ref = $_POST["ref"]; + $object->socid = $_POST["socid"]; + $object->fk_project = $_POST["projectid"]; + $object->author = $user->id; + $object->description = $_POST["description"]; + $object->ref = $_POST["ref"]; - $fichinter->update($user); + $object->update($user); } /* @@ -191,27 +191,27 @@ if ($_POST["action"] == 'update') */ if ($action == 'builddoc') // En get ou en post { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $fichinter->fetch_thirdparty(); - $fichinter->fetch_lines(); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); + $object->fetch_lines(); if ($_REQUEST['model']) { - $fichinter->setDocModel($user, $_REQUEST['model']); + $object->setDocModel($user, $_REQUEST['model']); } // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs); + $result=fichinter_create($db, $object, $_REQUEST['model'], $outputlangs); if ($result <= 0) { dol_print_error($db,$result); @@ -222,19 +222,19 @@ if ($action == 'builddoc') // En get ou en post // Set into a project if ($action == 'classin') { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $result=$fichinter->setProject($_POST['projectid']); - if ($result < 0) dol_print_error($db,$fichinter->error); + $object = new Fichinter($db); + $object->fetch($id); + $result=$object->setProject($_POST['projectid']); + if ($result < 0) dol_print_error($db,$object->error); } if ($action == 'confirm_delete' && $_REQUEST['confirm'] == 'yes') { if ($user->rights->ficheinter->supprimer) { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $fichinter->delete($user); + $object = new Fichinter($db); + $object->fetch($id); + $object->delete($user); } Header('Location: index.php?leftmenu=ficheinter'); exit; @@ -242,10 +242,10 @@ if ($action == 'confirm_delete' && $_REQUEST['confirm'] == 'yes') if ($action == 'setdescription') { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $result=$fichinter->set_description($user,$_POST['description']); - if ($result < 0) dol_print_error($db,$fichinter->error); + $object = new Fichinter($db); + $object->fetch($id); + $result=$object->set_description($user,$_POST['description']); + if ($result < 0) dol_print_error($db,$object->error); } // Add line @@ -253,15 +253,15 @@ if ($action == "addline" && $user->rights->ficheinter->creer) { if ($_POST['np_desc'] && ($_POST['durationhour'] || $_POST['durationmin'])) { - $fichinter = new Fichinter($db); - $ret=$fichinter->fetch($_POST['fichinterid']); - $fichinter->fetch_thirdparty(); + $object = new Fichinter($db); + $ret=$object->fetch($_POST['fichinterid']); + $object->fetch_thirdparty(); $desc=$_POST['np_desc']; $date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]); $duration = ConvertTime2Seconds($_POST['durationhour'],$_POST['durationmin']); - $fichinter->addline( + $object->addline( $_POST['fichinterid'], $desc, $date_intervention, @@ -272,13 +272,13 @@ if ($action == "addline" && $user->rights->ficheinter->creer) $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_POST['fichinterid']); exit; } @@ -287,9 +287,9 @@ if ($action == "addline" && $user->rights->ficheinter->creer) // Classify Billed if ($action == 'classifybilled') { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $result=$fichinter->setBilled(); + $object = new Fichinter($db); + $object->fetch($id); + $result=$object->setBilled(); if ($result > 0) { Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_POST['fichinterid']); @@ -297,7 +297,7 @@ if ($action == 'classifybilled') } else { - $mesg='
'.$fichinter->error.'
'; + $mesg='
'.$object->error.'
'; } } @@ -313,13 +313,13 @@ if ($action == 'updateligne' && $user->rights->ficheinter->creer && $_POST["save exit; } - $fichinter = new Fichinter($db); - if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0) + $object = new Fichinter($db); + if ($object->fetch($fichinterline->fk_fichinter) <= 0) { dol_print_error($db); exit; } - $fichinter->fetch_thirdparty(); + $object->fetch_thirdparty(); $desc=$_POST['np_desc']; $date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]); @@ -339,13 +339,13 @@ if ($action == 'updateligne' && $user->rights->ficheinter->creer && $_POST["save $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); unset($_POST['dihour']); unset($_POST['dimin']); @@ -373,8 +373,8 @@ if ($action == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') exit; } $result=$fichinterline->deleteline(); - $fichinter = new Fichinter($db); - if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0) + $object = new Fichinter($db); + if ($object->fetch($fichinterline->fk_fichinter) <= 0) { dol_print_error($db); exit; @@ -384,13 +384,13 @@ if ($action == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); } Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; @@ -402,44 +402,44 @@ if ($action == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') if ($action == 'up' && $user->rights->ficheinter->creer) { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $fichinter->fetch_thirdparty(); - $fichinter->line_up($_GET['rowid']); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); + $object->line_up($_GET['rowid']); // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.$_GET['rowid']); exit; } if ($action == 'down' && $user->rights->ficheinter->creer) { - $fichinter = new Fichinter($db); - $fichinter->fetch($id); - $fichinter->fetch_thirdparty(); - $fichinter->line_down($_GET['rowid']); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); + $object->line_down($_GET['rowid']); // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.$_GET['rowid']); exit; } @@ -451,15 +451,15 @@ if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_AD { $langs->load('mails'); - $fichinter = new Fichinter($db); - if ( $fichinter->fetch($_POST['fichinter_id']) ) + $object = new Fichinter($db); + if ( $object->fetch($_POST['fichinter_id']) ) { - $ficheinterref = dol_sanitizeFileName($fichinter->ref); + $ficheinterref = dol_sanitizeFileName($object->ref); $file = $conf->ficheinter->dir_output . '/' . $ficheinterref . '/' . $ficheinterref . '.pdf'; if (is_readable($file)) { - $fichinter->fetch_thirdparty(); + $object->fetch_thirdparty(); if ($_POST['sendto']) { @@ -472,12 +472,12 @@ if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_AD // Le destinataire a ete fourni via la liste deroulante if ($_POST['receiver'] < 0) // Id du tiers { - $sendto = $fichinter->client->email; + $sendto = $object->client->email; $sendtoid = 0; } else // Id du contact { - $sendto = $fichinter->client->contact_get_email($_POST['receiver']); + $sendto = $object->client->contact_get_email($_POST['receiver']); $sendtoid = $_POST['receiver']; } } @@ -495,7 +495,7 @@ if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_AD if ($action == 'send') { if (strlen($_POST['subject'])) $subject = $_POST['subject']; - else $subject = $langs->transnoentities('Intervention').' '.$fichinter->ref; + else $subject = $langs->transnoentities('Intervention').' '.$object->ref; $actiontypecode='AC_FICH'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; if ($message) @@ -533,17 +533,17 @@ if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_AD $error=0; // Initialisation donnees - $fichinter->sendtoid = $sendtoid; - $fichinter->actiontypecode = $actiontypecode; - $fichinter->actionmsg = $actionmsg; - $fichinter->actionmsg2 = $actionmsg2; - $fichinter->fk_element = $fichinter->id; - $fichinter->elementtype = $fichinter->element; + $object->sendtoid = $sendtoid; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; + $object->actionmsg2 = $actionmsg2; + $object->fk_element = $object->id; + $object->elementtype = $object->element; // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($db); - $result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$fichinter,$user,$langs,$conf); + $result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$object,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers @@ -555,7 +555,7 @@ if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_AD { // Redirect here // This avoid sending mail twice if going out and then back to page - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&msg='.urlencode($mesg)); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&msg='.urlencode($mesg)); exit; } } @@ -719,44 +719,44 @@ elseif ($fichinterid) /* * Affichage en mode visu */ - $fichinter->fetch_thirdparty(); + $object->fetch_thirdparty(); $societe=new Societe($db); - $societe->fetch($fichinter->socid); + $societe->fetch($object->socid); dol_htmloutput_mesg($mesg); - $head = fichinter_prepare_head($fichinter); + $head = fichinter_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention'); // Confirmation de la suppression de la fiche d'intervention if ($action == 'delete') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); if ($ret == 'html') print '
'; } // Confirmation validation if ($action == 'validate') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1); if ($ret == 'html') print '
'; } // Confirmation de la validation de la fiche d'intervention if ($action == 'modify') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); if ($ret == 'html') print '
'; } // Confirmation de la suppression d'une ligne d'intervention if ($action == 'ask_deleteline') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); if ($ret == 'html') print '
'; } @@ -764,16 +764,16 @@ elseif ($fichinterid) // Ref print ''.$langs->trans("Ref").''; - print $html->showrefnav($fichinter,'ref','',1,'ref','ref'); + print $html->showrefnav($object,'ref','',1,'ref','ref'); print ''; // Third party - print "".$langs->trans("Company")."".$fichinter->client->getNomUrl(1).""; + print "".$langs->trans("Company")."".$object->client->getNomUrl(1).""; // Duration print ''.$langs->trans("TotalDuration").''; - //print $fichinter->duree.'-'.$conf->global->MAIN_DURATION_OF_WORKDAY; - print ''.ConvertSecondToTime($fichinter->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).''; + //print $object->duree.'-'.$conf->global->MAIN_DURATION_OF_WORKDAY; + print ''.ConvertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).''; //print ''.ConvertSecondToTime(90000,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).''; print ''; @@ -782,21 +782,21 @@ elseif ($fichinterid) print ''; - if ($action != 'editdescription' && $fichinter->statut == 0) print ''; + if ($action != 'editdescription' && $object->statut == 0) print ''; print '
'; print $langs->trans('Description'); print 'id.'">'.img_edit($langs->trans('Modify'),1).'id.'">'.img_edit($langs->trans('Modify'),1).'
'; print ''; if ($action == 'editdescription') { - print '
'; + print ''; print ''; print ''; - print '
'; + print '
'; print ''; print '
'; } else { - print dol_nl2br($fichinter->description); + print dol_nl2br($object->description); } print ''; print ''; @@ -813,7 +813,7 @@ elseif ($fichinterid) print ''; if ($action != 'classin') { - print 'id.'">'; + print 'id.'">'; print img_edit($langs->trans('SetProject'),1); print ''; } @@ -821,18 +821,18 @@ elseif ($fichinterid) print ''; if ($action == 'classin') { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'projectid'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'none'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none'); } print ''; print ''; } // Statut - print ''.$langs->trans("Status").''.$fichinter->getLibStatut(4).''; + print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; print ""; @@ -886,15 +886,15 @@ elseif ($fichinterid) // Icone d'edition et suppression - if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) + if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; - print 'rowid.'#'.$objp->rowid.'">'; + print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print ''; print ''; print ''; - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; if ($num > 1) @@ -902,13 +902,13 @@ elseif ($fichinterid) print ''; if ($i > 0) { - print 'rowid.'">'; + print 'rowid.'">'; print img_up(); print ''; } if ($i < $num-1) { - print 'rowid.'">'; + print 'rowid.'">'; print img_down(); print ''; } @@ -924,12 +924,12 @@ elseif ($fichinterid) } // Ligne en mode update - if ($fichinter->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && $_GET["ligne"] == $objp->rowid) + if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && $_GET["ligne"] == $objp->rowid) { - print '
rowid.'" method="post">'; + print 'rowid.'" method="post">'; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -966,7 +966,7 @@ elseif ($fichinterid) /* * Ajouter une ligne */ - if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') + if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') { if (! $num) print '
'; @@ -981,9 +981,9 @@ elseif ($fichinterid) print "\n"; // Ajout ligne d'intervention - print ''; + print ''; print ''; - print ''; + print ''; print ''; $var=false; @@ -1037,23 +1037,23 @@ elseif ($fichinterid) if ($action != 'editdescription') { // Validate - if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) + if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''.$langs->trans("Valid").''; } // Modify - if ($fichinter->statut == 1 && $user->rights->ficheinter->creer) + if ($object->statut == 1 && $user->rights->ficheinter->creer) { print ''.$langs->trans("Modify").''; } // Send - if ($fichinter->statut > 0) + if ($object->statut > 0) { - $ficheinterref = dol_sanitizeFileName($fichinter->ref); + $ficheinterref = dol_sanitizeFileName($object->ref); $file = $conf->ficheinter->dir_output . '/'.$ficheinterref.'/'.$ficheinterref.'.pdf'; if (file_exists($file)) { @@ -1066,18 +1066,18 @@ elseif ($fichinterid) } // Invoicing - if ($conf->facture->enabled && $fichinter->statut > 0) + if ($conf->facture->enabled && $object->statut > 0) { $langs->load("bills"); - if ($fichinter->statut < 2) + if ($object->statut < 2) { - if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; + if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; else print ''.$langs->trans("CreateBill").''; } if (! empty($conf->global->FICHEINTER_CLASSIFY_BILLED)) { - if ($fichinter->statut != 2) + if ($object->statut != 2) { print ''.$langs->trans("ClassifyBilled").''; } @@ -1085,7 +1085,7 @@ elseif ($fichinterid) } // Delete - if (($fichinter->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) + if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { print ''.$langs->trans('Delete').''; @@ -1102,7 +1102,7 @@ elseif ($fichinterid) */ if ($action == 'presend') { - $ref = dol_sanitizeFileName($fichinter->ref); + $ref = dol_sanitizeFileName($object->ref); $file = $conf->ficheinter->dir_output . '/' . $ref . '/' . $ref . '.pdf'; print '
'; @@ -1129,18 +1129,18 @@ elseif ($fichinterid) $formmail->withcancel=1; // Tableau des substitutions - $formmail->substit['__FICHREF__']=$fichinter->ref; + $formmail->substit['__FICHREF__']=$object->ref; // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='fichinter_send'; - $formmail->param['fichinter_id']=$fichinter->id; - $formmail->param['returnurl']=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$fichinter->id; + $formmail->param['fichinter_id']=$object->id; + $formmail->param['returnurl']=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$object->id; // Init list of files if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init') { $formmail->clear_attached_files(); - $formmail->add_attached_files($file,$fichinter->ref.'.pdf','application/pdf'); + $formmail->add_attached_files($file,$object->ref.'.pdf','application/pdf'); } $formmail->show_form(); @@ -1153,9 +1153,9 @@ elseif ($fichinterid) /* * Built documents */ - $filename=dol_sanitizeFileName($fichinter->ref); - $filedir=$conf->ficheinter->dir_output . "/".$fichinter->ref; - $urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id; + $filename=dol_sanitizeFileName($object->ref); + $filedir=$conf->ficheinter->dir_output . "/".$object->ref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed=$user->rights->ficheinter->creer; $delallowed=$user->rights->ficheinter->supprimer; $genallowed=1; @@ -1164,12 +1164,12 @@ elseif ($fichinterid) $var=true; print "
\n"; - $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fichinter->modelpdf,1,0,0,28,0,'','','',$societe->default_lang); + $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$societe->default_lang); /* * Linked object block */ - $somethingshown=$fichinter->showLinkedObjectBlock(); + $somethingshown=$object->showLinkedObjectBlock(); print ""; print "
"; print " 
\n"; @@ -1178,5 +1178,5 @@ elseif ($fichinterid) $db->close(); -llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.164 $'); +llxFooter('$Date: 2011/07/02 17:14:58 $ - $Revision: 1.165 $'); ?>