diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 77c028e944f..6df95ead831 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -276,7 +276,7 @@ if ($_POST["action"] == 'addline' && $user->rights->contrat->creer) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - + if($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min))) { $object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ; @@ -351,7 +351,7 @@ if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer && ! $_PO $objectline->date_fin_validite=$date_end_update; $objectline->date_cloture=$date_end_real_update; $objectline->fk_user_cloture=$user->id; - + // TODO verifier price_min si fk_product et multiprix $result=$objectline->update($user); @@ -468,31 +468,31 @@ if ($_GET["action"] == 'create') dol_fiche_head($head, $a, $langs->trans("AddContract"), 0, 'contract'); if ($mesg) print $mesg; - + $soc = new Societe($db); $soc->fetch($socid); - + $object->date_contrat = time(); if ($contratid) $result=$object->fetch($contratid); $numct = $object->getNextNumRef($soc); - + print '
'; print ''; - + print ''; print ''."\n"; print ''; - + print ''; - + // Ref print ''; print ''; - + // Customer print ''; - + // Ligne info remises tiers print ''; - + // Commercial suivi print ''; - + // Commercial signature print ''; - + print '"; - + if ($conf->projet->enabled) { print '"; } - + print ''; - + if (! $user->societe_id) { print ''; } - + print ''; - + print "
'.$langs->trans("Ref").'
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'
'.$langs->trans('Discount').''; if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); @@ -503,33 +503,33 @@ if ($_GET["action"] == 'create') else print $langs->trans("CompanyHasNoAbsoluteDiscount"); print '.'; print '
'.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").''; print $form->select_users(GETPOST("commercial_suivi_id"),'commercial_suivi_id',1,''); print '
'.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").''; print $form->select_users(GETPOST("commercial_signature_id"),'commercial_signature_id',1,''); print '
'.$langs->trans("Date").''; $form->select_date($datecontrat,'',0,0,'',"contrat"); print "
'.$langs->trans("Project").''; select_projects($soc->id,GETPOST("projectid"),"projectid"); print "
'.$langs->trans("NotePublic").''; print '
'.$langs->trans("NotePrivate").''; @@ -537,83 +537,12 @@ if ($_GET["action"] == 'create') print GETPOST("note"); print '
\n"; print "
\n"; -// TODO A quoi ca sert ? -/* - if ($propalid) - { - print '
'; - print_titre($langs->trans("Products")); - - print ''; - print ''; - print ''; - print ''; - 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"; - $sql.= ", ".MAIN_DB_PREFIX."product as p"; - $sql.= " WHERE pt.fk_product = p.rowid"; - $sql.= " AND pt.fk_propal = ".$propalid; - $sql .= " ORDER BY pt.rowid ASC"; - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print "\n"; - print ''; - print "'; - print ''; - print ''; - print "\n"; - $i++; - } - } - $sql = "SELECT pt.rowid, pt.description as product, pt.price, pt.qty, pt.remise_percent"; - $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pt"; - $sql.= " WHERE pt.fk_propal = ".$propalid; - $sql.= " AND pt.fk_product = 0"; - $sql.= " ORDER BY pt.rowid ASC"; - $result=$db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print "\n"; - print ''; - print ''; - print ''; - print ''; - print "\n"; - $i++; - } - } - else - { - dol_print_error($db); - } - - print '
'.$langs->trans("Ref").''.$langs->trans("Product").''.$langs->trans("Price").''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'
[$objp->ref]'.$objp->product.'".price($objp->price).''.$objp->qty.''.$objp->remise_percent.'%
 '.$objp->product.''.price($objp->price).''.$objp->remise_percent.'%'.$objp->qty.'
'; - } -*/ - print ''; } else @@ -770,6 +699,7 @@ else /* * Lines of contracts */ + $productstatic=new Product($db); // Title line for service print ''; // Array with (n*2)+1 lines @@ -790,7 +720,7 @@ else $sql.= " cd.date_ouverture_prevue as date_debut, cd.date_ouverture as date_debut_reelle,"; $sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,"; $sql.= " cd.commentaire as comment,"; - $sql.= " p.ref, p.label"; + $sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; $sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id; @@ -822,9 +752,11 @@ else if ($objp->fk_product > 0) { print ''; } @@ -918,9 +850,11 @@ else print ''; $param='&search_contract='.$search_contract; $param.='&search_nom='.$search_nom; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'width="50"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.statut","","$param",'align="center"',$sortfield,$sortorder); @@ -134,8 +134,8 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; - print ""; - print "'; + print ''; diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index dfa6abf5db2..dac554e00c4 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -74,7 +74,7 @@ llxHeader(); $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,"; $sql.= " s.rowid as socid, s.nom,"; $sql.= " cd.rowid, cd.description, cd.statut,"; -$sql.= " p.rowid as pid, p.label as label, p.fk_product_type as ptype,"; +$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,"; $sql.= " cd.date_ouverture_prevue,"; $sql.= " cd.date_ouverture,"; @@ -188,7 +188,7 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; - print ""; + print ""; print '
'; - print ''; - print img_object($langs->trans("ShowService"),"service").' '.$objp->ref.''; - print $objp->label?' - '.$objp->label:''; + $productstatic->id=$objp->fk_product; + $productstatic->type=$objp->ptype; + $productstatic->ref=$objp->pref; + print $productstatic->getNomUrl(1,'',20); + print $objp->label?' - '.dol_trunc($objp->label,16):''; if ($objp->description) print '
'.nl2br($objp->description); print '
'; if ($objp->fk_product) { - print ''; - print img_object($langs->trans("ShowService"),"service").' '.$objp->ref.''; - print $objp->label?' - '.$objp->label:''; + $productstatic->id=$objp->fk_product; + $productstatic->type=$objp->ptype; + $productstatic->ref=$objp->pref; + print $productstatic->getNomUrl(1,'',20); + print $objp->label?' - '.dol_trunc($objp->label,16):''; print '
'; } else diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/liste.php index 0966858a014..e23d4b9206b 100644 --- a/htdocs/contrat/liste.php +++ b/htdocs/contrat/liste.php @@ -102,8 +102,8 @@ if ($resql) print '
cid\">"; + print '
'; print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .''; if ($obj->nb_late) print img_warning($langs->trans("Late")); print '
'; $contractstatic->id=$obj->cid; $contractstatic->ref=$obj->ref?$obj->ref:$obj->cid; @@ -197,12 +197,13 @@ if ($resql) // Service print ''; - if ($obj->pid) + if ($obj->pid) { $productstatic->id=$obj->pid; $productstatic->type=$obj->ptype; - $productstatic->ref=$obj-label?$obj->label:$obj->pid; + $productstatic->ref=$obj->pref; print $productstatic->getNomUrl(1,'',20); + print $obj->label?' - '.dol_trunc($obj->label,16):''; } else {