Fix: strict mode crazy

This commit is contained in:
Regis Houssin 2012-07-25 11:46:33 +02:00
parent e12604cb71
commit 7d2f7e9800
12 changed files with 207 additions and 195 deletions

View File

@ -230,7 +230,7 @@ class Contrat extends CommonObject
* @return void
*/
function cloture($user)
{
{
$this->db->begin();
// Load lines
@ -280,7 +280,7 @@ class Contrat extends CommonObject
function validate($user)
{
global $langs, $conf;
$error=0;
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1";
@ -352,7 +352,8 @@ class Contrat extends CommonObject
$this->note_private = $result["note_private"];
$this->note_public = $result["note_public"];
$this->fk_projet = $result["fk_projet"];
$this->fk_projet = $result["fk_projet"]; // deprecated
$this->fk_project = $result["fk_projet"];
$this->socid = $result["fk_soc"];
$this->fk_soc = $result["fk_soc"];
@ -441,7 +442,7 @@ class Contrat extends CommonObject
$line->statut = $objp->statut;
$line->remise_percent = $objp->remise_percent;
$line->price_ht = $objp->price_ht;
$line->price = $objp->price; // For backward compatibility
$line->price = $objp->price_ht; // For backward compatibility
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_localtax1 = $objp->total_localtax1;
@ -620,7 +621,7 @@ class Contrat extends CommonObject
if (! $paramsok) return -1;
$this->db->begin();
$now=dol_now();
// Insert contract
@ -702,7 +703,7 @@ class Contrat extends CommonObject
function delete($user)
{
global $conf, $langs;
$error=0;
$this->db->begin();
@ -790,7 +791,7 @@ class Contrat extends CommonObject
$error++;
}
}
if (! $error)
{
// Appel des triggers
@ -802,7 +803,7 @@ class Contrat extends CommonObject
}
// Fin appel triggers
}
if (! $error)
{
// We remove directory

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,7 +76,7 @@ $modulepart='contract';
/*
* Action envoie fichier
*/
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if (dol_mkdir($upload_dir) >= 0)
{
@ -135,7 +135,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$form = new Form($db);
llxHeader("","",$langs->trans("CardProduct".$product->type));
llxHeader();
if ($object->id)
@ -183,7 +183,7 @@ if ($object->id)
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$object->id,'',0,0,$user->rights->contrat->creer,50,$object);
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->contrat->creer,50,$object);
// List of document
@ -196,7 +196,7 @@ else
print $langs->trans("UnkownError");
}
$db->close();
llxFooter();
$db->close();
?>

View File

@ -31,10 +31,12 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/price.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php');
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/modules/contract/modules_contract.php");
if ($conf->produit->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
if (! empty($conf->propal->enabled)) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
if ($conf->projet->enabled) {
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
}
$langs->load("contracts");
$langs->load("orders");
@ -48,11 +50,13 @@ $socid = GETPOST('socid','int');
$id = GETPOST('id','int');
$ref=GETPOST('ref','alpha');
$datecontrat='';
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'contrat',$id);
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
$object = new Contrat($db);
@ -64,7 +68,7 @@ $object = new Contrat($db);
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer)
{
$object->fetch($id);
$result = $object->active_line($user, $_GET["ligne"], $_GET["date"], $_GET["dateend"], $_GET["comment"]);
$result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
if ($result > 0)
{
@ -79,7 +83,7 @@ if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->
else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer)
{
$object->fetch($id);
$result = $object->close_line($user, $_GET["ligne"], $_GET["dateend"], urldecode($_GET["comment"]));
$result = $object->close_line($user, GETPOST('ligne'), GETPOST('dateend'), urldecode(GETPOST('comment')));
if ($result > 0)
{
@ -92,32 +96,32 @@ else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->c
}
// Si ajout champ produit predefini
if ($_POST["mode"]=='predefined')
if (GETPOST('mode')=='predefined')
{
$date_start='';
$date_end='';
if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"])
if (GETPOST('date_startmonth') && GETPOST('date_startday') && GETPOST('date_startyear'))
{
$date_start=dol_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]);
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
}
if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"])
if (GETPOST('date_endmonth') && GETPOST('date_endday') && GETPOST('date_endyear'))
{
$date_end=dol_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]);
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
}
}
// Si ajout champ produit libre
if ($_POST["mode"]=='libre')
if (GETPOST('mode')=='libre')
{
$date_start_sl='';
$date_end_sl='';
if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"])
if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('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"]);
$date_start_sl=dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear'));
}
if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"])
if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('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_end_sl=dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear'));
}
}
@ -127,25 +131,25 @@ $date_start_update='';
$date_end_update='';
$date_start_real_update='';
$date_end_real_update='';
if ($_POST["date_start_updatemonth"] && $_POST["date_start_updateday"] && $_POST["date_start_updateyear"])
if (GETPOST('date_start_updatemonth') && GETPOST('date_start_updateday') && GETPOST('date_start_updateyear'))
{
$date_start_update=dol_mktime($_POST["date_start_updatehour"], $_POST["date_start_updatemin"], 0, $_POST["date_start_updatemonth"], $_POST["date_start_updateday"], $_POST["date_start_updateyear"]);
$date_start_update=dol_mktime(GETPOST('date_start_updatehour'), GETPOST('date_start_updatemin'), 0, GETPOST('date_start_updatemonth'), GETPOST('date_start_updateday'), GETPOST('date_start_updateyear'));
}
if ($_POST["date_end_updatemonth"] && $_POST["date_end_updateday"] && $_POST["date_end_updateyear"])
if (GETPOST('date_end_updatemonth') && GETPOST('date_end_updateday') && GETPOST('date_end_updateyear'))
{
$date_end_update=dol_mktime($_POST["date_end_updatehour"], $_POST["date_end_updatemin"], 0, $_POST["date_end_updatemonth"], $_POST["date_end_updateday"], $_POST["date_end_updateyear"]);
$date_end_update=dol_mktime(GETPOST('date_end_updatehour'), GETPOST('date_end_updatemin'), 0, GETPOST('date_end_updatemonth'), GETPOST('date_end_updateday'), GETPOST('date_end_updateyear'));
}
if ($_POST["date_start_real_updatemonth"] && $_POST["date_start_real_updateday"] && $_POST["date_start_real_updateyear"])
if (GETPOST('date_start_real_updatemonth') && GETPOST('date_start_real_updateday') && GETPOST('date_start_real_updateyear'))
{
$date_start_real_update=dol_mktime($_POST["date_start_real_updatehour"], $_POST["date_start_real_updatemin"], 0, $_POST["date_start_real_updatemonth"], $_POST["date_start_real_updateday"], $_POST["date_start_real_updateyear"]);
$date_start_real_update=dol_mktime(GETPOST('date_start_real_updatehour'), GETPOST('date_start_real_updatemin'), 0, GETPOST('date_start_real_updatemonth'), GETPOST('date_start_real_updateday'), GETPOST('date_start_real_updateyear'));
}
if ($_POST["date_end_real_updatemonth"] && $_POST["date_end_real_updateday"] && $_POST["date_end_real_updateyear"])
if (GETPOST('date_end_real_updatemonth') && GETPOST('date_end_real_updateday') && GETPOST('date_end_real_updateyear'))
{
$date_end_real_update=dol_mktime($_POST["date_end_real_updatehour"], $_POST["date_end_real_updatemin"], 0, $_POST["date_end_real_updatemonth"], $_POST["date_end_real_updateday"], $_POST["date_end_real_updateyear"]);
$date_end_real_update=dol_mktime(GETPOST('date_end_real_updatehour'), GETPOST('date_end_real_updatemin'), 0, GETPOST('date_end_real_updatemonth'), GETPOST('date_end_real_updateday'), GETPOST('date_end_real_updateyear'));
}
if ($_POST["remonth"] && $_POST["reday"] && $_POST["reyear"])
if (GETPOST('remonth') && GETPOST('reday') && GETPOST('reyear'))
{
$datecontrat = dol_mktime($_POST["rehour"], $_POST["remin"], 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datecontrat = dol_mktime(GETPOST('rehour'), GETPOST('remin'), 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
}
if ($action == 'add' && $user->rights->contrat->creer)
@ -153,13 +157,13 @@ if ($action == 'add' && $user->rights->contrat->creer)
$object->socid = $socid;
$object->date_contrat = $datecontrat;
$object->commercial_suivi_id = $_POST["commercial_suivi_id"];
$object->commercial_signature_id = $_POST["commercial_signature_id"];
$object->commercial_suivi_id = GETPOST('commercial_suivi_id','int');
$object->commercial_signature_id = GETPOST('commercial_signature_id','int');
$object->note = trim($_POST["note"]);
$object->fk_project = trim($_POST["projectid"]);
$object->remise_percent = trim($_POST["remise_percent"]);
$object->ref = trim($_POST["ref"]);
$object->note = GETPOST('note','alpha');
$object->fk_project = GETPOST('projectid','int');
$object->remise_percent = GETPOST('remise_percent','alpha');
$object->ref = GETPOST('ref','alpha');
// Check
if (empty($datecontrat))
@ -187,12 +191,12 @@ if ($action == 'add' && $user->rights->contrat->creer)
else if ($action == 'classin' && $user->rights->contrat->creer)
{
$object->fetch($id);
$object->setProject($_POST["projectid"]);
$object->setProject(GETPOST('projectid'));
}
else if ($action == 'addline' && $user->rights->contrat->creer)
{
if ($_POST["pqty"] && (($_POST["pu"] != '' && $_POST["desc"]) || $_POST["idprod"]))
if (GETPOST('pqty') && ((GETPOST('pu') != '' && GETPOST('desc')) || GETPOST('idprod')))
{
$ret=$object->fetch($id);
if ($ret < 0)
@ -205,27 +209,27 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$date_start='';
$date_end='';
// Si ajout champ produit libre
if ($_POST['mode'] == 'libre')
if (GETPOST('mode') == 'libre')
{
if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"])
if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('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"]);
$date_start=dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear'));
}
if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"])
if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('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"]);
$date_end=dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear'));
}
}
// Si ajout champ produit predefini
if ($_POST['mode'] == 'predefined')
if (GETPOST('mode') == 'predefined')
{
if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"])
if (GETPOST('date_startmonth') && GETPOST('date_startday') && GETPOST('date_startyear'))
{
$date_start=dol_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]);
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
}
if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"])
if (GETPOST('date_endmonth') && GETPOST('date_endday') && GETPOST('date_endyear'))
{
$date_end=dol_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]);
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
}
}
@ -233,10 +237,10 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
// Ecrase $base_price_type par celui du produit
if ($_POST['idprod'])
if (GETPOST('idprod'))
{
$prod = new Product($db);
$prod->fetch($_POST['idprod']);
$prod->fetch(GETPOST('idprod'));
$tva_tx = get_default_tva($mysoc,$object->thirdparty,$prod->id);
$tva_npr = get_default_npr($mysoc,$object->thirdparty,$prod->id);
@ -272,16 +276,16 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
}
$desc = $prod->description;
$desc.= $prod->description && $_POST['desc'] ? "\n" : "";
$desc.= $_POST['desc'];
$desc.= $prod->description && GETPOST('desc') ? "\n" : "";
$desc.= GETPOST('desc');
}
else
{
$pu_ht=$_POST['pu'];
$pu_ht=GETPOST('pu');
$price_base_type = 'HT';
$tva_tx=str_replace('*','',$_POST['tva_tx']);
$tva_npr=preg_match('/\*/',$_POST['tva_tx'])?1:0;
$desc=$_POST['desc'];
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
$desc=GETPOST('desc');
}
$localtax1_tx=get_localtax($tva_tx,1,$object->societe);
@ -290,7 +294,7 @@ else if ($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)))
if($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
{
$object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency));
$result = -1 ;
@ -301,12 +305,12 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$result = $object->addline(
$desc,
$pu_ht,
$_POST["pqty"],
GETPOST('pqty'),
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$_POST["idprod"],
$_POST["premise"],
GETPOST('idprod'),
GETPOST('premise'),
$date_start,
$date_end,
$price_base_type,
@ -342,7 +346,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
}
}
else if ($action == 'updateligne' && $user->rights->contrat->creer && ! $_POST["cancel"])
else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST('cancel'))
{
$ret=$object->fetch($id);
if ($ret < 0)
@ -353,22 +357,22 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! $_POST["
$object->fetch_thirdparty();
$objectline = new ContratLigne($db);
if ($objectline->fetch($_POST["elrowid"]))
if ($objectline->fetch(GETPOST('elrowid')))
{
$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;
$localtax1_tx=get_localtax($_POST["eltva_tx"],1,$object->thirdparty);
$localtax2_tx=get_localtax($_POST["eltva_tx"],2,$object->thirdparty);
$localtax1_tx=get_localtax(GETPOST('eltva_tx'),1,$object->thirdparty);
$localtax2_tx=get_localtax(GETPOST('eltva_tx'),2,$object->thirdparty);
$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->description=GETPOST('eldesc');
$objectline->price_ht=GETPOST('elprice');
$objectline->subprice=GETPOST('elprice');
$objectline->qty=GETPOST('elqty');
$objectline->remise_percent=GETPOST('elremise_percent');
$objectline->tva_tx=GETPOST('eltva_tx');
$objectline->localtax1_tx=$localtax1_tx;
$objectline->localtax2_tx=$localtax2_tx;
$objectline->date_ouverture_prevue=$date_start_update;
@ -399,7 +403,7 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! $_POST["
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
{
$object->fetch($id);
$result = $object->deleteline($_GET["lineid"],$user);
$result = $object->deleteline(GETPOST('lineid'),$user);
if ($result >= 0)
{
@ -443,11 +447,11 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->cont
else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer)
{
if ($_POST['newcid'] > 0)
if (GETPOST('newcid') > 0)
{
$contractline = new ContratLigne($db);
$result=$contractline->fetch($_GET["lineid"]);
$contractline->fk_contrat = $_POST["newcid"];
$result=$contractline->fetch(GETPOST('lineid'));
$contractline->fk_contrat = GETPOST('newcid');
$result=$contractline->update($user,1);
if ($result >= 0)
{
@ -486,7 +490,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
if ($result > 0 && $id > 0)
{
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
$result = $result = $object->add_contact($contactid, GETPOST('type'), GETPOST('source'));
}
if ($result >= 0)
@ -525,7 +529,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
else if ($action == 'deletecontact' && $user->rights->contrat->creer)
{
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST('lineid'));
if ($result >= 0)
{
@ -557,7 +561,7 @@ $objectlignestatic=new ContratLigne($db);
*********************************************************************/
if ($action == 'create')
{
dol_fiche_head($head, $a, $langs->trans("AddContract"), 0, 'contract');
dol_fiche_head('', '', $langs->trans("AddContract"), 0, 'contract');
dol_htmloutput_errors($mesg,'');
@ -565,7 +569,6 @@ if ($action == 'create')
$soc->fetch($socid);
$object->date_contrat = dol_now();
if ($contratid) $result=$object->fetch($contratid);
$numct = $object->getNextNumRef($soc);
@ -713,7 +716,7 @@ else
/*
* Contrat
*/
if ($object->brouillon && $user->rights->contrat->creer)
if (! empty($object->brouillon) && $user->rights->contrat->creer)
{
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -776,7 +779,7 @@ else
print "</table>";
if ($object->brouillon == 1 && $user->rights->contrat->creer)
if (! empty($object->brouillon) && $user->rights->contrat->creer)
{
print '</form>';
}
@ -857,7 +860,7 @@ else
$var=!$var;
if ($action != 'editline' || $_GET["rowid"] != $objp->rowid)
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{
print '<tr '.$bc[$var].' valign="top">';
// Libelle
@ -956,7 +959,7 @@ else
print '<form name="update" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateligne">';
print '<input type="hidden" name="elrowid" value="'.$_GET["rowid"].'">';
print '<input type="hidden" name="elrowid" value="'.GETPOST('rowid').'">';
// Ligne carac
print "<tr $bc[$var]>";
print '<td>';
@ -1016,16 +1019,16 @@ else
/*
* Confirmation to delete service line of contract
*/
if ($action == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"])
if ($action == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == GETPOST('rowid'))
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1);
$ret=$form->form_confirm($_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>';
}
/*
* Confirmation to move service toward another contract
*/
if ($action == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == $_GET["rowid"])
if ($action == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == GETPOST('rowid'))
{
$arraycontractid=array();
foreach($arrayothercontracts as $contractcursor)
@ -1038,31 +1041,31 @@ else
'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".$_GET["rowid"],$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
$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>';
}
/*
* Confirmation de la validation activation
*/
if ($action == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"])
if ($action == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == GETPOST('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"];
$form->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);
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$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>';
}
/*
* Confirmation de la validation fermeture
*/
if ($action == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == $_GET["ligne"])
if ($action == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline-1]->id == GETPOST('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"];
$form->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);
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$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>';
}
@ -1120,12 +1123,12 @@ else
print '</table>';
}
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"])
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline-1]->id == GETPOST('ligne'))
{
/**
* Activer la ligne de contrat
*/
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.$_GET["ligne"].'&amp;action=active" method="post">';
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="noborder" width="100%">';
@ -1133,11 +1136,11 @@ else
// 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"]);
if (GETPOST('remonth')) $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
elseif (! $dateactstart) $dateactstart = time();
$dateactend = $objp->date_fin;
if ($_POST["endmonth"]) $dateactend = dol_mktime(12, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
if (GETPOST('endmonth')) $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
elseif (! $dateactend)
{
if ($objp->fk_product > 0)
@ -1163,14 +1166,14 @@ else
print '</tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="80" type="text" name="comment" value="'.$_POST["comment"].'"></td></tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td colspan="3"><input size="80" type="text" name="comment" value="'.GETPOST('comment').'"></td></tr>';
print '</table>';
print '</form>';
}
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline-1]->id == $_GET["ligne"])
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline-1]->id == GETPOST('ligne'))
{
/**
* Desactiver la ligne de contrat
@ -1182,11 +1185,11 @@ else
// 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"]);
if (GETPOST('remonth')) $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('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"]);
if (GETPOST('endmonth')) $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
elseif (! $dateactend)
{
if ($objp->fk_product > 0)
@ -1214,7 +1217,7 @@ else
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td><input size="70" type="text" class="flat" name="comment" value="'.$_POST["comment"].'"></td></tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("Comment").'</td><td><input size="70" type="text" class="flat" name="comment" value="'.GETPOST('comment').'"></td></tr>';
print '</table>';
print '</form>';

View File

@ -30,17 +30,17 @@ require_once (DOL_DOCUMENT_ROOT."/product/class/product.class.php");
$langs->load("products");
$langs->load("companies");
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:(isset($_POST["sortfield"])?$_POST["sortfield"]:'');
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:(isset($_POST["sortorder"])?$_POST["sortorder"]:'');
$page = isset($_GET["page"])?$_GET["page"]:(isset($_POST["page"])?$_POST["page"]:'');
$sortfield=GETPOST('sortfield','alpha');
$sortorder=GETPOST('sortorder','alpha');
$page=GETPOST('page','int');
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
$statut=GETPOST('statut')?GETPOST('statut'):1;
// Security check
$socid=0;
$id = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat',$id,'');
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat', $id);
$staticcompany=new Societe($db);
$staticcontrat=new Contrat($db);
@ -71,7 +71,7 @@ print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td width="30%" valign="top" class="notopnoleft">';
// Search contract
if ($conf->contrat->enabled)
if (! empty($conf->contrat->enabled))
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/liste.php">';
@ -181,8 +181,8 @@ $var=true;
$listofstatus=array(0,4,4,5); $bool=false;
foreach($listofstatus as $status)
{
$dataseries[]=array('label'=>$staticcontratligne->LibStatut($status,1,($bool?1:0)),'data'=>($nb[$status.$bool]?(int) $nb[$status.$bool]:0));
if (! $conf->use_javascript_ajax)
$dataseries[]=array('label'=>$staticcontratligne->LibStatut($status,1,($bool?1:0)),'data'=>(isset($nb[$status.$bool])?(int) $nb[$status.$bool]:0));
if (empty($conf->use_javascript_ajax))
{
$var=!$var;
print '<tr '.$bc[$var].'>';
@ -193,7 +193,7 @@ foreach($listofstatus as $status)
if ($status==4 && $bool==false) $bool=true;
else $bool=false;
}
if ($conf->use_javascript_ajax)
if (! empty($conf->use_javascript_ajax))
{
print '<tr><td align="center" colspan="2">';
$data=array('series'=>$dataseries);
@ -204,7 +204,7 @@ $var=true;
$listofstatus=array(0,4,4,5); $bool=false;
foreach($listofstatus as $status)
{
if (! $conf->use_javascript_ajax)
if (empty($conf->use_javascript_ajax))
{
$var=!$var;
print '<tr '.$bc[$var].'>';
@ -223,7 +223,7 @@ print "</table><br>";
/**
* Draft contratcs
*/
if ($conf->contrat->enabled && $user->rights->contrat->lire)
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$sql = "SELECT c.rowid as ref, c.rowid,";
$sql.= " s.nom, s.rowid as socid";

View File

@ -30,26 +30,26 @@ $langs->load("contracts");
$langs->load("products");
$langs->load("companies");
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
$sortfield=GETPOST('sortfield','alpha');
$sortorder=GETPOST('sortorder','alpha');
$page=GETPOST('page','int');
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$search_nom=isset($_GET["search_nom"])?$_GET["search_nom"]:$_POST["search_nom"];
$search_contract=isset($_GET["search_contract"])?$_GET["search_contract"]:$_POST["search_contract"];
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
$socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid'];
$search_nom=GETPOST('search_nom');
$search_contract=GETPOST('search_contract');
$sall=GETPOST('sall');
$statut=GETPOST('statut')?GETPOST('statut'):1;
$socid=GETPOST('socid');
if (! $sortfield) $sortfield="c.rowid";
if (! $sortorder) $sortorder="DESC";
// Security check
$contratid = isset($_GET["id"])?$_GET["id"]:'';
$id=GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat', $contratid,'');
$result = restrictedArea($user, 'contrat', $id);
$staticcontrat=new Contrat($db);
$staticcontratligne=new ContratLigne($db);
@ -64,11 +64,11 @@ $now=dol_now();
llxHeader();
$sql = 'SELECT';
$sql.= ' sum('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= ".$db->idate($now).")",1,0).') as nb_running,';
$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < ".$db->idate($now).")",1,0).') as nb_expired,';
$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < ".$db->idate($now - $conf->contrat->services->expires->warning_delay).")",1,0).') as nb_late,';
$sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= ".$db->idate($now).")",1,0).') as nb_running,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < ".$db->idate($now).")",1,0).') as nb_expired,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < ".$db->idate($now - $conf->contrat->services->expires->warning_delay).")",1,0).') as nb_late,';
$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,";
$sql.= " s.nom, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -79,9 +79,9 @@ $sql.= " WHERE c.fk_soc = s.rowid ";
$sql.= " AND c.entity = ".$conf->entity;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_nom) $sql.= " AND s.nom like '%".$db->escape($search_nom)."%'";
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'";
if ($sall) $sql.= " AND (s.nom like '%".$db->escape($sall)."%' OR cd.label like '%".$db->escape($sall)."%' OR cd.description like '%".$db->escape($sall)."%')";
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR cd.label LIKE '%".$db->escape($sall)."%' OR cd.description LIKE '%".$db->escape($sall)."%')";
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut,";
$sql.= " s.nom, s.rowid";
$sql.= " ORDER BY $sortfield $sortorder";
@ -93,7 +93,7 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num);
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_nom='.$search_nom, $sortfield, $sortorder,'',$num);
print '<table class="liste" width="100%">';
@ -111,7 +111,7 @@ if ($resql)
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(5,3).'</td>';
print "</tr>\n";
print '<form method="POST" action="liste.php">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
@ -151,7 +151,6 @@ if ($resql)
$db->free($resql);
print "</table>";
}
else
{
@ -159,7 +158,6 @@ else
}
$db->close();
llxFooter();
$db->close();
?>

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -47,13 +47,22 @@ $filter=GETPOST("filter");
$search_nom=GETPOST("search_nom");
$search_contract=GETPOST("search_contract");
$search_service=GETPOST("search_service");
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
$statut=GETPOST('statut')?GETPOST('statut'):1;
$socid=GETPOST('socid','int');
$op1month=GETPOST('op1month');
$op1day=GETPOST('op1day');
$op1year=GETPOST('op1year');
$filter_op1=GETPOST('filter_op1');
$op2month=GETPOST('op2month');
$op2day=GETPOST('op2day');
$op2year=GETPOST('op2year');
$filter_op2=GETPOST('filter_op2');
// Security check
$contratid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat',$contratid,'');
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat',$contratid);
$staticcontrat=new Contrat($db);
@ -92,14 +101,14 @@ if ($mode == "0") $sql.= " AND cd.statut = 0";
if ($mode == "4") $sql.= " AND cd.statut = 4";
if ($mode == "5") $sql.= " AND cd.statut = 5";
if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
if ($search_nom) $sql.= " AND s.nom like '%".$db->escape($search_nom)."%'";
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'";
if ($search_service) $sql.= " AND (p.ref like '%".$db->escape($search_service)."%' OR p.description like '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
$filter_date1=dol_mktime(0,0,0,$_REQUEST['op1month'],$_REQUEST['op1day'],$_REQUEST['op1year']);
$filter_date2=dol_mktime(0,0,0,$_REQUEST['op2month'],$_REQUEST['op2day'],$_REQUEST['op2year']);
if (! empty($_REQUEST['filter_op1']) && $_REQUEST['filter_op1'] != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$_REQUEST['filter_op1']." ".$db->idate($filter_date1);
if (! empty($_REQUEST['filter_op2']) && $_REQUEST['filter_op2'] != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$_REQUEST['filter_op2']." ".$db->idate($filter_date2);
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." ".$db->idate($filter_date1);
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." ".$db->idate($filter_date2);
$sql .= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset);
@ -117,10 +126,10 @@ if ($resql)
if ($search_service) $param.='&amp;search_service='.urlencode($search_service);
if ($mode) $param.='&amp;mode='.$mode;
if ($filter) $param.='&amp;filter='.$filter;
if (! empty($_REQUEST['filter_op1']) && $_REQUEST['filter_op1'] != -1) $param.='&amp;filter_op1='.urlencode($_REQUEST['filter_op1']);
if (! empty($_REQUEST['filter_op2']) && $_REQUEST['filter_op2'] != -1) $param.='&amp;filter_op2='.urlencode($_REQUEST['filter_op2']);
if ($filter_date1 != '') $param.='&amp;op1day='.$_REQUEST['op1day'].'&amp;op1month='.$_REQUEST['op1month'].'&amp;op1year='.$_REQUEST['op1year'];
if ($filter_date2 != '') $param.='&amp;op2day='.$_REQUEST['op2day'].'&amp;op2month='.$_REQUEST['op2month'].'&amp;op2year='.$_REQUEST['op2year'];
if (! empty($filter_op1) && $filter_op1 != -1) $param.='&amp;filter_op1='.urlencode($filter_op1);
if (! empty($filter_op2) && $filter_op2 != -1) $param.='&amp;filter_op2='.urlencode($filter_op2);
if ($filter_date1 != '') $param.='&amp;op1day='.$op1day.'&amp;op1month='.$op1month.'&amp;op1year='.$op1year;
if ($filter_date2 != '') $param.='&amp;op2day='.$op2day.'&amp;op2month='.$op2month.'&amp;op2year='.$op2year;
$title=$langs->trans("ListOfServices");
if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0"
@ -163,16 +172,16 @@ if ($resql)
print '</td>';
print '<td class="liste_titre" align="center">';
$arrayofoperators=array('<'=>'<','>'=>'>');
print $form->selectarray('filter_op1',$arrayofoperators,$_REQUEST['filter_op1'],1);
print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1);
print ' ';
$filter_date1=dol_mktime(0,0,0,$_REQUEST['op1month'],$_REQUEST['op1day'],$_REQUEST['op1year']);
$filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year);
print $form->select_date($filter_date1,'op1',0,0,1);
print '</td>';
print '<td class="liste_titre" align="center">';
$arrayofoperators=array('<'=>'<','>'=>'>');
print $form->selectarray('filter_op2',$arrayofoperators,$_REQUEST['filter_op2'],1);
print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1);
print ' ';
$filter_date2=dol_mktime(0,0,0,$_REQUEST['op2month'],$_REQUEST['op2day'],$_REQUEST['op2year']);
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
print $form->select_date($filter_date2,'op2',0,0,1);
print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
@ -204,7 +213,7 @@ if ($resql)
$productstatic->ref=$obj->pref;
print $productstatic->getNomUrl(1,'',20);
print $obj->label?' - '.dol_trunc($obj->label,16):'';
if ($obj->description && $conf->global->PRODUIT_DESC_IN_LIST) print '<br>'.dol_nl2br($obj->description);
if (! empty($obj->description) && ! empty($conf->global->PRODUIT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);
}
else
{

View File

@ -42,6 +42,8 @@ abstract class CommonObject
public $nom;
public $civility_id;
public $array_options=array();
// No constructor as it is an abstract class

View File

@ -2760,11 +2760,11 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
if (! $found)
{
// If vat of product for the country not found or not defined, we return higher vat of country.
$sql.="SELECT taux as vat_rate";
$sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql.=" WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'";
$sql.=" ORDER BY t.taux DESC, t.recuperableonly ASC";
$sql.=$db->plimit(1);
$sql = "SELECT taux as vat_rate";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql.= " WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'";
$sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC";
$sql.= $db->plimit(1);
$resql=$db->query($sql);
if ($resql)

View File

@ -29,11 +29,11 @@ require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/order.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/sendings.lib.php");
if ($conf->product->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
if ($conf->stock->enabled) require_once(DOL_DOCUMENT_ROOT."/product/stock/class/entrepot.class.php");
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
if (! empty($conf->projet->enabled)) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
if (! empty($conf->propal->enabled)) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
if (! empty($conf->stock->enabled)) require_once(DOL_DOCUMENT_ROOT."/product/stock/class/entrepot.class.php");
$langs->load('orders');
$langs->load("companies");
@ -48,7 +48,7 @@ $action=GETPOST('action','alpha');
// Security check
$socid=0;
if ($user->societe_id) $socid=$user->societe_id;
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result=restrictedArea($user,'commande',$id);
@ -518,7 +518,7 @@ if ($id > 0 || ! empty($ref))
// Define a new tree with quantiies recalculated
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
//var_dump($prods_arbo);
if(count($prods_arbo) > 0)
if (count($prods_arbo) > 0)
{
foreach($prods_arbo as $key => $value)
{
@ -529,11 +529,11 @@ if ($id > 0 || ! empty($ref))
{
$img=img_warning($langs->trans("StockTooLow"));
}
print "<tr><td>&nbsp; &nbsp; &nbsp; ->
<a href=\"".DOL_URL_ROOT."/product/fiche.php?id=".$value['id']."\">".$value['fullpath']."
</a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td>&nbsp</td><td>&nbsp</td>
<td align=\"center\">".$value['stock']." ".$img."</td></tr>";
print $value[0];
print '<tr><td>&nbsp; &nbsp; &nbsp; -> <a href="'.DOL_URL_ROOT."/product/fiche.php?id=".$value['id'].'">'.$value['fullpath'].'</a> ('.$value['nb'].')</td>';
print '<td align="center"> '.$value['nb_total'].'</td>';
print '<td>&nbsp</td>';
print '<td>&nbsp</td>';
print '<td align="center">'.$value['stock'].' '.$img.'</td></tr>'."\n";
print '</td></tr>'."\n";
}

View File

@ -722,7 +722,7 @@ $bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"');
$bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"');
// Define messages variables
$mesg=''; $mesgs=array();
$mesg=''; $mesgs=array(); $warning=''; $warnings=array(); $error=0; $errors=array();
if (isset($_SESSION['dol_message']))
{
$mesgs[]=$_SESSION['dol_message'];

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -164,8 +165,6 @@ class CompanyBankAccount extends Account
$this->id = $obj->rowid;
$this->socid = $obj->fk_soc;
$this->bank = $obj->bank;
$this->courant = $obj->courant;
$this->clos = $obj->clos;
$this->code_banque = $obj->code_banque;
$this->code_guichet = $obj->code_guichet;
$this->number = $obj->number;

View File

@ -1696,7 +1696,7 @@ else
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
$value=(GETPOST('options_'.$key)?GETPOST('options_'.$key):(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";