NEW: For a contract line, price is no more mandatory.

This commit is contained in:
Laurent Destailleur 2015-04-10 10:17:20 +02:00
parent 369d6915b8
commit 2b071a6091
4 changed files with 33 additions and 24 deletions

View File

@ -1270,7 +1270,9 @@ else
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
// Title line for service
$var=false;
// Title line for service
$cursorline=1;
while ($cursorline <= $nbofservices)
{
@ -1309,8 +1311,6 @@ else
print '<td width="30">&nbsp;</td>';
print "</tr>\n";
$var=true;
$objp = $db->fetch_object($result);
$var=!$var;
@ -1338,18 +1338,18 @@ else
}
else
{
print "<td>".dol_htmlentitiesbr($objp->description)."</td>\n";
print '<td>'.dol_htmlentitiesbr($objp->description)."</td>\n";
}
// TVA
print '<td align="center">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
// Prix
print '<td align="right">'.price($objp->subprice)."</td>\n";
print '<td align="right">'.($objp->subprice != '' ? price($objp->subprice) : '')."</td>\n";
// Quantite
print '<td align="center">'.$objp->qty.'</td>';
// Remise
if ($objp->remise_percent > 0)
{
print '<td align="right">'.$objp->remise_percent."%</td>\n";
print '<td align="right" '.$bc[$var].'>'.$objp->remise_percent."%</td>\n";
}
else
{
@ -1481,7 +1481,7 @@ else
print '<td colspan="'.$colspan.'">';
print $langs->trans("DateStartPlanned").' ';
$form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update");
print '<br>'.$langs->trans("DateEndPlanned").' ';
print ' &nbsp;&nbsp;'.$langs->trans("DateEndPlanned").' ';
$form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update");
print '</td>';
@ -1505,7 +1505,7 @@ else
if ($object->statut > 0)
{
print '<tr '.$bc[false].'>';
print '<tr '.$bc[$var].'>';
print '<td colspan="'.($conf->margin->enabled?7:6).'"><hr></td>';
print "</tr>\n";
}
@ -1521,7 +1521,7 @@ else
if ($action == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == GETPOST('rowid'))
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1);
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
}
/*
@ -1541,7 +1541,7 @@ else
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
}
/*
@ -1553,7 +1553,7 @@ else
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment');
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
}
/*
@ -1565,7 +1565,7 @@ else
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment');
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
}
@ -1574,7 +1574,7 @@ else
{
print '<table class="notopnoleftnoright tableforservicepart2" width="100%">';
print '<tr '.$bc[false].'>';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).'</td>';
print '<td width="30" align="right">';
if ($user->societe_id == 0)
@ -1591,7 +1591,7 @@ else
print '</td>';
print "</tr>\n";
print '<tr '.$bc[false].'>';
print '<tr '.$bc[$var].'>';
print '<td>';
// Si pas encore active
@ -1630,7 +1630,7 @@ else
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.GETPOST('ligne').'&amp;action=active" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="notopnoleftnoright" width="100%">';
print '<table class="notopnoleftnoright tableforservicepart2" width="100%">';
// Definie date debut et fin par defaut
$dateactstart = $objp->date_debut;
@ -1680,7 +1680,7 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
print '<table class="noborder tableforservicepart2" width="100%">';
// Definie date debut et fin par defaut
$dateactstart = $objp->date_debut_reelle;

View File

@ -2439,7 +2439,12 @@ class ContratLigne extends CommonObject
$this->fk_user_ouverture=trim($this->fk_user_ouverture);
$this->fk_user_cloture=trim($this->fk_user_cloture);
$this->commentaire=trim($this->commentaire);
//if (empty($this->subprice)) $this->subprice = 0;
if (empty($this->price_ht)) $this->price_ht = 0;
if (empty($this->total_ht)) $this->total_ht = 0;
if (empty($this->total_tva)) $this->total_tva = 0;
if (empty($this->total_ttc)) $this->total_ttc = 0;
// Check parameters
// Put here code to add control on parameters values
@ -2483,8 +2488,8 @@ class ContratLigne extends CommonObject
$sql.= " remise_percent='".$this->remise_percent."',";
$sql.= " remise=".($this->remise?"'".$this->remise."'":"null").",";
$sql.= " fk_remise_except=".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
$sql.= " subprice='".$this->subprice."',";
$sql.= " price_ht='".$this->price_ht."',";
$sql.= " subprice=".($this->subprice != '' ? $this->subprice : "null").",";
$sql.= " price_ht=".($this->price_ht != '' ? $this->price_ht : "null").",";
$sql.= " total_ht='".$this->total_ht."',";
$sql.= " total_tva='".$this->total_tva."',";
$sql.= " total_localtax1='".$this->total_localtax1."',";

View File

@ -23,12 +23,12 @@ create table llx_contrat
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30), -- contrat reference
ref_supplier varchar(30), -- suplier contract ref
ref_ext varchar(30), -- external contract ref
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(30), -- external contract ref
entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp,
datec datetime, -- creation date
datec datetime, -- creation date
date_contrat datetime,
statut smallint DEFAULT 0,
statut smallint DEFAULT 0, -- not used. deprecated
mise_en_service datetime,
fin_validite datetime,
date_cloture datetime,

View File

@ -1991,7 +1991,11 @@ input.liste_titre {
.tableforservicepart1 .impair, .tableforservicepart1 .pair, .tableforservicepart2 .impair, .tableforservicepart2 .pair {
background: none;
//background: none;
background: #FFF;
}
.tableforservicepart1 tbody tr td, .tableforservicepart2 tbody tr td {
border-bottom: none;
}
.margintable td {