From 2b071a6091bfd5e7ec30629fbbaa7fe32bc1c0c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Apr 2015 10:17:20 +0200 Subject: [PATCH] NEW: For a contract line, price is no more mandatory. --- htdocs/contrat/card.php | 32 ++++++++++----------- htdocs/contrat/class/contrat.class.php | 11 +++++-- htdocs/install/mysql/tables/llx_contrat.sql | 8 +++--- htdocs/theme/eldy/style.css.php | 6 +++- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 232df30e280..8cb60d25215 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -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 ' '; print "\n"; - $var=true; - $objp = $db->fetch_object($result); $var=!$var; @@ -1338,18 +1338,18 @@ else } else { - print "".dol_htmlentitiesbr($objp->description)."\n"; + print ''.dol_htmlentitiesbr($objp->description)."\n"; } // TVA print ''.vatrate($objp->tva_tx,'%',$objp->info_bits).''; // Prix - print ''.price($objp->subprice)."\n"; + print ''.($objp->subprice != '' ? price($objp->subprice) : '')."\n"; // Quantite print ''.$objp->qty.''; // Remise if ($objp->remise_percent > 0) { - print ''.$objp->remise_percent."%\n"; + print ''.$objp->remise_percent."%\n"; } else { @@ -1481,7 +1481,7 @@ else print ''; 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 '
'.$langs->trans("DateEndPlanned").' '; + print '   '.$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 ''; @@ -1505,7 +1505,7 @@ else if ($object->statut > 0) { - print ''; + print ''; print '
'; print "\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 '
'; + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + print '
'; } /* @@ -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 '
'; + print '
'; } /* @@ -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 '
'; + print '
'; } @@ -1574,7 +1574,7 @@ else { print ''; - print ''; + print ''; print ''; print ''; print "\n"; - print ''; + print ''; print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; if ($user->societe_id == 0) @@ -1591,7 +1591,7 @@ else print '
'; // Si pas encore active @@ -1630,7 +1630,7 @@ else print '
'; print ''; - print ''; + print '
'; // Definie date debut et fin par defaut $dateactstart = $objp->date_debut; @@ -1680,7 +1680,7 @@ else print ''; - print '
'; + print '
'; // Definie date debut et fin par defaut $dateactstart = $objp->date_debut_reelle; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 6797daa46ab..b24ee8f0d66 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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."',"; diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index 0e75c50305b..73e29e8bdd4 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -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, diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b356f570cba..6f17f10113a 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -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 {