149 |
} |
} |
150 |
} |
} |
151 |
|
|
152 |
if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer) |
if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer && $_POST["save"]) |
153 |
{ |
{ |
154 |
$contrat = new Contrat($db,"",$_GET["id"]); |
$contrat = new Contrat($db,"",$_GET["id"]); |
155 |
if ($contrat->fetch($_GET["id"])) |
if ($contrat->fetch($_GET["id"])) |
179 |
} |
} |
180 |
} |
} |
181 |
|
|
182 |
|
if ($_POST["action"] == 'updateligne' && $user->rights->contrat->creer && $_POST["cancel"]) |
183 |
|
{ |
184 |
|
Header("Location: fiche.php?id=".$_GET["id"]); |
185 |
|
} |
186 |
|
|
187 |
if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer) |
if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer) |
188 |
{ |
{ |
189 |
$contrat = new Contrat($db); |
$contrat = new Contrat($db); |
600 |
*/ |
*/ |
601 |
echo '<br><table class="noborder" width="100%">'; |
echo '<br><table class="noborder" width="100%">'; |
602 |
|
|
603 |
$sql = "SELECT cd.statut, cd.label, cd.fk_product, cd.description, cd.price_ht, cd.qty, cd.rowid, cd.tva_tx, cd.remise_percent, cd.subprice,"; |
$sql = "SELECT cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty, cd.rowid, cd.tva_tx, cd.remise_percent, cd.subprice,"; |
604 |
$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_debut, ".$db->pdate("cd.date_ouverture")." as date_debut_reelle,"; |
$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_debut, ".$db->pdate("cd.date_ouverture")." as date_debut_reelle,"; |
605 |
$sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin, ".$db->pdate("cd.date_cloture")." as date_fin_reelle"; |
$sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin, ".$db->pdate("cd.date_cloture")." as date_fin_reelle,"; |
606 |
|
$sql.= " p.ref, p.label"; |
607 |
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; |
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; |
608 |
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; |
609 |
$sql.= " WHERE cd.fk_contrat = ".$id; |
$sql.= " WHERE cd.fk_contrat = ".$id; |
610 |
$sql.= " ORDER BY cd .rowid"; |
$sql.= " ORDER BY cd .rowid"; |
611 |
|
|
642 |
{ |
{ |
643 |
print '<td>'; |
print '<td>'; |
644 |
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; |
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; |
645 |
print img_object($langs->trans("ShowService"),"service").' '.$objp->label.'</a>'; |
print img_object($langs->trans("ShowService"),"service").' '.$objp->ref.'</a>'; |
646 |
|
print $objp->label?' - '.$objp->label:''; |
647 |
if ($objp->description) print '<br />'.stripslashes(nl2br($objp->description)); |
if ($objp->description) print '<br />'.stripslashes(nl2br($objp->description)); |
648 |
print '</td>'; |
print '</td>'; |
649 |
} |
} |
748 |
// Ligne carac |
// Ligne carac |
749 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
750 |
print '<td>'; |
print '<td>'; |
751 |
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; |
if ($objp->fk_product) |
752 |
if ($objp->label) |
{ |
753 |
|
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; |
754 |
|
print img_object($langs->trans("ShowService"),"service").' '.$objp->ref.'</a>'; |
755 |
|
print $objp->label?' - '.$objp->label:''; |
756 |
|
print '</br>'; |
757 |
|
} |
758 |
|
else |
759 |
{ |
{ |
760 |
print img_object($langs->trans("ShowService"),"service").' '.$objp->label.'</a><br>'; |
print $objp->label?$objp->label.'<br>':''; |
761 |
} |
} |
762 |
print '<textarea name="eldesc" cols="60" rows="1">'.$objp->description.'</textarea></td>'; |
print '<textarea name="eldesc" cols="60" rows="1">'.$objp->description.'</textarea></td>'; |
763 |
print '<td align="right">'; |
print '<td align="right">'; |
766 |
print '<td align="right"><input size="6" type="text" name="elprice" value="'.price($objp->subprice).'"></td>'; |
print '<td align="right"><input size="6" type="text" name="elprice" value="'.price($objp->subprice).'"></td>'; |
767 |
print '<td align="center"><input size="3" type="text" name="elqty" value="'.$objp->qty.'"></td>'; |
print '<td align="center"><input size="3" type="text" name="elqty" value="'.$objp->qty.'"></td>'; |
768 |
print '<td align="right"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>'; |
print '<td align="right"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>'; |
769 |
print '<td align="center" colspan="3"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td>'; |
print '<td align="center" colspan="3" rowspan="2" valign="middle"><input type="submit" class="button" name="save" value="'.$langs->trans("Modify").'">'; |
770 |
|
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; |
771 |
|
print '</td>'; |
772 |
// Ligne dates prévues |
// Ligne dates prévues |
773 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
774 |
print '<td colspan="8">'; |
print '<td colspan="5">'; |
775 |
print $langs->trans("DateStartPlanned").' '; |
print $langs->trans("DateStartPlanned").' '; |
776 |
$html->select_date($objp->date_debut,"date_start_update",0,0,($objp->date_debut>0?0:1)); |
$html->select_date($objp->date_debut,"date_start_update",0,0,($objp->date_debut>0?0:1)); |
777 |
print ' '.$langs->trans("DateEndPlanned").' '; |
print ' '.$langs->trans("DateEndPlanned").' '; |
808 |
|
|
809 |
$var=false; |
$var=false; |
810 |
|
|
811 |
|
// Service sur produit prédéfini |
812 |
print '<form action="fiche.php?id='.$id.'" method="post">'; |
print '<form action="fiche.php?id='.$id.'" method="post">'; |
813 |
print '<input type="hidden" name="action" value="addligne">'; |
print '<input type="hidden" name="action" value="addligne">'; |
814 |
print '<input type="hidden" name="mode" value="predefined">'; |
print '<input type="hidden" name="mode" value="predefined">'; |
816 |
|
|
817 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
818 |
print '<td colspan="3">'; |
print '<td colspan="3">'; |
819 |
$html->select_produits('','p_idprod','',0); |
$html->select_produits('','p_idprod','',0).'<br>'; |
820 |
|
print '<textarea name="desc" cols="50" rows="1"></textarea>'; |
821 |
print '</td>'; |
print '</td>'; |
822 |
|
|
823 |
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>'; |
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>'; |
837 |
|
|
838 |
$var=!$var; |
$var=!$var; |
839 |
|
|
840 |
|
// Service libre |
841 |
print '<form action="fiche.php?id='.$id.'" method="post">'; |
print '<form action="fiche.php?id='.$id.'" method="post">'; |
842 |
print '<input type="hidden" name="action" value="addligne">'; |
print '<input type="hidden" name="action" value="addligne">'; |
843 |
print '<input type="hidden" name="mode" value="libre">'; |
print '<input type="hidden" name="mode" value="libre">'; |