From 3d8a1dabecdf14a7462dbc81ba7b6d26966983bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 13:44:20 +0000 Subject: [PATCH] Fix: Removed warnings --- htdocs/contrat/fiche.php | 1322 ++++++++--------- .../company/actions_card_company.class.php | 22 +- .../actions_card_individual.class.php | 30 +- 3 files changed, 693 insertions(+), 681 deletions(-) diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 15e409863f7..a8029264aa7 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -41,10 +41,10 @@ $langs->load("bills"); $langs->load("products"); $action=GETPOST('action'); - -// Security check $socid = GETPOST("socid"); $contratid = GETPOST("id"); + +// Security check if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'contrat',$contratid,'contrat'); @@ -90,31 +90,31 @@ if ($action == 'confirm_closeline' && $_REQUEST["confirm"] == 'yes' && $user->ri // Si ajout champ produit predefini if ($_POST["mode"]=='predefined') { - $date_start=''; - $date_end=''; - if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"]) - { - $date_start=dol_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]); - } - if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"]) - { - $date_end=dol_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]); - } + $date_start=''; + $date_end=''; + if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"]) + { + $date_start=dol_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]); + } + if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"]) + { + $date_end=dol_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]); + } } // Si ajout champ produit libre if ($_POST["mode"]=='libre') { - $date_start_sl=''; - $date_end_sl=''; - if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"]) - { - $date_start_sl=dol_mktime($_POST["date_start_slhour"], $_POST["date_start_slmin"], 0, $_POST["date_start_slmonth"], $_POST["date_start_slday"], $_POST["date_start_slyear"]); - } - if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"]) - { - $date_end_sl=dol_mktime($_POST["date_end_slhour"], $_POST["date_end_slmin"], 0, $_POST["date_end_slmonth"], $_POST["date_end_slday"], $_POST["date_end_slyear"]); - } + $date_start_sl=''; + $date_end_sl=''; + if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"]) + { + $date_start_sl=dol_mktime($_POST["date_start_slhour"], $_POST["date_start_slmin"], 0, $_POST["date_start_slmonth"], $_POST["date_start_slday"], $_POST["date_start_slyear"]); + } + if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"]) + { + $date_end_sl=dol_mktime($_POST["date_end_slhour"], $_POST["date_end_slmin"], 0, $_POST["date_end_slmonth"], $_POST["date_end_slday"], $_POST["date_end_slyear"]); + } } // Param dates @@ -141,7 +141,7 @@ if ($_POST["date_end_real_updatemonth"] && $_POST["date_end_real_updateday"] && } if ($_POST["remonth"] && $_POST["reday"] && $_POST["reyear"]) { - $datecontrat = dol_mktime($_POST["rehour"], $_POST["remin"], 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datecontrat = dol_mktime($_POST["rehour"], $_POST["remin"], 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } if ($action == 'add') @@ -194,43 +194,43 @@ if ($action == 'addline' && $user->rights->contrat->creer) { $ret=$object->fetch($_GET["id"]); if ($ret < 0) - { - dol_print_error($db,$commande->error); - exit; - } - $ret=$object->fetch_thirdparty(); + { + dol_print_error($db,$commande->error); + exit; + } + $ret=$object->fetch_thirdparty(); - $date_start=''; - $date_end=''; - // Si ajout champ produit libre - if ($_POST['mode'] == 'libre') - { - if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"]) - { - $date_start=dol_mktime($_POST["date_start_slhour"], $_POST["date_start_slmin"], 0, $_POST["date_start_slmonth"], $_POST["date_start_slday"], $_POST["date_start_slyear"]); - } - if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"]) - { - $date_end=dol_mktime($_POST["date_end_slhour"], $_POST["date_end_slmin"], 0, $_POST["date_end_slmonth"], $_POST["date_end_slday"], $_POST["date_end_slyear"]); - } - } - // Si ajout champ produit predefini - if ($_POST['mode'] == 'predefined') - { - if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"]) - { - $date_start=dol_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]); - } - if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"]) - { - $date_end=dol_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]); - } - } + $date_start=''; + $date_end=''; + // Si ajout champ produit libre + if ($_POST['mode'] == 'libre') + { + if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"]) + { + $date_start=dol_mktime($_POST["date_start_slhour"], $_POST["date_start_slmin"], 0, $_POST["date_start_slmonth"], $_POST["date_start_slday"], $_POST["date_start_slyear"]); + } + if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"]) + { + $date_end=dol_mktime($_POST["date_end_slhour"], $_POST["date_end_slmin"], 0, $_POST["date_end_slmonth"], $_POST["date_end_slday"], $_POST["date_end_slyear"]); + } + } + // Si ajout champ produit predefini + if ($_POST['mode'] == 'predefined') + { + if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"]) + { + $date_start=dol_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]); + } + if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"]) + { + $date_end=dol_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]); + } + } - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $txtva par celui du produit - // Ecrase $base_price_type par celui du produit + // Ecrase $pu par celui du produit + // Ecrase $desc par celui du produit + // Ecrase $txtva par celui du produit + // Ecrase $base_price_type par celui du produit if ($_POST['idprod']) { $prod = new Product($db); @@ -242,97 +242,97 @@ if ($action == 'addline' && $user->rights->contrat->creer) // On defini prix unitaire if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) { - $pu_ht = $prod->multiprices[$object->client->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; - $price_min = $prod->multiprices_min[$object->client->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; + $pu_ht = $prod->multiprices[$object->client->price_level]; + $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; + $price_min = $prod->multiprices_min[$object->client->price_level]; + $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; } else { - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; + $pu_ht = $prod->price; + $pu_ttc = $prod->price_ttc; + $price_min = $prod->price_min; + $price_base_type = $prod->price_base_type; } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + if ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + } $desc = $prod->description; - $desc.= $prod->description && $_POST['desc'] ? "\n" : ""; + $desc.= $prod->description && $_POST['desc'] ? "\n" : ""; $desc.= $_POST['desc']; } else { - $pu_ht=$_POST['pu']; - $price_base_type = 'HT'; - $tva_tx=str_replace('*','',$_POST['tva_tx']); - $tva_npr=preg_match('/\*/',$_POST['tva_tx'])?1:0; - $desc=$_POST['desc']; + $pu_ht=$_POST['pu']; + $price_base_type = 'HT'; + $tva_tx=str_replace('*','',$_POST['tva_tx']); + $tva_npr=preg_match('/\*/',$_POST['tva_tx'])?1:0; + $desc=$_POST['desc']; } $localtax1_tx=get_localtax($tva_tx,1,$object->client); $localtax2_tx=get_localtax($tva_tx,2,$object->client); - $info_bits=0; - if ($tva_npr) $info_bits |= 0x01; + $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)); - $result = -1 ; - } - else - { - // Insert line - $result = $object->addline( - $desc, - $pu_ht, - $_POST["pqty"], - $tva_tx, - $localtax1_tx, - $localtax2_tx, - $_POST["idprod"], - $_POST["premise"], - $date_start, - $date_end, - $price_base_type, - $pu_ttc, - $info_bits - ); - } + 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)); + $result = -1 ; + } + else + { + // Insert line + $result = $object->addline( + $desc, + $pu_ht, + $_POST["pqty"], + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $_POST["idprod"], + $_POST["premise"], + $date_start, + $date_end, + $price_base_type, + $pu_ttc, + $info_bits + ); + } - if ($result > 0) - { - /* - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - contrat_pdf_create($db, $object->id, $object->modelpdf, $outputlangs); - */ - } - else - { + if ($result > 0) + { + /* + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + contrat_pdf_create($db, $object->id, $object->modelpdf, $outputlangs); + */ + } + else + { $mesg='
'.$object->error.'
'; - } + } } } @@ -341,31 +341,31 @@ if ($action == 'updateligne' && $user->rights->contrat->creer && ! $_POST["cance $objectline = new ContratLigne($db); if ($objectline->fetch($_POST["elrowid"])) { - $db->begin(); + $db->begin(); - if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture; - if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture; + if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture; + if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture; - $localtax1_tx=get_localtax($_POST["eltva_tx"],1,$object->client); + $localtax1_tx=get_localtax($_POST["eltva_tx"],1,$object->client); $localtax2_tx=get_localtax($_POST["eltva_tx"],2,$object->client); - $objectline->description=$_POST["eldesc"]; - $objectline->price_ht=$_POST["elprice"]; - $objectline->subprice=$_POST["elprice"]; + $objectline->description=$_POST["eldesc"]; + $objectline->price_ht=$_POST["elprice"]; + $objectline->subprice=$_POST["elprice"]; $objectline->qty=$_POST["elqty"]; $objectline->remise_percent=$_POST["elremise_percent"]; - $objectline->tva_tx=$_POST["eltva_tx"]; - $objectline->localtax1_tx=$localtax1_tx; - $objectline->localtax2_tx=$localtax2_tx; - $objectline->date_ouverture_prevue=$date_start_update; - $objectline->date_ouverture=$date_start_real_update; - $objectline->date_fin_validite=$date_end_update; + $objectline->tva_tx=$_POST["eltva_tx"]; + $objectline->localtax1_tx=$localtax1_tx; + $objectline->localtax2_tx=$localtax2_tx; + $objectline->date_ouverture_prevue=$date_start_update; + $objectline->date_ouverture=$date_start_real_update; + $objectline->date_fin_validite=$date_end_update; $objectline->date_cloture=$date_end_real_update; - $objectline->fk_user_cloture=$user->id; + $objectline->fk_user_cloture=$user->id; - // TODO verifier price_min si fk_product et multiprix + // TODO verifier price_min si fk_product et multiprix - $result=$objectline->update($user); + $result=$objectline->update($user); if ($result > 0) { $db->commit(); @@ -392,10 +392,10 @@ if ($action == 'confirm_deleteline' && $_REQUEST["confirm"] == 'yes' && $user->r Header("Location: fiche.php?id=".$object->id); exit; } - else - { - $mesg=$object->error; - } + else + { + $mesg=$object->error; + } } if ($action == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer) @@ -418,14 +418,14 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes') $object->id = $_GET["id"]; $result=$object->delete($user,$langs,$conf); if ($result >= 0) - { - Header("Location: index.php"); - return; - } - else - { - $mesg='
'.$object->error.'
'; - } + { + Header("Location: index.php"); + return; + } + else + { + $mesg='
'.$object->error.'
'; + } } } @@ -433,26 +433,26 @@ if ($action == 'confirm_move' && $_REQUEST["confirm"] == 'yes') { if ($user->rights->contrat->creer) { - if ($_POST['newcid'] > 0) - { - $contractline = new ContratLigne($db); - $result=$contractline->fetch($_GET["lineid"]); - $contractline->fk_contrat = $_POST["newcid"]; - $result=$contractline->update($user,1); - if ($result >= 0) - { - Header("Location: ".$_SERVER['PHP_SELF'].'?id='.$_GET['id']); - return; - } - else - { - $mesg='
'.$object->error.'
'; - } - } - else - { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'
'; - } + if ($_POST['newcid'] > 0) + { + $contractline = new ContratLigne($db); + $result=$contractline->fetch($_GET["lineid"]); + $contractline->fk_contrat = $_POST["newcid"]; + $result=$contractline->update($user,1); + if ($result >= 0) + { + Header("Location: ".$_SERVER['PHP_SELF'].'?id='.$_GET['id']); + return; + } + else + { + $mesg='
'.$object->error.'
'; + } + } + else + { + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")).'
'; + } } } @@ -483,10 +483,10 @@ if ($action == 'create') $soc = new Societe($db); $soc->fetch($socid); - $object->date_contrat = dol_now(); - if ($contratid) $result=$object->fetch($contratid); + $object->date_contrat = dol_now(); + if ($contratid) $result=$object->fetch($contratid); - $numct = $object->getNextNumRef($soc); + $numct = $object->getNextNumRef($soc); print '
'; print ''; @@ -531,9 +531,9 @@ if ($action == 'create') if ($conf->projet->enabled) { - print ''.$langs->trans("Project").''; - select_projects($soc->id,GETPOST("projectid"),"projectid"); - print ""; + print ''.$langs->trans("Project").''; + select_projects($soc->id,GETPOST("projectid"),"projectid"); + print ""; } print ''.$langs->trans("NotePublic").''; @@ -543,10 +543,10 @@ if ($action == 'create') if (! $user->societe_id) { - print ''.$langs->trans("NotePrivate").''; - print ''; + print ''.$langs->trans("NotePrivate").''; + print ''; } print "\n"; @@ -564,17 +564,17 @@ else /* */ /* *************************************************************************** */ { - $now=dol_now(); + $now=dol_now(); $id = $_GET["id"]; - $ref= $_GET['ref']; - if ($id > 0 || ! empty($ref)) + $ref= $_GET['ref']; + if ($id > 0 || ! empty($ref)) { $result=$object->fetch($_GET['id'],$_GET['ref']); if ($result > 0) { - $id = $object->id; // if $_GET['ref'] - $result=$object->fetch_lines(); + $id = $object->id; // if $_GET['ref'] + $result=$object->fetch_lines(); } if ($result < 0) { @@ -584,7 +584,7 @@ else dol_htmloutput_errors($mesg,''); - $nbofservices=count($object->lines); + $nbofservices=count($object->lines); $author = new User($db); $author->fetch($object->user_author_id); @@ -595,7 +595,7 @@ else $commercial_suivi = new User($db); $commercial_suivi->fetch($object->commercial_suivi_id); - $head = contract_prepare_head($object); + $head = contract_prepare_head($object); $hselected = 0; @@ -608,7 +608,7 @@ else if ($action == 'delete') { $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1); - if ($ret == 'html') print '
'; + if ($ret == 'html') print '
'; } /* @@ -618,7 +618,7 @@ else { //$numfa = contrat_get_num($soc); $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid",'',0,1); - if ($ret == 'html') print '
'; + if ($ret == 'html') print '
'; } /* @@ -627,7 +627,7 @@ else if ($action == 'close') { $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1); - if ($ret == 'html') print '
'; + if ($ret == 'html') print '
'; } /* @@ -644,28 +644,28 @@ else // Ref du contrat print ''.$langs->trans("Ref").''; - print $html->showrefnav($object,'ref','',1,'ref','ref',''); + print $html->showrefnav($object,'ref','',1,'ref','ref',''); print ""; // Customer print "".$langs->trans("Customer").""; print ''.$object->societe->getNomUrl(1).''; - // Ligne info remises tiers + // Ligne info remises tiers print ''.$langs->trans('Discount').''; - if ($object->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->societe->remise_client); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount=$object->societe->getAvailableDiscounts(); - print '. '; - if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie)); - else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.'; - print ''; + if ($object->societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->societe->remise_client); + else print $langs->trans("CompanyHasNoRelativeDiscount"); + $absolute_discount=$object->societe->getAvailableDiscounts(); + print '. '; + if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie)); + else print $langs->trans("CompanyHasNoAbsoluteDiscount"); + print '.'; + print ''; // Statut contrat print ''.$langs->trans("Status").''; if ($object->statut==0) print $object->getLibStatut(2); - else print $object->getLibStatut(4); + else print $object->getLibStatut(4); print ""; // Date @@ -701,528 +701,528 @@ else print '
'; } - echo '
'; + echo '
'; - $servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1); - $colorb='666666'; + $servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1); + $colorb='666666'; - $arrayothercontracts=$object->getListOfContracts('others'); + $arrayothercontracts=$object->getListOfContracts('others'); - /* + /* * Lines of contracts */ $productstatic=new Product($db); - // Title line for service - print ''; // Array with (n*2)+1 lines - $cursorline=1; - while ($cursorline <= $nbofservices) - { - print ''; - print ''; + // Title line for service + print '
'; - print $langs->trans("ServiceNb",$cursorline).'
'; // Array with (n*2)+1 lines + $cursorline=1; + while ($cursorline <= $nbofservices) + { + print ''; + print ''; - print '
'; + print $langs->trans("ServiceNb",$cursorline).''; + print ''; - // Area with common detail of line - print ''; + // Area with common detail of line + print '
'; - $sql = "SELECT cd.rowid, cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty,"; - $sql.= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice,"; - $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.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; + $sql = "SELECT cd.rowid, cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty,"; + $sql.= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice,"; + $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.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; - $result = $db->query($sql); - if ($result) - { - $total = 0; + $result = $db->query($sql); + if ($result) + { + $total = 0; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; - $var=true; + $var=true; - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($result); - $var=!$var; + $var=!$var; - if ($_REQUEST["action"] != 'editline' || $_GET["rowid"] != $objp->rowid) - { - print ''; - // Libelle - if ($objp->fk_product > 0) - { - print ''; + // Libelle + if ($objp->fk_product > 0) + { + print ''; - } - else - { - print "\n"; - } - // TVA - print ''; - // Prix - print '\n"; - // Quantite - print ''; - // Remise - if ($objp->remise_percent > 0) - { - print '\n"; - } - else - { - print ''; - } - // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme) - print ''; + if ($objp->description) print '
'.dol_nl2br($objp->description); + print ''; + } + else + { + print "\n"; + } + // TVA + print ''; + // Prix + print '\n"; + // Quantite + print ''; + // Remise + if ($objp->remise_percent > 0) + { + print '\n"; + } + else + { + print ''; + } + // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme) + print ''; - print "\n"; + print "\n"; - // Dates de en service prevues et effectives - if ($objp->subprice >= 0) - { - print ''; - print ''; + print ''; - print ''; - } - } - // Ligne en mode update - else - { - print ""; - print ''; - print ''; - print ''; - // Ligne carac - print ""; - print ''; + print ''; + } + } + // Ligne en mode update + else + { + print ""; + print ''; + print ''; + print ''; + // Ligne carac + print ""; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - // Ligne dates prevues - print ""; - print ''; - print ''; + print '
'; + } + else + { + print $objp->label?$objp->label.'
':''; + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + // Ligne dates prevues + print ""; + print ''; + print ''; - print "\n"; - } + print "\n"; + } - $db->free($result); - } - else - { - dol_print_error($db); - } + $db->free($result); + } + else + { + dol_print_error($db); + } - if ($object->statut > 0) - { - print ''; - print ''; - print "\n"; - } + if ($object->statut > 0) + { + print ''; + print ''; + print "\n"; + } - print "
'.$langs->trans("Service").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("ReductionShort").' 
'.$langs->trans("Service").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("ReductionShort").' 
'; + if ($_REQUEST["action"] != 'editline' || $_GET["rowid"] != $objp->rowid) + { + print '
'; $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 '
'.dol_nl2br($objp->description); - print '
".nl2br($objp->description)."'.vatrate($objp->tva_tx,'%',$objp->info_bits).''.price($objp->subprice)."'.$objp->qty.''.$objp->remise_percent."% '; - if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) - { - print ''; - print img_picto($langs->trans("MoveToAnotherContract"),'uparrow'); - print ''; - } - else { - print ' '; - } - if ($user->rights->contrat->creer && ($object->statut >= 0)) - { - print ''; - print img_edit(); - print ''; - } - else { - print ' '; - } - if ( $user->rights->contrat->creer && ($object->statut >= 0)) - { - print ' '; - print ''; - print img_delete(); - print ''; - } - print '".nl2br($objp->description)."'.vatrate($objp->tva_tx,'%',$objp->info_bits).''.price($objp->subprice)."'.$objp->qty.''.$objp->remise_percent."% '; + if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) + { + print ''; + print img_picto($langs->trans("MoveToAnotherContract"),'uparrow'); + print ''; + } + else { + print ' '; + } + if ($user->rights->contrat->creer && ($object->statut >= 0)) + { + print ''; + print img_edit(); + print ''; + } + else { + print ' '; + } + if ( $user->rights->contrat->creer && ($object->statut >= 0)) + { + print ' '; + print ''; + print img_delete(); + print ''; + } + print '
'; + // Dates de en service prevues et effectives + if ($objp->subprice >= 0) + { + print '
'; - // Date planned - print $langs->trans("DateStartPlanned").': '; - if ($objp->date_debut) - { - print dol_print_date($db->jdate($objp->date_debut)); - // Warning si date prevu passee et pas en service - if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { print " ".img_warning($langs->trans("Late")); } - } - else print $langs->trans("Unknown"); - print '  -  '; - print $langs->trans("DateEndPlanned").': '; - if ($objp->date_fin) - { - print dol_print_date($db->jdate($objp->date_fin)); - if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { print " ".img_warning($langs->trans("Late")); } - } - else print $langs->trans("Unknown"); + // Date planned + print $langs->trans("DateStartPlanned").': '; + if ($objp->date_debut) + { + print dol_print_date($db->jdate($objp->date_debut)); + // Warning si date prevu passee et pas en service + if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { print " ".img_warning($langs->trans("Late")); } + } + else print $langs->trans("Unknown"); + print '  -  '; + print $langs->trans("DateEndPlanned").': '; + if ($objp->date_fin) + { + print dol_print_date($db->jdate($objp->date_fin)); + if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { print " ".img_warning($langs->trans("Late")); } + } + else print $langs->trans("Unknown"); - print '
'; - if ($objp->fk_product) - { + print '
'; + if ($objp->fk_product) + { $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 - { - print $objp->label?$objp->label.'
':''; - } - print '
'; - print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->societe); - print '%'; - print '
'; - 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").' '; - $form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update"); - print '
'; + print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->societe); + print '%'; + print '
'; + 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").' '; + $form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update"); + print '


"; + print "
"; - /* - * Confirmation to delete service line of contract - */ - if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"]) - { - $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1); - if ($ret == 'html') print '
'; - } + /* + * Confirmation to delete service line of contract + */ + if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"]) + { + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1); + if ($ret == 'html') print '
'; + } - /* - * Confirmation to move service toward another contract - */ - if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"]) - { - $arraycontractid=array(); - foreach($arrayothercontracts as $contractcursor) - { - $arraycontractid[$contractcursor->id]=$contractcursor->ref; - } - //var_dump($arraycontractid); - // Cree un tableau formulaire - $formquestion=array( + /* + * Confirmation to move service toward another contract + */ + if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"]) + { + $arraycontractid=array(); + foreach($arrayothercontracts as $contractcursor) + { + $arraycontractid[$contractcursor->id]=$contractcursor->ref; + } + //var_dump($arraycontractid); + // Cree un tableau formulaire + $formquestion=array( 'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"), - array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid)); + array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid)); - $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".$_GET["rowid"],$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion); - print '
'; - } + $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".$_GET["rowid"],$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion); + print '
'; + } - /* - * Confirmation de la validation activation - */ - if ($_REQUEST["action"] == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"]) - { - $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); - $comment = $_POST["comment"]; - $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".$_GET["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 '
'; - } + /* + * Confirmation de la validation activation + */ + if ($_REQUEST["action"] == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"]) + { + $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); + $comment = $_POST["comment"]; + $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".$_GET["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 '
'; + } - /* - * Confirmation de la validation fermeture - */ - if ($_REQUEST["action"] == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"]) - { - $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); - $comment = $_POST["comment"]; - $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".$_GET["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 '
'; - } + /* + * Confirmation de la validation fermeture + */ + if ($_REQUEST["action"] == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"]) + { + $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); + $comment = $_POST["comment"]; + $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".$_GET["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 '
'; + } - // Area with status and activation info of line - if ($object->statut > 0) - { - print ''; + // Area with status and activation info of line + if ($object->statut > 0) + { + print '
'; - print ''; - print ''; - print ''; - print "\n"; + print ''; + print ''; + print ''; + print "\n"; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; - print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; - if ($user->societe_id == 0) - { - if ($object->statut > 0 && $_REQUEST["action"] != 'activateline' && $_REQUEST["action"] != 'unactivateline') - { - $action='activateline'; - if ($objp->statut == 4) $action='unactivateline'; - print ''; - print img_edit(); - print ''; - } - } - print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; + if ($user->societe_id == 0) + { + if ($object->statut > 0 && $_REQUEST["action"] != 'activateline' && $_REQUEST["action"] != 'unactivateline') + { + $action='activateline'; + if ($objp->statut == 4) $action='unactivateline'; + print ''; + print img_edit(); + print ''; + } + } + print '
'; - // Si pas encore active - if (! $objp->date_debut_reelle) { - print $langs->trans("DateStartReal").': '; - if ($objp->date_debut_reelle) print dol_print_date($objp->date_debut_reelle); - else print $langs->trans("ContractStatusNotRunning"); - } - // Si active et en cours - if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) { - print $langs->trans("DateStartReal").': '; - print dol_print_date($objp->date_debut_reelle); - } - // Si desactive - if ($objp->date_debut_reelle && $objp->date_fin_reelle) { - print $langs->trans("DateStartReal").': '; - print dol_print_date($objp->date_debut_reelle); - print '  -  '; - print $langs->trans("DateEndReal").': '; - print dol_print_date($objp->date_fin_reelle); - } - if (! empty($objp->comment)) print "
".$objp->comment; - print '
'; + // Si pas encore active + if (! $objp->date_debut_reelle) { + print $langs->trans("DateStartReal").': '; + if ($objp->date_debut_reelle) print dol_print_date($objp->date_debut_reelle); + else print $langs->trans("ContractStatusNotRunning"); + } + // Si active et en cours + if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) { + print $langs->trans("DateStartReal").': '; + print dol_print_date($objp->date_debut_reelle); + } + // Si desactive + if ($objp->date_debut_reelle && $objp->date_fin_reelle) { + print $langs->trans("DateStartReal").': '; + print dol_print_date($objp->date_debut_reelle); + print '  -  '; + print $langs->trans("DateEndReal").': '; + print dol_print_date($objp->date_fin_reelle); + } + if (! empty($objp->comment)) print "
".$objp->comment; + print '
  
'; - } + print ''; + print ''; + } - if ($user->rights->contrat->activer && $_REQUEST["action"] == 'activateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"]) - { - /** - * Activer la ligne de contrat - */ - print '
'; - print ''; + if ($user->rights->contrat->activer && $_REQUEST["action"] == 'activateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"]) + { + /** + * Activer la ligne de contrat + */ + print ''; + print ''; - print ''; - //print ''; + print '
'.$langs->trans("Status").'
'; + //print ''; - // Definie date debut et fin par defaut - $dateactstart = $objp->date_debut; - if ($_POST["remonth"]) $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - elseif (! $dateactstart) $dateactstart = time(); + // Definie date debut et fin par defaut + $dateactstart = $objp->date_debut; + if ($_POST["remonth"]) $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + elseif (! $dateactstart) $dateactstart = time(); - $dateactend = $objp->date_fin; - if ($_POST["endmonth"]) $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); - elseif (! $dateactend) - { - if ($objp->fk_product > 0) - { - $product=new Product($db); - $product->fetch($objp->fk_product); - $dateactend = dol_time_plus_duree (time(), $product->duration_value, $product->duration_unit); - } - } + $dateactend = $objp->date_fin; + if ($_POST["endmonth"]) $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); + elseif (! $dateactend) + { + if ($objp->fk_product > 0) + { + $product=new Product($db); + $product->fetch($objp->fk_product); + $dateactend = dol_time_plus_duree (time(), $product->duration_value, $product->duration_unit); + } + } - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print '
'.$langs->trans("Status").'
'.$langs->trans("DateServiceActivate").''; - print $html->select_date($dateactstart,'',$usehm,$usehm,'',"active"); - print '
'.$langs->trans("DateServiceActivate").''; + print $html->select_date($dateactstart,'',$usehm,$usehm,'',"active"); + print ''.$langs->trans("DateEndPlanned").''; - print $html->select_date($dateactend,"end",$usehm,$usehm,'',"active"); - print ''.$langs->trans("DateEndPlanned").''; + print $html->select_date($dateactend,"end",$usehm,$usehm,'',"active"); + print ''; - print '
'; - print ''; - print '
'; + print '
'; + print ''; + print '
'.$langs->trans("Comment").'
'.$langs->trans("Comment").'
'; + print ''; - print '
'; - } + print ''; + } - if ($user->rights->contrat->activer && $_REQUEST["action"] == 'unactivateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"]) - { - /** - * Desactiver la ligne de contrat - */ - print '
'; - print ''; + if ($user->rights->contrat->activer && $_REQUEST["action"] == 'unactivateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"]) + { + /** + * Desactiver la ligne de contrat + */ + print ''; + print ''; - print ''; + print '
'; - // Definie date debut et fin par defaut - $dateactstart = $objp->date_debut_reelle; - if ($_POST["remonth"]) $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - elseif (! $dateactstart) $dateactstart = time(); + // Definie date debut et fin par defaut + $dateactstart = $objp->date_debut_reelle; + if ($_POST["remonth"]) $dateactstart = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + elseif (! $dateactstart) $dateactstart = time(); - $dateactend = $objp->date_fin_reelle; - if ($_POST["endmonth"]) $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); - elseif (! $dateactend) - { - if ($objp->fk_product > 0) - { - $product=new Product($db); - $product->fetch($objp->fk_product); - $dateactend = dol_time_plus_duree (time(), $product->duration_value, $product->duration_unit); - } - } - $now=mktime(); - if ($dateactend > $now) $dateactend=$now; + $dateactend = $objp->date_fin_reelle; + if ($_POST["endmonth"]) $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); + elseif (! $dateactend) + { + if ($objp->fk_product > 0) + { + $product=new Product($db); + $product->fetch($objp->fk_product); + $dateactend = dol_time_plus_duree (time(), $product->duration_value, $product->duration_unit); + } + } + $now=mktime(); + if ($dateactend > $now) $dateactend=$now; - print ''; + print ''; - print ''; + print ''; - print ''; - print '
'; - if ($objp->statut >= 4) - { - if ($objp->statut == 4) - { - print $langs->trans("DateEndReal").' '; - $form->select_date($dateactend,"end",$usehm,$usehm,($objp->date_fin_reelle>0?0:1),"closeline"); - } - } - print '
'; + if ($objp->statut >= 4) + { + if ($objp->statut == 4) + { + print $langs->trans("DateEndReal").' '; + $form->select_date($dateactend,"end",$usehm,$usehm,($objp->date_fin_reelle>0?0:1),"closeline"); + } + } + print '
'; - print ''; - print '

'; + print ''; + print '
'.$langs->trans("Comment").'
'; + print ''.$langs->trans("Comment").''; + print ''; - print '
'; - } + print ''; + } - print ''; // End td if line is 1 + print ''; // End td if line is 1 - print ''; - print ' '; - $cursorline++; - } - print ''; + print ''; + print ' '; + $cursorline++; + } + print ''; - /* - * Ajouter une ligne produit/service - */ - if ($user->rights->contrat->creer && ($object->statut >= 0)) - { - print '
'; - print ''; // Array with (n*2)+1 lines + /* + * Ajouter une ligne produit/service + */ + if ($user->rights->contrat->creer && ($object->statut >= 0)) + { + print '
'; + print '
'; // Array with (n*2)+1 lines - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; + print ""; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; - $var=false; + $var=false; - // Service sur produit predefini - print ''; - print ''; - print ''; - print ''; - print ''; + // Service sur produit predefini + print ''; + print ''; + print ''; + print ''; + print ''; - print ""; - print ''; + print ""; + print ''; - print ''; - print ''; - print ''; - print ''."\n"; + print ''; + print ''; + print ''; + print ''."\n"; - print ""; - print ''; - print ''; + print ""; + print ''; + print ''; - print ''; + print ''; - $var=!$var; + $var=!$var; - // Service libre - print ''; - print ''; - print ''; - print ''; - print ''; + // Service libre + print ''; + print ''; + print ''; + print ''; + print ''; - print ""; - print ''; + print ""; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print ''."\n"; + print ''."\n"; - print ""; - print ''; - print ''; + print ""; + print ''; + print ''; - print ''; + print ''; - print '
'.$langs->trans("Service").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'  
'.$langs->trans("Service").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'  
'; - // multiprix - if($conf->global->PRODUIT_MULTIPRICES) - $form->select_produits('','idprod',1,$conf->product->limit_size,$object->societe->price_level); - else - $form->select_produits('','idprod',1,$conf->product->limit_size); - if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '
'; - print ''; - print '
'; + // multiprix + if($conf->global->PRODUIT_MULTIPRICES) + $form->select_produits('','idprod',1,$conf->product->limit_size,$object->societe->price_level); + else + $form->select_produits('','idprod',1,$conf->product->limit_size); + if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '
'; + print ''; + print '
%
%
'; - print $langs->trans("DateStartPlanned").' '; - $form->select_date('',"date_start",$usehm,$usehm,1,"addline"); - print '   '.$langs->trans("DateEndPlanned").' '; - $form->select_date('',"date_end",$usehm,$usehm,1,"addline"); - print '
'; + print $langs->trans("DateStartPlanned").' '; + $form->select_date('',"date_start",$usehm,$usehm,1,"addline"); + print '   '.$langs->trans("DateEndPlanned").' '; + $form->select_date('',"date_end",$usehm,$usehm,1,"addline"); + print '
'; - print $form->load_tva("tva_tx",-1,$mysoc,$object->societe); - print '%'; + print $form->load_tva("tva_tx",-1,$mysoc,$object->societe); + print '%
'; - print $langs->trans("DateStartPlanned").' '; - $form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl"); - print '   '.$langs->trans("DateEndPlanned").' '; - $form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl"); - print '
'; + print $langs->trans("DateStartPlanned").' '; + $form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl"); + print '   '.$langs->trans("DateEndPlanned").' '; + $form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl"); + print '
'; - } + print ''; + } - //print ''; + //print ''; - //print ''; + //print ''; print ''; @@ -1238,45 +1238,45 @@ else if ($object->statut == 0 && $nbofservices) { if ($user->rights->contrat->creer) print ''.$langs->trans("Validate").''; - else print ''.$langs->trans("Validate").''; + else print ''.$langs->trans("Validate").''; } if ($conf->facture->enabled && $object->statut > 0) { $langs->load("bills"); - if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; - else print ''.$langs->trans("CreateBill").''; + if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; + else print ''.$langs->trans("CreateBill").''; } - if ($object->nbofservicesclosed < $nbofservices) + if ($object->nbofservicesclosed < $nbofservices) { - //if (! $numactive) - //{ - print ''.$langs->trans("CloseAllContracts").''; - //} - //else - //{ - // print ''.$langs->trans("Close").''; - //} + //if (! $numactive) + //{ + print ''.$langs->trans("CloseAllContracts").''; + //} + //else + //{ + // print ''.$langs->trans("Close").''; + //} } // On peut supprimer entite si - // - Droit de creer + mode brouillon (erreur creation) - // - Droit de supprimer - if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer) + // - Droit de creer + mode brouillon (erreur creation) + // - Droit de supprimer + if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer) { print ''.$langs->trans("Delete").''; } print ""; - print '
'; + print '
'; } print '
'; - /* - * Linked object block - */ + /* + * Linked object block + */ $somethingshown=$object->showLinkedObjectBlock(); print ''; diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 881c86fb449..678625ba3cb 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -51,6 +51,9 @@ class ActionsCardCompany extends ActionsCardCommon /** * Return the title of card + * + * @param string $action Action code + * @return string Title */ private function getTitle($action) { @@ -70,6 +73,7 @@ class ActionsCardCompany extends ActionsCardCommon * Execute actions * * @param int $socid Id of object (may be empty for creation) + * @return int <0 if KO, >0 if OK */ function doActions($socid) { @@ -82,6 +86,7 @@ class ActionsCardCompany extends ActionsCardCommon * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action + * @return void */ function assign_values($action) { @@ -208,14 +213,15 @@ class ActionsCardCompany extends ActionsCardCommon /** * Check permissions of a user to show a page and an object. Check read permission * If $_REQUEST['action'] defined, we also check write permission. - * @param user User to check - * @param features Features to check (in most cases, it's module name) - * @param objectid Object ID if we want to check permission on a particular record (optionnal) - * @param dbtablename Table name where object is stored. Not used if objectid is null (optionnal) - * @param feature2 Feature to check (second level of permission) - * @param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal) - * @param dbt_select Field name for select if not rowid. (optionnal) - * @return int 1 + * + * @param User $user User to check + * @param string $features Features to check (in most cases, it's module name) + * @param int $objectid Object ID if we want to check permission on a particular record (optionnal) + * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optionnal) + * @param string $feature2 Feature to check (second level of permission) + * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal) + * @param string $dbt_select Field name for select if not rowid. (optionnal) + * @return int 1 */ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') { diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index 52e8f33f247..51dfe098b1b 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -51,6 +51,9 @@ class ActionsCardIndividual extends ActionsCardCommon /** * Return the title of card + * + * @param string $action Action code + * @return string Title */ private function getTitle($action) { @@ -67,9 +70,10 @@ class ActionsCardIndividual extends ActionsCardCommon /** - * Execute actions + * Execute actions * - * @param int $socid Id of object (may be empty for creation) + * @param int $socid Id of object (may be empty for creation) + * @return int <0 if KO, >0 if OK */ function doActions($socid) { @@ -79,9 +83,10 @@ class ActionsCardIndividual extends ActionsCardCommon } /** - * Assign custom values for canvas (for example into this->tpl to be used by templates) + * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param string $action Type of action + * @param string $action Type of action + * @return void */ function assign_values($action) { @@ -107,14 +112,15 @@ class ActionsCardIndividual extends ActionsCardCommon /** * Check permissions of a user to show a page and an object. Check read permission * If $_REQUEST['action'] defined, we also check write permission. - * @param user User to check - * @param features Features to check (in most cases, it's module name) - * @param objectid Object ID if we want to check permission on a particular record (optionnal) - * @param dbtablename Table name where object is stored. Not used if objectid is null (optionnal) - * @param feature2 Feature to check (second level of permission) - * @param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal) - * @param dbt_select Field name for select if not rowid. (optionnal) - * @return int 1 + * + * @param User $user User to check + * @param string $features Features to check (in most cases, it's module name) + * @param int $objectid Object ID if we want to check permission on a particular record (optionnal) + * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optionnal) + * @param string $feature2 Feature to check (second level of permission) + * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal) + * @param string $dbt_select Field name for select if not rowid. (optionnal) + * @return int 1 */ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') {