diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 5f040fe464b..b09c3a4698a 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -29,7 +29,8 @@ */ -/** \class Contrat +/** + \class Contrat \brief Classe permettant la gestion des contrats */ @@ -158,47 +159,50 @@ class Contrat /** * \brief Charge de la base les données du contrat * \param id id du contrat à charger + * \return int <0 si KO, >0 si OK */ function fetch ($id) { - $sql = "SELECT rowid, statut, fk_soc, ".$this->db->pdate("mise_en_service")." as datemise"; - $sql .= ", fk_user_mise_en_service, ".$this->db->pdate("date_contrat")." as datecontrat"; - $sql .= " , fk_user_author"; - $sql .= ", fk_commercial_signature, fk_commercial_suivi "; - $sql .= " FROM ".MAIN_DB_PREFIX."contrat WHERE rowid = $id"; + $sql = "SELECT rowid, statut, fk_soc, ".$this->db->pdate("mise_en_service")." as datemise"; + $sql .= ", fk_user_mise_en_service, ".$this->db->pdate("date_contrat")." as datecontrat"; + $sql .= " , fk_user_author"; + $sql .= ", fk_commercial_signature, fk_commercial_suivi "; + $sql .= " FROM ".MAIN_DB_PREFIX."contrat WHERE rowid = $id"; + + $resql = $this->db->query($sql) ; + + if ($resql) + { + $result = $this->db->fetch_array($resql); + + $this->id = $result["rowid"]; + $this->statut = $result["statut"]; + $this->factureid = $result["fk_facture"]; + $this->facturedetid = $result["fk_facturedet"]; + $this->mise_en_service = $result["datemise"]; + $this->date_fin_validite = $result["datefin"]; + $this->date_contrat = $result["datecontrat"]; + + $this->user_author_id = $result["fk_user_author"]; + + $this->commercial_signature_id = $result["fk_commercial_signature"]; + $this->commercial_suivi_id = $result["fk_commercial_suivi"]; + + $this->user_service->id = $result["fk_user_mise_en_service"]; + $this->user_cloture->id = $result["fk_user_cloture"]; + + $this->societe->fetch($result["fk_soc"]); + + $this->db->free($resql); + + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } - $result = $this->db->query($sql) ; - - if ( $result ) - { - $result = $this->db->fetch_array(); - - $this->id = $result["rowid"]; - $this->statut = $result["statut"]; - $this->factureid = $result["fk_facture"]; - $this->facturedetid = $result["fk_facturedet"]; - $this->mise_en_service = $result["datemise"]; - $this->date_fin_validite = $result["datefin"]; - $this->date_contrat = $result["datecontrat"]; - - $this->user_author_id = $result["fk_user_author"]; - - $this->commercial_signature_id = $result["fk_commercial_signature"]; - $this->commercial_suivi_id = $result["fk_commercial_suivi"]; - - $this->user_service->id = $result["fk_user_mise_en_service"]; - $this->user_cloture->id = $result["fk_user_cloture"]; - - $this->societe->fetch($result["fk_soc"]); - - $this->db->free(); - } - else - { - dolibarr_print_error($this->db); - } - - return $result; } /** @@ -282,58 +286,63 @@ class Contrat /** * \brief Ajoute une ligne de commande - * + * \return int <0 si KO, =0 si OK */ function addline($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0) { + global $langs; + $qty = ereg_replace(",",".",$qty); $pu = ereg_replace(",",".",$pu); - if (strlen(trim($desc))) - { - if (strlen(trim($qty))==0) - { - $qty=1; - } - - if ($fk_product > 0) - { - $prod = new Product($this->db, $fk_product); - if ($prod->fetch($fk_product) > 0) - { - $label = $prod->libelle; - $pu = $prod->price; - $txtva = $prod->tva_tx; - } - } - - - $remise = 0; - $price = round(ereg_replace(",",".",$pu), 2); - $subprice = $price; - if (trim(strlen($remise_percent)) > 0) - { - $remise = round(($pu * $remise_percent / 100), 2); - $price = $pu - $remise; - } - - // Insertion dans la base - $sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet "; - $sql .= "(fk_contrat,label,description,fk_product, price_ht,qty,tva_tx, remise_percent, subprice, remise)"; - $sql .= " VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',$fk_product,".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."') ;"; - - // Retour - if ( $this->db->query( $sql) ) - { - //$this->update_price(); - return 0; - } - else - { - dolibarr_print_error($this->db); - return -1; - } - } + if (! trim($desc)) + { + $this->error=$langs->trans("ErrorDescRequired"); + return -1; + } + + if (strlen(trim($qty))==0) + { + $qty=1; + } + + if ($fk_product > 0) + { + $prod = new Product($this->db, $fk_product); + if ($prod->fetch($fk_product) > 0) + { + $label = $prod->libelle; + $pu = $prod->price; + $txtva = $prod->tva_tx; + } + } + + + $remise = 0; + $price = round(ereg_replace(",",".",$pu), 2); + $subprice = $price; + if (trim(strlen($remise_percent)) > 0) + { + $remise = round(($pu * $remise_percent / 100), 2); + $price = $pu - $remise; + } + + // Insertion dans la base + $sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet "; + $sql .= "(fk_contrat,label,description,fk_product, price_ht,qty,tva_tx, remise_percent, subprice, remise)"; + $sql .= " VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',$fk_product,".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."') ;"; + + // Retour + if ( $this->db->query( $sql) ) + { + //$this->update_price(); + return 0; + } + else + { + dolibarr_print_error($this->db); + return -1; + } } /** diff --git a/htdocs/contrat/enservice.php b/htdocs/contrat/enservice.php index bd7210162b3..5d2df9eec15 100644 --- a/htdocs/contrat/enservice.php +++ b/htdocs/contrat/enservice.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 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 @@ -21,7 +21,7 @@ * */ -/*! +/** \file htdocs/contrat/enservice.php \ingroup contrat \brief Page liste des contrats en service @@ -57,18 +57,12 @@ if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; -if ($sortfield == "") -{ - $sortfield="cd.date_ouverture"; -} +if (! $sortfield) $sortfield="cd.date_ouverture"; +if (! $sortorder) $sortorder="DESC"; -if ($sortorder == "") -{ - $sortorder="DESC"; -} -$sql = "SELECT s.nom, c.rowid as cid, p.rowid as pid, s.idp as sidp, cd.label, cd.statut"; -$sql .= " ,".$db->pdate("cd.date_ouverture")." as date_ouverture"; +$sql = "SELECT s.nom, c.rowid as cid, s.idp as sidp, cd.rowid, cd.label, cd.statut, p.rowid as pid,"; +$sql .= " ".$db->pdate("cd.date_ouverture")." as date_ouverture"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql .= " , ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product as p"; $sql .= " , ".MAIN_DB_PREFIX."contratdet as cd"; @@ -81,40 +75,41 @@ if ($socid > 0) $sql .= " ORDER BY $sortfield $sortorder"; $sql .= $db->plimit($limit + 1 ,$offset); -if ( $db->query($sql) ) +$resql=$db->query($sql); +if ($resql) { - $num = $db->num_rows(); + $num = $db->num_rows($resql); $i = 0; - print_barre_liste("Liste des contrats en service", $page, "enservice.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("ListOfRunningContractsLines"), $page, "enservice.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); print ''; print ''; print_liste_field_titre($langs->trans("Ref"),"enservice.php", "c.rowid","","","",$sortfield); - print_liste_field_titre($langs->trans("Label"),"enservice.php", "p.label","","","",$sortfield); + print_liste_field_titre($langs->trans("Status"),"enservice.php", "cd.statut","","","",$sortfield); + print_liste_field_titre($langs->trans("Service"),"enservice.php", "p.label","","","",$sortfield); print_liste_field_titre($langs->trans("Company"),"enservice.php", "s.nom","","","",$sortfield); - print ''; + print_liste_field_titre($langs->trans("Date"),"enservice.php", "cd.date_ouverture",'','',' align="center"',$sortfield); print "\n"; $now=mktime(); $var=True; while ($i < min($num,$limit)) { - $obj = $db->fetch_object(); + $obj = $db->fetch_object($resql); $var=!$var; print ""; - print "\n"; - print "\n"; - print "\n"; - print '\n"; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; $i++; } - $db->free(); + $db->free($resql); print "
Date mise en service
cid\">"; - print 'statut'; - print " cid\">$obj->cidpid\">$obj->labelsidp\">$obj->nom'.strftime("%d/%m/%y",$obj->date_ouverture)."'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'statut'.img_object($langs->trans("ShowService"),"service").' '.$obj->label.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''.dolibarr_print_date($obj->date_ouverture).'
"; @@ -127,5 +122,5 @@ else $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 269f7059b88..6f37be536c4 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 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 @@ -21,9 +21,10 @@ * */ -/*! \file htdocs/commande/fiche.php - \ingroup commande - \brief Fiche commande +/** + \file htdocs/contrat/fiche.php + \ingroup contrat + \brief Fiche contrat \version $Revision$ */ @@ -50,8 +51,10 @@ if ($user->societe_id > 0) $action = ''; $socidp = $user->societe_id; } + + /* - * + * Actions */ if ($_POST["action"] == 'add') { @@ -96,25 +99,29 @@ if ($_POST["action"] == 'classin') * */ -if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer) +if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer) { - $result = 0; - $contrat = new Contrat($db); - $contrat->fetch($_GET["id"]); - - if ($_POST["p_idprod"] > 0) + $result = 0; + $contrat = new Contrat($db); + $result=$contrat->fetch($_GET["id"]); + if ($_POST["p_idprod"] > 0) { - $result = $contrat->addline($_POST["desc"], - $_POST["pu"], - $_POST["pqty"], - $_POST["tva_tx"], - $_POST["p_idprod"], - $_POST["premise"]); + //print $_POST["desc"]." - ".$_POST["pu"]." - ".$_POST["pqty"]." - ".$_POST["tva_tx"]." - ".$_POST["p_idprod"]." - ".$_POST["premise"]; exit; + $result = $contrat->addline($_POST["desc"], + $_POST["pu"], + $_POST["pqty"], + $_POST["tva_tx"], + $_POST["p_idprod"], + $_POST["premise"]); } - - if ($result == 0) - { - Header("Location: fiche.php?id=".$contrat->id); + + if ($result >= 0) + { + Header("Location: fiche.php?id=".$contrat->id); + } + else + { + $mesg='
'.$contrat->error.'
'; } } @@ -192,16 +199,18 @@ llxHeader('',$langs->trans("OrderCard"),"Commande"); $html = new Form($db); + /********************************************************************* * * Mode creation * * - * ************************************************************************/ if ($_GET["action"] == 'create') { - dolibarr_fiche_head($head, $a, "Création d'un nouveau contrat"); + dolibarr_fiche_head($head, $a, $langs->trans("AddContract")); + + if ($mesg) print $mesg; $new_contrat = new Contrat($db); @@ -225,13 +234,13 @@ if ($_GET["action"] == 'create') print '' ."\n"; print ''; - print ''; + print '
'; - print ''; + print ''; print '"; - print '"; - + if ($conf->projet->enabled) + { + print '"; + } + /* - * * * Liste des elements * @@ -304,26 +315,26 @@ if ($_GET["action"] == 'create') print '
'.$langs->trans("Customer").' :'.$obj->nom.'
'.$langs->trans("Customer").' :'.$obj->nom.'
'.$langs->trans("Commercial").''; - print ''; $sql = "SELECT rowid, name, firstname FROM ".MAIN_DB_PREFIX."user ORDER BY name "; if ( $db->query( $sql) ) { @@ -255,13 +264,15 @@ if ($_GET["action"] == 'create') $html->select_date(); print "
'.$langs->trans("Project").' :'; - $proj = new Project($db); - $html->select_array("projetid",$proj->liste_array($soc->id),0,1); - print "
'.$langs->trans("Project").' :'; + $proj = new Project($db); + $html->select_array("projetid",$proj->liste_array($soc->id),0,1); + print "
'; print ''; */ - print 'Commentaires'; + print ''.$langs->trans("Comment").''; print ''; /* * */ - print ''; + print ''; print "\n"; - print "\n"; + print "
\n"; if ($propalid) { /* * Produits */ - print_titre("Produits"); + print_titre($langs->trans("Products")); - print ''; - print ''; - print ''; + print '
'.$langs->trans("Ref").'Produit'.$langs->trans("Price").'RemiseQté.
'; + print ''; + print ''; $sql = "SELECT pt.rowid, p.label as product, p.ref, pt.price, pt.qty, p.rowid as prodid, pt.remise_percent"; $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt, ".MAIN_DB_PREFIX."product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid"; @@ -340,7 +351,7 @@ if ($_GET["action"] == 'create') $var=!$var; print "\n"; print ''; - print ""; + print ""; print ''; print "\n"; $i++; @@ -367,7 +378,7 @@ if ($_GET["action"] == 'create') } else { - print $sql; + dolibarr_print_error($db); } print '
'.$langs->trans("Ref").''.$langs->trans("Product").''.$langs->trans("Price").''.$langs->trans("Discount").''.$langs->trans("Qty").'
[$objp->ref]'.$objp->product.'".price($objp->price)."".price($objp->price)."'.$objp->remise_percent.' %".$objp->qty."
'; @@ -376,7 +387,7 @@ if ($_GET["action"] == 'create') } else { - print $db->error() . "
$sql";; + dolibarr_print_error($db); } } else @@ -393,6 +404,8 @@ else if ( $contrat->fetch($id) > 0) { + if ($mesg) print $mesg; + $author = new User($db); $author->id = $contrat->user_author_id; $author->fetch(); @@ -407,13 +420,13 @@ else $h = 0; $head[$h][0] = DOL_URL_ROOT.'/contrat/fiche.php?id='.$contrat->id; - $head[$h][1] = $langs->trans("Contract"); + $head[$h][1] = $langs->trans("ContractCard"); $hselected = $h; $h++; + dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").': '.$contrat->id); - dolibarr_fiche_head($head, $hselected, $contrat->societe->nom); /* * Confirmation de la suppression de la contrat @@ -445,39 +458,43 @@ else /* * Contrat */ + if ($contrat->brouillon == 1 && $user->rights->contrat->creer) { print '
'; print ''; } - print ''; + print '
'; print ""; - print ''; + print ''; - print '"; print ''; - print "\n"; + print '\n"; - print '"; - - print ''; - print ''; + if ($conf->projet->enabled) + { + print '"; + } + + print ''; + print ''; print "
".$langs->trans("Customer")."'; - print ''.$contrat->societe->nom.''; + print ''.$contrat->societe->nom.'
'; + print '
'.$langs->trans("Status").''; print $contrat->statuts[$contrat->statut]; print "
'.$langs->trans("Date").'".strftime("%A %d %B %Y",$contrat->date_contrat)."'.strftime("%A %d %B %Y",$contrat->date_contrat)."
Projet'; - if ($contrat->projet_id > 0) - { - $projet = New Project($db); - $projet->fetch($contrat->projet_id); - print ''.$projet->title.''; - } - else - { - print 'Classer le contrat'; - } - print " 
'.$langs->trans("Commercial suivi").''.$commercial_suivi->fullname.''.$langs->trans("Commercial signature").''.$commercial_signature->fullname.'
'.$langs->trans("Project").''; + if ($contrat->projet_id > 0) + { + $projet = New Project($db); + $projet->fetch($contrat->projet_id); + print ''.$projet->title.''; + } + else + { + print 'Classer le contrat'; + } + print "
'.$langs->trans("Commercial suivi").''.$commercial_suivi->fullname.''.$langs->trans("Commercial signature").''.$commercial_signature->fullname.'
"; if ($contrat->brouillon == 1 && $user->rights->contrat->creer) @@ -489,7 +506,7 @@ else * Lignes de contrats * */ - echo '
'; + echo '
'; $sql = "SELECT l.statut, l.label, l.fk_product, l.description, l.price_ht, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; $sql .= " FROM ".MAIN_DB_PREFIX."contratdet as l"; @@ -506,25 +523,29 @@ else if ($num) { print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } $var=True; while ($i < $num) { $objp = $db->fetch_object(); + + $var=!$var; print "\n"; if ($objp->fk_product > 0) { print '\n"; + print "\n"; } - print ''; - print ''; + print ''; + print ''; if ($objp->remise_percent > 0) { print '\n"; @@ -563,6 +584,7 @@ else print ''; } print "\n"; + if ($_GET["action"] == 'editline' && $_GET["rowid"] == $objp->rowid) { @@ -570,8 +592,9 @@ else print ''; print ''; print ""; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -579,14 +602,14 @@ else print "\n"; } $i++; - $var=!$var; } $db->free(); } else { - print $db->error(); + dolibarr_print_error($db); } + /* * Ajouter une ligne produit/service @@ -615,21 +638,22 @@ else } else { - print $db->error(); + dolibarr_print_error($db); } print ''; print ''; + print ''; print ""; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''."\n"; - /* print "".''; print '"; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; print "\n"; - print "".''; + print ""; + print ''; + print ''; + print ''; print ""; } @@ -673,9 +701,8 @@ else if ($contrat->statut > 0 && $contrat->statut < 3 && $user->rights->expedition->creer) { - print 'Expédier'; + print ''.$langs->trans("Send").''; } - if ($contrat->statut == 0) { diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index a4d3731807b..b33e9f8b96d 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 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 @@ -21,8 +21,8 @@ * */ -/*! - \file htdocs/contrat/contrat.class.php +/** + \file htdocs/contrat/index.php \ingroup contrat \brief Page liste des contrats \version $Revision$ @@ -53,11 +53,16 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -print_barre_liste("Contrats", $page, "index.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); +print_barre_liste($langs->trans("ContractsArea"), $page, "index.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); -print '
'.$langs->trans("Description").'TvaQuantitéRemiseP.U.  '.$langs->trans("Status").''.$langs->trans("Service").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  
'; print '';; - print 'statut '; - print ''.stripslashes(nl2br($objp->label)).''; + print 'statut'; + print ''; + print img_object($langs->trans("ShowProduct"),"product").' '.$objp->label.''; if ($objp->description) { @@ -536,10 +557,10 @@ else } else { - print "".stripslashes(nl2br($objp->description))."".stripslashes(nl2br($objp->description))."'.$objp->tva_tx.' %'.$objp->qty.''.$objp->tva_tx.' %'.$objp->qty.''.$objp->remise_percent." % 
  %
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").'RemiseP.U. '.$langs->trans("Service").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  
'; @@ -644,13 +668,17 @@ else $var=!$var; print "
  %% 
 
'; -print '
Légende
'; +print ''; + + +print '"; + + print "'; + print ''; + print "\n"; + $i++; + } + $db->free(); + + print "
'; + +// Légende +print 'Légende
'; print 'statut Statut initial
'; print 'statut A commander
'; print 'statut Commandé chez le fournisseur
'; @@ -66,6 +71,7 @@ print 'statut Activ print '
'; +// Not activated services $sql = "SELECT cd.rowid as cid, cd.statut, cd.label, cd.fk_contrat "; $sql .= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql .= " WHERE cd.statut IN (0,3)"; @@ -73,38 +79,80 @@ $sql .= " ORDER BY cd.tms DESC"; if ( $db->query($sql) ) { - $num = $db->num_rows(); - $i = 0; - - print ''; - - print ''; - print "\n"; - - $var=True; - while ($i < $num) - { - $obj = $db->fetch_object(); - $var=!$var; - print ""; - - print "\n"; - + $num = $db->num_rows(); + $i = 0; + print '
Service
"; - print 'statut '; - print " fk_contrat\">$obj->label
'; + print ''; print "\n"; - $i++; - } - $db->free(); - print "
'.$langs->trans("NotActivatedServices").'
"; + $var=True; + while ($i < $num) + { + $obj = $db->fetch_object(); + $var=!$var; + print "
"; + print 'statut'; + print ' '.$obj->label.''.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'
"; } else { - dolibarr_print_error($db); + dolibarr_print_error($db); +} + +print '
'; + +// Last activated services +$max=10; + +$sql = "SELECT cd.rowid as cid, cd.statut, cd.label, cd.fk_contrat "; +$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; +$sql .= " WHERE cd.statut = 4"; +$sql .= " ORDER BY cd.tms DESC"; + +if ( $db->query($sql) ) +{ + $num = $db->num_rows(); + $i = 0; + + print ''; + + print ''; + print "\n"; + + $var=True; + while ($i < min($num,$max)) + { + $obj = $db->fetch_object(); + $var=!$var; + print ""; + + print "\n"; + print ''; + print "\n"; + $i++; + } + $db->free(); + + print "
'.$langs->trans("LastActivatedServices",min($num,$max)).'
"; + print 'statut '; + print " fk_contrat\">$obj->label'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'
"; + +} +else +{ + dolibarr_print_error($db); } print '
'; diff --git a/htdocs/contrat/ligne.php b/htdocs/contrat/ligne.php index f0e3c9aaaa5..caad55c66b3 100644 --- a/htdocs/contrat/ligne.php +++ b/htdocs/contrat/ligne.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 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 @@ -21,9 +21,10 @@ * */ -/*! \file htdocs/commande/fiche.php - \ingroup commande - \brief Fiche commande +/** + \file htdocs/contrat/fiche.php + \ingroup contrat + \brief Fiche contrat \version $Revision$ */ @@ -134,11 +135,11 @@ $html = new Form($db); $head[$h][1] = $langs->trans("Contract"); $h++; - $head[$h][0] = DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id; - $head[$h][1] = $langs->trans("Edition de la ligne"); + $head[$h][0] = DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id."&ligne=".$_GET["ligne"]; + $head[$h][1] = $langs->trans($langs->trans("EditServiceLine")); $hselected = $h; - dolibarr_fiche_head($head, $hselected, $contrat->societe->nom); + dolibarr_fiche_head($head, $hselected, $langs->trans("Contract").': '.$contrat->id); @@ -146,37 +147,38 @@ $html = new Form($db); * Contrat */ - - print ''; + print '
'; print ""; - print ''; + print ''; - print '"; print ''; - print "\n"; + print '\n"; - print '"; + if ($conf->projet->enabled) + { + print '"; + } - print ''; - print ''; + print ''; + print ''; print "
".$langs->trans("Customer")."'; - print ''.$contrat->societe->nom.''; + print ''.$contrat->societe->nom.'
'; + print '
'.$langs->trans("Status").''; print $contrat->statuts[$contrat->statut]; print "
'.$langs->trans("Date").'".strftime("%A %d %B %Y",$contrat->date_contrat)."'.strftime("%A %d %B %Y",$contrat->date_contrat)."
Projet'; - if ($contrat->projet_id > 0) - { - $projet = New Project($db); - $projet->fetch($contrat->projet_id); - print ''.$projet->title.''; - } - else - { - print 'Classer le contrat'; - } - print " 
'.$langs->trans("Project").''; + if ($contrat->projet_id > 0) + { + $projet = New Project($db); + $projet->fetch($contrat->projet_id); + print ''.$projet->title.''; + } + else + { + print 'Classer le contrat'; + } + print "
'.$langs->trans("Commercial suivi").''.$commercial_suivi->fullname.''.$langs->trans("Commercial signature").''.$commercial_signature->fullname.'
'.$langs->trans("Commercial suivi").''.$commercial_suivi->fullname.''.$langs->trans("Commercial signature").''.$commercial_signature->fullname.'
"; - /* * Confirmation de la validation @@ -189,13 +191,12 @@ $html = new Form($db); $html->form_confirm("ligne.php?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateact,"Activer le service","Etes-vous sûr de vouloir activer ce service en date du ".strftime("%A %d %B %Y", $dateact)." ?","confirm_active"); } - /* * Lignes de contrats * */ - echo '
'; + print '
'; $sql = "SELECT l.statut, l.label, l.fk_product, l.description, l.price_ht, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; $sql .= " FROM ".MAIN_DB_PREFIX."contratdet as l"; @@ -213,24 +214,26 @@ $html = new Form($db); if ($num) { print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } $var=True; while ($i < $num) { $objp = $db->fetch_object(); + + $var=!$var; print "\n"; if ($objp->fk_product > 0) { - print ''; + print '\n"; + print '\n"; } - print ''; - print ''; + print ''; + print ''; if ($objp->remise_percent > 0) { print '\n"; @@ -261,23 +264,17 @@ $html = new Form($db); $i++; - $var=!$var; } $db->free(); } else { - print $db->error(); + dolibarr_print_error($db); } - + print '
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").'P.U.  '.$langs->trans("Status").''.$langs->trans("Service").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  
'; - print 'statut '; - print ''.stripslashes(nl2br($objp->label)).''; + print 'statut'.img_object($langs->trans("ShowService"),"service").' '.$objp->label.''; if ($objp->description) { @@ -241,10 +244,10 @@ $html = new Form($db); } else { - print "".stripslashes(nl2br($objp->description))." '.stripslashes(nl2br($objp->description))."'.$objp->tva_tx.' %'.$objp->qty.''.$objp->tva_tx.' %'.$objp->qty.''.$objp->remise_percent." %

'; print ''; - - print "

\n"; - - - if ( $user->rights->contrat->activer && $contrat->statut == 0 && $objp->statut <> 4) { /** @@ -285,12 +282,12 @@ $html = new Form($db); */ $form = new Form($db); - print '
'; + print '
'; print '
'; - print ''; - print '
Activer le service'; - print '
Date d\'activation'; + print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; print '
'.$langs->trans("ActivateService").''; + print '
'.$langs->trans("DateServiceActivate").''; if ($_POST["remonth"]) { @@ -304,16 +301,14 @@ $html = new Form($db); print $form->select_date($dateact); print '
Intervenant'.$user->fullname.'
'.$langs->trans("User").''.$user->fullname.'
Commentaire
'.$langs->trans("Comment").'
'; - print '
'; - - print ' 
'; + print '
'; } } else @@ -325,5 +320,5 @@ $html = new Form($db); $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/liste.php index 6a17da938d3..4d6c0da963b 100644 --- a/htdocs/contrat/liste.php +++ b/htdocs/contrat/liste.php @@ -21,7 +21,8 @@ * */ -/** \file htdocs/contrat/contrat.class.php +/** + \file htdocs/contrat/liste.php \ingroup contrat \brief Page liste des contrats \version $Revision$ @@ -29,6 +30,7 @@ require("./pre.inc.php"); +$langs->load("contracts"); $langs->load("products"); $langs->load("companies"); @@ -38,10 +40,16 @@ llxHeader(); $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; $statut=isset($_GET["statut"])?$_GET["statut"]:1; $socid=$_GET["socid"]; +if (! $sortfield) $sortfield="c.rowid"; +if (! $sortorder) $sortorder="DESC"; + /* * Sécurité accés client @@ -53,21 +61,6 @@ if ($user->societe_id > 0) } -if ($page == -1) { $page = 0 ; } - -$limit = $conf->liste_limit; -$offset = $limit * $page ; - -if ($sortfield == "") -{ - $sortfield="c.rowid"; -} - -if ($sortorder == "") -{ - $sortorder="DESC"; -} - $sql = "SELECT c.rowid as cid, c.statut, ".$db->pdate("c.fin_validite")." as fin_validite, c.fin_validite-sysdate() as delairestant, s.nom, s.idp as sidp"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; @@ -88,7 +81,7 @@ if ( $db->query($sql) ) $i = 0; - print_barre_liste("Liste des contrats", $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); print ''; @@ -105,9 +98,8 @@ if ( $db->query($sql) ) $var=!$var; print ""; print "\n"; - print "\n"; + print img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.''; + print ''; print "\n"; $i++; diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index cf0cc98fb3d..a82d3e3e7f8 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -1,5 +1,9 @@ # Dolibarr language file - en_US - contracts +ContractsArea=Contrats area +ListOfContracts=List of contracts +ListOfRunningContracts=List of contracts (Running) LastContracts=Last %s modifed contracts +ContractCard=Contract card ContractStatus=Contract status ContractStatusNotRunning=Not running ContractStatusRunning=Running @@ -8,4 +12,13 @@ Contracts=Contracts Contract=Contract NewContract=New contract AddContract=Add contract -SearchAContract=Search a contract \ No newline at end of file +SearchAContract=Search a contract +ActivateService=Activate service +DateServiceActivate=Date of service activation +DateServiceStart=Date for beginning of service +DateServiceEnd=Date for end of service +ShowContract=Show contract +ListOfRunningContractsLines=List of running contract lines +NotActivatedServices=Not activated services +LastActivatedServices=Last %s activated services +EditServiceLine=Edit service line \ No newline at end of file diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang index fe686ecdcd2..5244346b73e 100644 --- a/htdocs/langs/fr_FR/contracts.lang +++ b/htdocs/langs/fr_FR/contracts.lang @@ -1,5 +1,8 @@ # Dolibarr language file - fr_FR - contracts +ContractsArea=Espace contrats +ListOfContracts=Liste des contrats LastContracts=Les %s derniers contrats modifiés +ContractCard=Fiche contrat ContractStatus=État du contrat ContractStatusNotRunning=Hors service ContractStatusRunning=En service @@ -9,3 +12,12 @@ Contract=Contrat NewContract=Nouveau contrat AddContract=Créer contrat SearchAContract=Rechercher un contrat +ActivateService=Activer le service +DateServiceActivate=Date activation du service +DateServiceStart=Date début du service +DateServiceEnd=Date fin du service +ShowContract=Afficher contrat +ListOfRunningContractsLines=Liste des lignes de contrats en service +NotActivatedServices=Services non activés +LastActivatedServices=Les %s derniers services activés +EditServiceLine=Edition ligne du service \ No newline at end of file
cid\">"; - print img_file(); - print " cid\">$obj->cidsidp\">$obj->nomsidp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'