diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index e8494022c4c..4507af3d48a 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2006 Laurent Destailleur * * 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 @@ -17,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -27,23 +27,26 @@ \version $Revision$ */ +require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php"); + /** \class Expedition \brief Classe de gestion des expeditions */ -class Expedition +class Expedition extends CommonObject { - var $db ; - var $id ; - var $brouillon; - var $entrepot_id; + var $db; + var $id; + var $brouillon; + var $entrepot_id; - /** - * Initialisation - * - */ - function Expedition($DB) + + /** + * Initialisation + * + */ + function Expedition($DB) { $this->db = $DB; $this->lignes = array(); diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 8ca69379cb1..65d0e6f8c89 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -36,6 +36,7 @@ if (defined("FICHEINTER_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/mod require_once(DOL_DOCUMENT_ROOT ."/includes/modules/ficheinter/".FICHEINTER_ADDON.".php"); } +$langs->load("companies"); $langs->load("interventions"); $user->getrights("ficheinter"); @@ -64,13 +65,13 @@ if ($_GET["action"] == 'valid') { $fichinter = new Fichinter($db); $fichinter->id = $_GET["id"]; - $fichinter->valid($user->id, $conf->fichinter->outputdir); + $fichinter->valid($user->id, $conf->fichinter->outputdir); } if ($_POST["action"] == 'add') { $fichinter = new Fichinter($db); - + $fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["pmonth"], $_POST["pday"], $_POST["pyear"])); $fichinter->socidp = $_POST["socidp"]; $fichinter->duree = $_POST["duree"]; @@ -78,7 +79,7 @@ if ($_POST["action"] == 'add') $fichinter->author = $user->id; $fichinter->note = $_POST["note"]; $fichinter->ref = $_POST["ref"]; - + $id = $fichinter->create(); $_GET["id"]=$id; // Force raffraichissement sur fiche venant d'etre créée } @@ -86,7 +87,7 @@ if ($_POST["action"] == 'add') if ($_POST["action"] == 'update') { $fichinter = new Fichinter($db); - + $fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["remonth"], $_POST["reday"], $_POST["reyear"])); $fichinter->socidp = $_POST["socidp"]; $fichinter->duree = $_POST["duree"]; @@ -94,7 +95,7 @@ if ($_POST["action"] == 'update') $fichinter->author = $user->id; $fichinter->note = $_POST["note"]; $fichinter->ref = $_POST["ref"]; - + $fichinter->update($_POST["id"]); $_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre créée } @@ -111,7 +112,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post { dolibarr_print_error($db,$result); exit; - } + } } @@ -132,102 +133,101 @@ $sel = new Form($db); */ if ($_GET["action"] == 'create') { - print_titre($langs->trans("AddIntervention")); - - // \todo Utiliser un module de numérotation - $numpr = "FI".strftime("%y%m%d", time()); - - $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."propal"; - $sql.= " WHERE ref like '${numpr}%'"; - - $resql=$db->query($sql); - if ($resql) - { - $num = $db->result(0, 0); - $db->free($resql); - if ($num > 0) + print_titre($langs->trans("AddIntervention")); + + // \todo Utiliser un module de numérotation + $numpr = "FI".strftime("%y%m%d", time()); + + $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."propal"; + $sql.= " WHERE ref like '${numpr}%'"; + + $resql=$db->query($sql); + if ($resql) { - $numpr .= "." . ($num + 1); + $num = $db->result(0, 0); + $db->free($resql); + if ($num > 0) + { + $numpr .= "." . ($num + 1); + } } - } - - $fix = new Fichinter($db); - $obj = $conf->global->FICHEINTER_ADDON; + $fix = new Fichinter($db); -// \todo Quand module numerotation fiche inter sera dispo -// $modFicheinter = new $obj; -// $numpr = $modFicheinter->getNextValue($soc); + $obj = $conf->global->FICHEINTER_ADDON; - $numpr = $fix->get_new_num($societe); - - print "
"; - - $smonth = 1; - $syear = date("Y", time()); - print ''; - - print ''; - print ""; - - print ""; - - print ""; - - print "\n"; - print "\n"; - - if ($conf->projet->enabled) - { - // Projet associe - $langs->load("project"); - print ''; + + print ''; + print "'; + + print ''; + print '
".$langs->trans("Company")."".$societe->getNomUrl(1)."
".$langs->trans("Date").""; - $sel->select_date(time(),"p",'','','','fichinter'); - print "
".$langs->trans("Ref")."
".$langs->trans("Duration")." (".$langs->trans("days").")
'.$langs->trans("Project").''; + + print ''; + print ""; + + print ""; + + print ""; + + print "\n"; + print "\n"; + + if ($conf->projet->enabled) { - $i = 0 ; - $numprojet = $db->num_rows($resql); - while ($i < $numprojet) - { - $projet = $db->fetch_object($resql); - print ""; - $i++; - } - $db->free($resql); - } - print ''; - - if ($numprojet==0) - { - print 'Cette société n\'a pas de projet. '; + // Projet associe + $langs->load("project"); + print ''; - - print ''; - print "'; - - print ''; - print '
".$langs->trans("Company")."".$societe->getNomUrl(1)."
".$langs->trans("Date").""; + $sel->select_date(time(),"p",'','','','fichinter'); + print "
".$langs->trans("Ref")."
".$langs->trans("Duration")." (".$langs->trans("days").")
'.$langs->trans("Project").''; + + if ($numprojet==0) + { + print 'Cette société n\'a pas de projet. '; + + $user->getrights("projet"); + + if ($user->rights->projet->creer) + { + print ''.$langs->trans("Add").''; + } + } + } - - } - print '
'.$langs->trans("Description").'"; - print '
'; - print ''; - print '
'; - print ''; - + print '
'.$langs->trans("Description").'"; + print '
'; + print ''; + print '
'; + print ''; } @@ -241,12 +241,11 @@ if ($_GET["action"] == 'edit') { $fichinter = new Fichinter($db); $fichinter->fetch($_GET["id"]); + $fichinter->fetch_client(); dolibarr_fiche_head($head, $a, $langs->trans("EditIntervention")); - /* - * Initialisation de la liste des projets - */ + print "
"; print ""; @@ -254,8 +253,13 @@ if ($_GET["action"] == 'edit') print ''; + // Ref print ''; + // Tiers + print ""; + + // Date print ""; @@ -270,6 +274,7 @@ if ($_GET["action"] == 'edit') print ''; } + // Description print ''; print '
'.$langs->trans("Ref").''.$fichinter->ref.'
".$langs->trans("Company")."".$fichinter->client->getNomUrl(1)."
".$langs->trans("Date").""; $sel->select_date($fichinter->date,'','','','','update'); print "
'.$langs->trans("Description").'