Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2011-12-14 23:03:21 +01:00
commit 6a8787d3a8
10 changed files with 409 additions and 263 deletions

View File

@ -22,7 +22,7 @@ PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files
TCPDF 5.9.098 LGPL 3.0 Yes PDF generation TCPDF 5.9.098 LGPL 3.0 Yes PDF generation
JS libraries: JS libraries:
jQuery 1.6.4 GPL and MIT Licence Yes JS library jQuery 1.7.1 GPL and MIT Licence Yes JS library
jQuery UI 1.8.16 GPL and MIT Licence Yes JS library plugin UI jQuery UI 1.8.16 GPL and MIT Licence Yes JS library plugin UI
jQuery Colorpicker 1.1 MIT Licence Yes JS library for color picker for a defined list of colors jQuery Colorpicker 1.1 MIT Licence Yes JS library for color picker for a defined list of colors
jQuery DataTable 1.8.1 BSD Yes JS library for tables output jQuery DataTable 1.8.1 BSD Yes JS library for tables output

View File

@ -198,7 +198,7 @@ if ($_SESSION['dol_dst']>0)
print ($_SESSION['dol_dst']>0?'+':'').($_SESSION['dol_dst']).' ('.($_SESSION['dol_dst']>0?'+':'').($_SESSION['dol_dst']*60*60).')'; print ($_SESSION['dol_dst']>0?'+':'').($_SESSION['dol_dst']).' ('.($_SESSION['dol_dst']>0?'+':'').($_SESSION['dol_dst']*60*60).')';
} }
else print yn(0); else print yn(0);
if (isset($_SESSION['dol_dst_first'])) print '     ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']),'dayhour','gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']),'dayhour','gmt').')'; if (! empty($_SESSION['dol_dst_first'])) print '     ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']),'dayhour','gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']),'dayhour','gmt').')';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n"; print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";

View File

@ -609,11 +609,11 @@ if ($id)
{ {
if ($error) if ($error)
{ {
print '<div class="error">'.$error.'</div><br>'; dol_htmloutput_errors($error);
} }
if ($mesg) if ($mesg)
{ {
print $mesg.'<br>'; dol_htmloutput_mesg($mesg);
} }
$act = new ActionComm($db); $act = new ActionComm($db);

View File

@ -116,10 +116,11 @@ class Propal extends CommonObject
/** /**
* \brief Constructeur * Class Constructor
* \param DB Database handler *
* \param socid Id third party * @param DoliDB $DB Database handler
* \param propalid Id proposal * @param int $socid Id third party
* @param int $propalid Id proposal
*/ */
function Propal($DB, $socid="", $propalid=0) function Propal($DB, $socid="", $propalid=0)
{ {
@ -152,9 +153,11 @@ class Propal extends CommonObject
/** /**
* Add line into array products * Add line into array products
* $this->client doit etre charge * $this->client doit etre charge
* @param idproduct Id du produit a ajouter *
* @param qty Quantity * @param int $idproduct Product Id to add
* @param remise_percent Remise relative effectuee sur le produit * @param int $qty Quantity
* @param int $remise_percent Discount effected on Product
*
* TODO Remplacer les appels a cette fonction par generation objet Ligne * TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products * insere dans tableau $this->products
*/ */
@ -201,9 +204,10 @@ class Propal extends CommonObject
} }
/** /**
* \brief Ajout d'une ligne remise fixe dans la proposition, en base * Adding line of fixed discount in the proposal in DB
* \param idremise Id de la remise fixe *
* \return int >0 si ok, <0 si ko * @param int @idremise Id of fixed discount
* @return int >0 si ok, <0 si ko
*/ */
function insert_discount($idremise) function insert_discount($idremise)
{ {
@ -282,23 +286,24 @@ class Propal extends CommonObject
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
* *
* @param propalid Id de la propale * @param int $propalid Id de la propale
* @param desc Description de la ligne * @param string $desc Description de la ligne
* @param pu_ht Prix unitaire * @param double $pu_ht Prix unitaire
* @param qty Quantite * @param double $qty Quantite
* @param txtva Taux de tva * @param double $txtva Taux de tva
* @param txlocaltax1 Local tax 1 rate * @param double $txlocaltax1 Local tax 1 rate
* @param txlocaltax2 Local tax 2 rate * @param double $txlocaltax2 Local tax 2 rate
* @param fk_product Id du produit/service predefini * @param int $fk_product Id du produit/service predefini
* @param remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @param price_base_type HT or TTC * @param double $price_base_type HT or TTC
* @param pu_ttc Prix unitaire TTC * @param dobule $pu_ttc Prix unitaire TTC
* @param info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param type Type of line (product, service) * @param int $type Type of line (product, service)
* @param rang Position of line * @param int $rang Position of line
* @param special_code Special code * @param int $special_code Special code
* @param fk_parent_line Id of parent line * @param int $fk_parent_line Id of parent line
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*
* @see add_product * @see add_product
*/ */
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0) function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0)
@ -432,19 +437,19 @@ class Propal extends CommonObject
/** /**
* Update a proposal line * Update a proposal line
* *
* @param rowid Id de la ligne * @param int $rowid Id de la ligne
* @param pu Prix unitaire (HT ou TTC selon price_base_type) * @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
* @param qty Quantity * @param double $qty Quantity
* @param remise_percent Remise effectuee sur le produit * @param double $remise_percent Remise effectuee sur le produit
* @param txtva Taux de TVA * @param double $txtva Taux de TVA
* @param txlocaltax1 Local tax 1 rate * @param double $txlocaltax1 Local tax 1 rate
* @param txlocaltax2 Local tax 2 rate * @param double $txlocaltax2 Local tax 2 rate
* @param desc Description * @param string $desc Description
* @param price_base_type HT ou TTC * @param double $price_base_type HT ou TTC
* @param info_bits Miscellanous informations * @param int $info_bits Miscellanous informations
* @param special_code Set special code ('' = we don't change it) * @param int $special_code Set special code ('' = we don't change it)
* @param fk_parent_line Id of line parent * @param int $fk_parent_line Id of line parent
* @param skip_update_total Skip update total * @param int $skip_update_total Skip update total
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0) function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0)
@ -555,7 +560,7 @@ class Propal extends CommonObject
/** /**
* Supprime une ligne de detail * Delete detail line
* *
* @param int $lineid Id of line to delete * @param int $lineid Id of line to delete
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
@ -592,7 +597,7 @@ class Propal extends CommonObject
* this->ref can be set or empty. If empty, we will use "(PROVid)" * this->ref can be set or empty. If empty, we will use "(PROVid)"
* *
* @param User $user User that create * @param User $user User that create
* @param int $notrigger Disable trigger * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function create($user='', $notrigger=0) function create($user='', $notrigger=0)
@ -822,9 +827,10 @@ class Propal extends CommonObject
/** /**
* \brief Insert en base un objet propal completement definie par ses donnees membres (resultant d'une copie par exemple). * Insert into DB a proposal object completely defined by its data members (ex, results from copy).
* \return int l'id du nouvel objet propal en base si ok, <0 si ko * @param User $user User that create
* \see create * @return int Id of the new object if ok, <0 if ko
* @see create
*/ */
function create_from($user) function create_from($user)
{ {
@ -933,10 +939,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Load a proposal from database and its ligne array * Load a proposal from database and its ligne array
* \param rowid id of object to load *
* \param ref Ref of proposal * @param int $rowid id of object to load
* \return int >0 if OK, <0 if KO * @param string $ref Ref of proposal
* @return int >0 if OK, <0 if KO
*/ */
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {
@ -1128,6 +1135,7 @@ class Propal extends CommonObject
* Set status to validated * Set status to validated
* *
* @param User $user Object user that validate * @param User $user Object user that validate
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function valid($user, $notrigger=0) function valid($user, $notrigger=0)
@ -1213,10 +1221,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Define end validity date * Define end validity date
* \param user Object user that modify *
* \param date_fin_validite End of validity date * @param User $user Object user that modify
* \return int <0 if KO, >0 if OK * @param timestamp $date_fin_validite End of validity date
* @return int <0 if KO, >0 if OK
*/ */
function set_echeance($user, $date_fin_validite) function set_echeance($user, $date_fin_validite)
{ {
@ -1239,10 +1248,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Set delivery date * Set delivery date
* \param user Objet utilisateur qui modifie *
* \param date_livraison date de livraison * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param timestamp $date_livraison Delivery date
* @return int <0 if ko, >0 if ok
*/ */
function set_date_livraison($user, $date_livraison) function set_date_livraison($user, $date_livraison)
{ {
@ -1267,10 +1277,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Define delivery address * Define delivery address
* \param user Objet utilisateur qui modifie *
* \param fk_address Delivery address id * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param int $fk_address Delivery address id
* @return int <0 si ko, >0 si ok
*/ */
function set_adresse_livraison($user, $fk_address) function set_adresse_livraison($user, $fk_address)
{ {
@ -1296,7 +1307,7 @@ class Propal extends CommonObject
/** /**
* Set delivery * Set delivery
* *
* @param User $user Objet utilisateur qui modifie * @param User $user Object user that modify
* @param int $id Availability id * @param int $id Availability id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -1325,7 +1336,7 @@ class Propal extends CommonObject
/** /**
* Set source of demand * Set source of demand
* *
* @param User $user Objet utilisateur qui modifie * @param User $user Object user that modify
* @param int $id Input reason id * @param int $id Input reason id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -1352,11 +1363,11 @@ class Propal extends CommonObject
} }
/** /**
* Positionne numero reference client * Set customer reference number
* *
* @param user Utilisateur qui modifie * @param User $user Object user that modify
* @param ref_client Reference client * @param string $ref_client Customer reference
* @return int <0 si ko, >0 si ok * @return int <0 if ko, >0 if ok
*/ */
function set_ref_client($user, $ref_client) function set_ref_client($user, $ref_client)
{ {
@ -1385,10 +1396,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Definit une remise globale relative sur la proposition * Set an overall discount on the proposal
* \param user Objet utilisateur qui modifie *
* \param remise Montant remise * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param double $remise Amount discount
* @return int <0 if ko, >0 if ok
*/ */
function set_remise_percent($user, $remise) function set_remise_percent($user, $remise)
{ {
@ -1418,10 +1430,11 @@ class Propal extends CommonObject
/** /**
* \brief Definit une remise globale absolue sur la proposition * Set an absolute overall discount on the proposal
* \param user Objet utilisateur qui modifie *
* \param remise Montant remise * @param User $user Object user that modify
* \return int <0 si ko, >0 si ok * @param double $remise Amount discount
* @return int <0 if ko, >0 if ok
*/ */
function set_remise_absolue($user, $remise) function set_remise_absolue($user, $remise)
{ {
@ -1452,11 +1465,11 @@ class Propal extends CommonObject
/** /**
* \brief Cloture de la proposition commerciale * Closure of the commercial proposal
* \param user Utilisateur qui cloture * @param User $user Object user that closure
* \param statut Statut * @param int $statut Statut
* \param note Commentaire * @param text $note Commentaire
* \return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function cloture($user, $statut, $note) function cloture($user, $statut, $note)
{ {
@ -1517,8 +1530,9 @@ class Propal extends CommonObject
} }
/** /**
* \brief Classe la propale comme facturee * Class invoiced the Propal
* \return int <0 si ko, >0 si ok *
* @return int <0 si ko, >0 si ok
*/ */
function classer_facturee() function classer_facturee()
{ {
@ -1561,14 +1575,14 @@ class Propal extends CommonObject
/** /**
* Return list of proposal (eventually filtered on user) into an array * Return list of proposal (eventually filtered on user) into an array
* *
* @param shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref) * @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref)
* @param draft 0=not draft, 1=draft * @param int $draft 0=not draft, 1=draft
* @param notcurrentuser 0=current user, 1=not current user * @param int $notcurrentuser 0=current user, 1=not current user
* @param socid Id third pary * @param int $socid Id third pary
* @param limit For pagination * @param int $limit For pagination
* @param offset For pagination * @param int $offset For pagination
* @param sortfield Sort criteria * @param string $sortfield Sort criteria
* @param sortorder Sort order * @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK * @return int -1 if KO, array with result if OK
*/ */
function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC')
@ -1623,9 +1637,9 @@ class Propal extends CommonObject
} }
/** /**
* Renvoie un tableau contenant les numeros de factures associees * Returns an array with the numbers of related invoices
* *
* @return array Tableau des id de factures * @return array Array of invoices
*/ */
function getInvoiceArrayList() function getInvoiceArrayList()
{ {
@ -1633,7 +1647,7 @@ class Propal extends CommonObject
} }
/** /**
* Renvoie un tableau contenant les id et ref des factures associees * Returns an array with id and ref of related invoices
* *
* @param int $id Id propal * @param int $id Id propal
* @return array Array of invoices id * @return array Array of invoices id
@ -1715,8 +1729,11 @@ class Propal extends CommonObject
} }
/** /**
* \brief Efface propal * Delete proposal
* \param user Objet du user qui efface *
* @param User $user Object user that delete
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int 1 if ok, otherwise if error
*/ */
function delete($user, $notrigger=0) function delete($user, $notrigger=0)
{ {
@ -1808,9 +1825,9 @@ class Propal extends CommonObject
/** /**
* Change les conditions de reglement de la facture * Change the payments conditions of the invoice
* *
* @param cond_reglement_id Id de la nouvelle condition de reglement * @param int $cond_reglement_id Id of new payment condition
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function cond_reglement($cond_reglement_id) function cond_reglement($cond_reglement_id)
@ -1843,9 +1860,9 @@ class Propal extends CommonObject
/** /**
* Change le mode de reglement * Change the payment mode
* *
* @param mode_reglement_id Id du nouveau mode * @param int $mode_reglement_id Id of new payment mode
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function mode_reglement($mode_reglement_id) function mode_reglement($mode_reglement_id)
@ -1877,9 +1894,9 @@ class Propal extends CommonObject
} }
/** /**
* Change le delai de livraison * Change the delivery time
* *
* @param availability_id Id du nouveau delai de livraison * @param int $availability_id Id of new delivery time
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function availability($availability_id) function availability($availability_id)
@ -1911,9 +1928,10 @@ class Propal extends CommonObject
} }
/** /**
* \brief Change l'origine de la demande * Change source demand
* \param demand_reason_id Id de la nouvelle origine de demande *
* \return int >0 si ok, <0 si ko * @param int $demand_reason_id Id of new source demand
* @return int >0 si ok, <0 si ko
*/ */
function demand_reason($demand_reason_id) function demand_reason($demand_reason_id)
{ {
@ -1945,8 +1963,9 @@ class Propal extends CommonObject
/** /**
* \brief Information sur l'objet propal * Object Proposal Information
* \param id id de la propale *
* @param int $id Proposal id
*/ */
function info($id) function info($id)
{ {
@ -2002,7 +2021,8 @@ class Propal extends CommonObject
/** /**
* Return label of status of proposal (draft, validated, ...) * Return label of status of proposal (draft, validated, ...)
* @param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto *
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
@ -2012,8 +2032,9 @@ class Propal extends CommonObject
/** /**
* Return label of a status (draft, validated, ...) * Return label of a status (draft, validated, ...)
* @param statut id statut *
* @param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $statut id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut,$mode=1) function LibStatut($statut,$mode=1)
@ -2066,8 +2087,9 @@ class Propal extends CommonObject
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* @param user Objet user *
* @param mode "opened" pour propal a fermer, "signed" pour propale a facturer * @param User $user Object user
* @param int $mode "opened" for proposal to close, "signed" for proposal to invoice
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_board($user,$mode) function load_board($user,$mode)
@ -2213,7 +2235,7 @@ class Propal extends CommonObject
/** /**
* Charge indicateurs this->nb de tableau de bord * Charge indicateurs this->nb de tableau de bord
* *
* @return int <0 si ko, >0 si ok * @return int <0 if ko, >0 if ok
*/ */
function load_state_board() function load_state_board()
{ {
@ -2252,8 +2274,8 @@ class Propal extends CommonObject
/** /**
* Renvoie la reference de propale suivante non utilisee en fonction du module * Returns the reference to the following non used Proposal used depending on the active numbering module
* de numerotation actif defini dans PROPALE_ADDON * defined into PROPALE_ADDON
* *
* @param Societe $soc Object thirdparty * @param Societe $soc Object thirdparty
* @return string Reference libre pour la propale * @return string Reference libre pour la propale
@ -2299,9 +2321,10 @@ class Propal extends CommonObject
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* @param withpicto Add picto into link *
* @param option Where point the link * @param int $withpicto Add picto into link
* @param get_params Parametres added to url * @param string $option Where point the link
* @param string $get_params Parametres added to url
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='', $get_params='') function getNomUrl($withpicto=0,$option='', $get_params='')
@ -2333,7 +2356,9 @@ class Propal extends CommonObject
} }
/** /**
* Return an array of propal lines * Retrieve an array of propal lines
*
* @return int <0 if ko, >0 if ok
*/ */
function getLinesArray() function getLinesArray()
{ {
@ -2459,8 +2484,9 @@ class PropaleLigne
var $skip_update_total; // Skip update price total for special lines var $skip_update_total; // Skip update price total for special lines
/** /**
* \brief Constructeur d'objets ligne de propal * Class line Contructor
* \param DB handler d'acces base de donnee *
* @param DoliDB $DB Database handler
*/ */
function PropaleLigne($DB) function PropaleLigne($DB)
{ {
@ -2468,8 +2494,9 @@ class PropaleLigne
} }
/** /**
* \brief Recupere l'objet ligne de propal * Retrieve the propal line object
* \param rowid id de la ligne de propal *
* @param int $rowid propal line id
*/ */
function fetch($rowid) function fetch($rowid)
{ {
@ -2525,7 +2552,7 @@ class PropaleLigne
/** /**
* Insert object line propal in database * Insert object line propal in database
* *
* @param int $notrigger 1=no trigger ran * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function insert($notrigger=0) function insert($notrigger=0)
@ -2615,7 +2642,7 @@ class PropaleLigne
/** /**
* Delete line in database * Delete line in database
* @return int <0 si ko, >0 si ok * @return int <0 if ko, >0 if ok
*/ */
function delete() function delete()
{ {
@ -2649,9 +2676,10 @@ class PropaleLigne
} }
/** /**
* Mise a jour de l'objet ligne de propale en base * Update propal line object into DB
* *
* @return int <0 si ko, >0 si ok * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if ko, >0 if ok
*/ */
function update($notrigger=0) function update($notrigger=0)
{ {
@ -2728,9 +2756,10 @@ class PropaleLigne
} }
/** /**
* \brief Mise a jour en base des champs total_xxx de ligne * Update DB line fields total_xxx
* \remarks Utilise par migration * Used by migration
* \return int <0 si ko, >0 si ok *
* @return int <0 if ko, >0 if ok
*/ */
function update_total() function update_total()
{ {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (c) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -46,10 +47,9 @@ class PropaleStats extends Stats
/** /**
* Constructor * Constructor
* *
* @param $DB Database handler * @param DoliDB $DB Database handler
* @param $socid Id third party * @param int $socid Id third party
* @param $userid Id user for filter * @param int $userid Id user for filter
* @return PropaleStats
*/ */
function PropaleStats($DB, $socid=0, $userid=0) function PropaleStats($DB, $socid=0, $userid=0)
{ {
@ -78,8 +78,10 @@ class PropaleStats extends Stats
/** /**
* Renvoie le nombre de proposition par mois pour une ann<EFBFBD>e donn<EFBFBD>e * Return propals number by month for a year
* *
* @param int $year year for stats
* @return array array with number by month
*/ */
function getNbByMonth($year) function getNbByMonth($year)
{ {
@ -97,7 +99,9 @@ class PropaleStats extends Stats
} }
/** /**
* Renvoie le nombre de propale par annee * Return propals number by year
*
* @return array array with number by year
* *
*/ */
function getNbByYear() function getNbByYear()
@ -113,9 +117,12 @@ class PropaleStats extends Stats
return $this->_getNbByYear($sql); return $this->_getNbByYear($sql);
} }
/** /**
* Renvoie le nombre de propale par mois pour une annee donnee * Return the propals amount by month for a year
* *
* @param int $year year for stats
* @return array array with number by month
*/ */
function getAmountByMonth($year) function getAmountByMonth($year)
{ {
@ -131,9 +138,12 @@ class PropaleStats extends Stats
return $this->_getAmountByMonth($year, $sql); return $this->_getAmountByMonth($year, $sql);
} }
/** /**
* Return the propals amount average by month for a year
* *
* * @param int $year year for stats
* @return array array with number by month
*/ */
function getAverageByMonth($year) function getAverageByMonth($year)
{ {
@ -150,10 +160,10 @@ class PropaleStats extends Stats
return $this->_getAverageByMonth($year, $sql); return $this->_getAverageByMonth($year, $sql);
} }
/** /**
* \brief Return nb, total and average * Return nb, total and average
* \return array Array of values *
* @return array Array of values
*/ */
function getAllByYear() function getAllByYear()
{ {

View File

@ -639,11 +639,11 @@ if ($account || $_GET["ref"])
// Amount // Amount
if ($objp->amount < 0) if ($objp->amount < 0)
{ {
print '<td align="right" nowrap>'.price($objp->amount * -1).'</td><td>&nbsp;</td>'."\n"; print '<td align="right" nowrap="nowrap">'.price($objp->amount * -1).'</td><td>&nbsp;</td>'."\n";
} }
else else
{ {
print '<td>&nbsp;</td><td align="right" nowrap>&nbsp;'.price($objp->amount).'</td>'."\n"; print '<td>&nbsp;</td><td align="right" nowrap="nowrap">&nbsp;'.price($objp->amount).'</td>'."\n";
} }
// Balance // Balance

View File

@ -159,10 +159,10 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid')
$hideunselectables = false; $hideunselectables = false;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
$projectstatic=new Project($db); $projectsListId = false;
$projectsListId = '';
if (empty($user->rights->projet->all->lire)) if (empty($user->rights->projet->all->lire))
{ {
$projectstatic=new Project($db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
} }
@ -170,13 +170,10 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid')
$sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public'; $sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public';
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
if ($projectsListId) $sql.= " AND p.rowid in (".$projectsListId.")"; if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
//if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc='0' OR p.fk_soc IS NULL)"; // We will filter later
$sql.= " ORDER BY p.title ASC"; $sql.= " ORDER BY p.title ASC";
//print $sql;
//var_dump($user->rights);
dol_syslog("project.lib::select_projects sql=".$sql); dol_syslog("project.lib::select_projects sql=".$sql);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

File diff suppressed because one or more lines are too long

View File

@ -35,17 +35,120 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client);
<title><?php echo $langs->trans('Login'); ?></title> <title><?php echo $langs->trans('Login'); ?></title>
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-latest.min.js"></script> <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-latest.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo $conf_css; ?>" />
<?php echo $conf->global->MAIN_HTML_HEADER ?> <link rel="shortcut icon" type="image/x-icon" href="<?php echo DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico'; ?>" />
<?php <?php if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER; ?>
$favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico';
?>
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $favicon; ?>" />
<!-- HTTP_USER_AGENT = <?php echo $_SERVER['HTTP_USER_AGENT']; ?> --> <!-- HTTP_USER_AGENT = <?php echo $_SERVER['HTTP_USER_AGENT']; ?> -->
</head> </head>
<body class="body"> <body class="body">
<!-- Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second -->
<script type="text/javascript"> <script type="text/javascript">
function DisplayDstSwitchDates(firstsecond)
{
var year = new Date().getYear();
if (year < 1000) year += 1900;
var firstSwitch = 0;
var secondSwitch = 0;
var lastOffset = 99;
// Loop through every month of the current year
for (i = 0; i < 12; i++)
{
// Fetch the timezone value for the month
var newDate = new Date(Date.UTC(year, i, 0, 0, 0, 0, 0));
var tz = -1 * newDate.getTimezoneOffset() / 60;
// Capture when a timzezone change occurs
if (tz > lastOffset)
firstSwitch = i-1;
else if (tz < lastOffset)
secondSwitch = i-1;
lastOffset = tz;
}
// Go figure out date/time occurences a minute before
// a DST adjustment occurs
var secondDstDate = FindDstSwitchDate(year, secondSwitch);
var firstDstDate = FindDstSwitchDate(year, firstSwitch);
if (firstsecond == 'first') return firstDstDate;
if (firstsecond == 'second') return secondDstDate;
if (firstDstDate == null && secondDstDate == null)
return 'Daylight Savings is not observed in your timezone.';
else
return 'Last minute before DST change occurs in ' +
year + ': ' + firstDstDate + ' and ' + secondDstDate;
}
function FindDstSwitchDate(year, month)
{
// Set the starting date
var baseDate = new Date(Date.UTC(year, month, 0, 0, 0, 0, 0));
var changeDay = 0;
var changeMinute = -1;
var baseOffset = -1 * baseDate.getTimezoneOffset() / 60;
var dstDate;
// Loop to find the exact day a timezone adjust occurs
for (day = 0; day < 50; day++)
{
var tmpDate = new Date(Date.UTC(year, month, day, 0, 0, 0, 0));
var tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;
// Check if the timezone changed from one day to the next
if (tmpOffset != baseOffset)
{
var minutes = 0;
changeDay = day;
// Back-up one day and grap the offset
tmpDate = new Date(Date.UTC(year, month, day-1, 0, 0, 0, 0));
tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;
// Count the minutes until a timezone chnage occurs
while (changeMinute == -1)
{
tmpDate = new Date(Date.UTC(year, month, day-1, 0, minutes, 0, 0));
tmpOffset = -1 * tmpDate.getTimezoneOffset() / 60;
// Determine the exact minute a timezone change
// occurs
if (tmpOffset != baseOffset)
{
// Back-up a minute to get the date/time just
// before a timezone change occurs
tmpOffset = new Date(Date.UTC(year, month,
day-1, 0, minutes-1, 0, 0));
changeMinute = minutes;
break;
}
else
minutes++;
}
// Add a month (for display) since JavaScript counts
// months from 0 to 11
dstDate = tmpOffset.getMonth() + 1;
// Pad the month as needed
if (dstDate < 10) dstDate = "0" + dstDate;
// Add the day and year
dstDate = year + '-' + dstDate + '-' + tmpOffset.getDate() + 'T';
// Capture the time stamp
tmpDate = new Date(Date.UTC(year, month,
day-1, 0, minutes-1, 0, 0));
dstDate += tmpDate.toTimeString().split(' ')[0] + 'Z';
return dstDate;
}
}
}
jQuery(document).ready(function () { jQuery(document).ready(function () {
// Set focus on correct field // Set focus on correct field
<?php if ($focus_element) { ?>jQuery('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element <?php if ($focus_element) { ?>jQuery('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
@ -65,8 +168,13 @@ jQuery(document).ready(function () {
} else { } else {
dst = "1"; // daylight savings time is observed dst = "1"; // daylight savings time is observed
} }
var dst_first=DisplayDstSwitchDates('first');
var dst_second=DisplayDstSwitchDates('second');
//alert(dst);
jQuery('#tz').val(std_time_offset); // returns TZ jQuery('#tz').val(std_time_offset); // returns TZ
jQuery('#dst').val(dst); // returns DST jQuery('#dst_observed').val(dst); // returns if DST is observed on summer
jQuery('#dst_first').val(dst_first); // returns DST first switch in year
jQuery('#dst_second').val(dst_second); // returns DST second switch in year
// Detect and save screen resolution // Detect and save screen resolution
jQuery('#screenwidth').val(jQuery(window).width()); // returns width of browser viewport jQuery('#screenwidth').val(jQuery(window).width()); // returns width of browser viewport
jQuery('#screenheight').val(jQuery(window).height()); // returns width of browser viewport jQuery('#screenheight').val(jQuery(window).height()); // returns width of browser viewport
@ -78,7 +186,9 @@ jQuery(document).ready(function () {
<input type="hidden" name="loginfunction" value="loginfunction" /> <input type="hidden" name="loginfunction" value="loginfunction" />
<!-- Add fields to send local user information --> <!-- Add fields to send local user information -->
<input type="hidden" name="tz" id="tz" value="" /> <input type="hidden" name="tz" id="tz" value="" />
<input type="hidden" name="dst" id="dst" value="" /> <input type="hidden" name="dst_observed" id="dst_observed" value="" />
<input type="hidden" name="dst_first" id="dst_first" value="" />
<input type="hidden" name="dst_second" id="dst_second" value="" />
<input type="hidden" name="screenwidth" id="screenwidth" value="" /> <input type="hidden" name="screenwidth" id="screenwidth" value="" />
<input type="hidden" name="screenheight" id="screenheight" value="" /> <input type="hidden" name="screenheight" id="screenheight" value="" />