This commit is contained in:
Laurent Destailleur 2010-11-22 09:18:53 +00:00
parent 153dac2c97
commit 3fb07a3922
15 changed files with 196 additions and 183 deletions

View File

@ -19,6 +19,7 @@
/** /**
* \file htdocs/core/class/dolgraph.class.php * \file htdocs/core/class/dolgraph.class.php
* \ingroup core
* \brief Fichier de la classe mere de gestion des graph * \brief Fichier de la classe mere de gestion des graph
* \version $Id$ * \version $Id$
* *

View File

@ -28,6 +28,7 @@
/** /**
* \file htdocs/core/class/html.form.class.php * \file htdocs/core/class/html.form.class.php
* \ingroup core
* \brief File of class with all html predefined components * \brief File of class with all html predefined components
* \version $Id$ * \version $Id$
*/ */

View File

@ -17,165 +17,166 @@
*/ */
/** /**
\file htdocs/core/class/html.formactions.class.php * \file htdocs/core/class/html.formactions.class.php
\brief Fichier de la classe des fonctions predefinie de composants html actions * \ingroup core
\version $Id$ * \brief Fichier de la classe des fonctions predefinie de composants html actions
*/ * \version $Id$
*/
/** /**
\class FormActions * \class FormActions
\brief Classe permettant la generation de composants html actions * \brief Classe permettant la generation de composants html actions
*/ */
class FormActions class FormActions
{ {
var $db; var $db;
var $error; var $error;
/** /**
* \brief Constructeur * \brief Constructeur
* \param DB handler d'acc<EFBFBD>s base de donn<EFBFBD>e * \param DB handler d'acc<EFBFBD>s base de donn<EFBFBD>e
*/ */
function FormActions($DB) function FormActions($DB)
{ {
$this->db = $DB; $this->db = $DB;
return 1; return 1;
} }
/** /**
* \brief Show list of action status * \brief Show list of action status
* \param formname Name of form where select in included * \param formname Name of form where select in included
* \param selected Preselected value * \param selected Preselected value
* \param canedit 1=can edit, 0=read only * \param canedit 1=can edit, 0=read only
*/ */
function form_select_status_action($formname,$selected,$canedit=1) function form_select_status_action($formname,$selected,$canedit=1)
{ {
global $langs,$conf; global $langs,$conf;
$listofstatus=array('0'=>$langs->trans("ActionRunningNotStarted"),'50'=>$langs->trans("ActionRunningShort"),'100'=>$langs->trans("ActionDoneShort")); $listofstatus=array('0'=>$langs->trans("ActionRunningNotStarted"),'50'=>$langs->trans("ActionRunningShort"),'100'=>$langs->trans("ActionDoneShort"));
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n"; print "\n";
print '<script type="text/javascript">'."\n"; print '<script type="text/javascript">'."\n";
print 'function select_status(mypercentage) {'."\n"; print 'function select_status(mypercentage) {'."\n";
print 'document.'.$formname.'.percentageshown.value=mypercentage;'."\n"; print 'document.'.$formname.'.percentageshown.value=mypercentage;'."\n";
print 'document.'.$formname.'.percentage.value=mypercentage;'."\n"; print 'document.'.$formname.'.percentage.value=mypercentage;'."\n";
print 'if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; }'."\n"; print 'if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; }'."\n"; print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n"; print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n";
print '}'."\n"; print '}'."\n";
print '</script>'."\n"; print '</script>'."\n";
print '<select '.($canedit?'':'disabled="true" ').'name="status" class="flat" onChange="select_status(document.'.$formname.'.status.value)">'; print '<select '.($canedit?'':'disabled="true" ').'name="status" class="flat" onChange="select_status(document.'.$formname.'.status.value)">';
foreach($listofstatus as $key => $val) foreach($listofstatus as $key => $val)
{ {
print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>'.$val.'</option>'; print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>'.$val.'</option>';
} }
print '</select>'; print '</select>';
if ($selected == 0 || $selected == 100) $canedit=0; if ($selected == 0 || $selected == 100) $canedit=0;
print ' <input type="text" name="percentageshown" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').' onChange="select_status(document.'.$formname.'.percentageshown.value)">%'; print ' <input type="text" name="percentageshown" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').' onChange="select_status(document.'.$formname.'.percentageshown.value)">%';
print ' <input type="hidden" name="percentage" value="'.$selected.'">'; print ' <input type="hidden" name="percentage" value="'.$selected.'">';
} }
else else
{ {
print ' <input type="text" name="percentage" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').'>%'; print ' <input type="text" name="percentage" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').'>%';
} }
} }
/** /**
* Show list of actions for element * Show list of actions for element
* @param object Object * @param object Object
* @param typeelement 'invoice','propal','order' * @param typeelement 'invoice','propal','order'
* @param socid socid of user * @param socid socid of user
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function showactions($object,$typeelement,$socid=0) function showactions($object,$typeelement,$socid=0)
{ {
global $langs,$conf,$user; global $langs,$conf,$user;
global $bc; global $bc;
$sql = 'SELECT a.id, a.datep as da, a.label, a.note,'; $sql = 'SELECT a.id, a.datep as da, a.label, a.note,';
$sql.= ' u.login'; $sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u'; $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u';
$sql.= ' WHERE a.fk_user_author = u.rowid'; $sql.= ' WHERE a.fk_user_author = u.rowid';
if ($socid) $sql .= ' AND a.fk_soc = '.$socid; if ($socid) $sql .= ' AND a.fk_soc = '.$socid;
if ($typeelement == 'invoice') $sql.= ' AND a.fk_facture = '.$object->id; if ($typeelement == 'invoice') $sql.= ' AND a.fk_facture = '.$object->id;
if ($typeelement == 'supplier_invoice') $sql.= ' AND a.fk_supplier_invoice = '.$object->id; if ($typeelement == 'supplier_invoice') $sql.= ' AND a.fk_supplier_invoice = '.$object->id;
if ($typeelement == 'propal') $sql.= ' AND a.propalrowid = '.$object->id; if ($typeelement == 'propal') $sql.= ' AND a.propalrowid = '.$object->id;
if ($typeelement == 'order') $sql.= ' AND a.fk_commande = '.$object->id; if ($typeelement == 'order') $sql.= ' AND a.fk_commande = '.$object->id;
if ($typeelement == 'supplier_order') $sql.= ' AND a.fk_supplier_order = '.$object->id; if ($typeelement == 'supplier_order') $sql.= ' AND a.fk_supplier_order = '.$object->id;
if ($typeelement == 'project') $sql.= ' AND a.fk_project = '.$object->id; if ($typeelement == 'project') $sql.= ' AND a.fk_project = '.$object->id;
dol_syslog("FormActions::showactions sql=".$sql); dol_syslog("FormActions::showactions sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) if ($num)
{ {
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill'); if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
if ($typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnSupplierBill'); if ($typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnSupplierBill');
if ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal'); if ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
if ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder'); if ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
if ($typeelement == 'supplier_order') $title=$langs->trans('ActionsOnSupplierOrder'); if ($typeelement == 'supplier_order') $title=$langs->trans('ActionsOnSupplierOrder');
if ($typeelement == 'project') $title=$langs->trans('ActionsOnProject'); if ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
print_titre($title); print_titre($title);
$i = 0; $total = 0; $var=true; $i = 0; $total = 0; $var=true;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>'; print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>';
print "\n"; print "\n";
while ($i < $num) while ($i < $num)
{ {
$objp = $this->db->fetch_object($resql); $objp = $this->db->fetch_object($resql);
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
print '<td>'.dol_print_date($this->db->jdate($objp->da),'day').'</td>'; print '<td>'.dol_print_date($this->db->jdate($objp->da),'day').'</td>';
print '<td title="'.dol_escape_htmltag($objp->label).'">'.dol_trunc($objp->label,32).'</td>'; print '<td title="'.dol_escape_htmltag($objp->label).'">'.dol_trunc($objp->label,32).'</td>';
print '<td>'.$objp->login.'</td>'; print '<td>'.$objp->login.'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
print '</table>'; print '</table>';
} }
return $num; return $num;
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
return -1; return -1;
} }
} }
/** /**
* \brief Retourne la liste des types de comptes financiers * \brief Retourne la liste des types de comptes financiers
* \param selected Type pre-selectionne * \param selected Type pre-selectionne
* \param htmlname Nom champ formulaire * \param htmlname Nom champ formulaire
*/ */
function select_type_actions($selected='',$htmlname='actioncode') function select_type_actions($selected='',$htmlname='actioncode')
{ {
global $langs,$user; global $langs,$user;
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/cactioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/action/class/cactioncomm.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.form.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.form.class.php");
$caction=new CActionComm($this->db); $caction=new CActionComm($this->db);
$form=new Form($this->db); $form=new Form($this->db);
$arraylist=$caction->liste_array(1,'code'); $arraylist=$caction->liste_array(1,'code');
$arraylist[0]='&nbsp;'; $arraylist[0]='&nbsp;';
asort($arraylist); asort($arraylist);
print $form->selectarray($htmlname, $arraylist, $selected); print $form->selectarray($htmlname, $arraylist, $selected);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
} }
} }

View File

@ -19,6 +19,7 @@
/** /**
* \file htdocs/core/class/html.formadmin.class.php * \file htdocs/core/class/html.formadmin.class.php
* \ingroup core
* \brief File of class for html functions for admin pages * \brief File of class for html functions for admin pages
* \version $Id$ * \version $Id$
*/ */

View File

@ -18,6 +18,7 @@
/** /**
* \file htdocs/core/class/html.formcompany.class.php * \file htdocs/core/class/html.formcompany.class.php
* \ingroup core
* \brief File of class to build HTML component for third parties management * \brief File of class to build HTML component for third parties management
* \version $Id$ * \version $Id$
*/ */

View File

@ -19,6 +19,7 @@
/** /**
* \file htdocs/core/class/html.formfile.class.php * \file htdocs/core/class/html.formfile.class.php
* \ingroup core
* \brief File of class to offer components to list and upload files * \brief File of class to offer components to list and upload files
* \version $Id$ * \version $Id$
*/ */

View File

@ -19,10 +19,10 @@
/** /**
* \file htdocs/core/class/html.formmail.class.php * \file htdocs/core/class/html.formmail.class.php
* \ingroup core
* \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire * \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire
* \version $Id$ * \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");

View File

@ -18,6 +18,7 @@
/** /**
* \file htdocs/core/class/html.formorder.class.php * \file htdocs/core/class/html.formorder.class.php
* \ingroup core
* \brief File of predefined functions for HTML forms for order module * \brief File of predefined functions for HTML forms for order module
* \version $Id$ * \version $Id$
*/ */

View File

@ -27,6 +27,7 @@
/** /**
* \file htdocs/core/class/html.formother.class.php * \file htdocs/core/class/html.formother.class.php
* \ingroup core
* \brief Fichier de la classe des fonctions predefinie de composants html autre * \brief Fichier de la classe des fonctions predefinie de composants html autre
* \version $Id$ * \version $Id$
*/ */

View File

@ -19,8 +19,8 @@
*/ */
/** /**
* \file htdocs/core/class/interfaces.class.php * \file htdocs/core/class/interfaces.class.php
* \ingroup workflow * \ingroup core
* \brief Fichier de la classe de gestion des triggers * \brief Fichier de la classe de gestion des triggers
* \version $Id$ * \version $Id$
*/ */

View File

@ -19,6 +19,7 @@
/** /**
* \file htdocs/core/class/menu.class.php * \file htdocs/core/class/menu.class.php
* \ingroup core
* \brief Fichier de la classe de gestion du menu gauche * \brief Fichier de la classe de gestion du menu gauche
* \version $Id$ * \version $Id$
*/ */

View File

@ -18,18 +18,18 @@
*/ */
/** /**
\file htdocs/core/class/notify.class.php * \file htdocs/core/class/notify.class.php
\brief Fichier de la classe de gestion des notifications * \ingroup core
\version $Id$ * \brief Fichier de la classe de gestion des notifications
*/ * \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php"); require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php");
/** /**
\class Notify * \class Notify
\brief Classe de gestion des notifications * \brief Classe de gestion des notifications
*/ */
class Notify class Notify
{ {
var $id; var $id;

View File

@ -18,6 +18,7 @@
/** /**
* \file htdocs/core/class/smartphone.class.php * \file htdocs/core/class/smartphone.class.php
* \ingroup core
* \brief Fichier de la classe de gestion des smartphones * \brief Fichier de la classe de gestion des smartphones
* \version $Id$ * \version $Id$
*/ */

View File

@ -20,6 +20,7 @@
/** /**
* \file htdocs/core/class/translate.class.php * \file htdocs/core/class/translate.class.php
* \ingroup core
* \brief File for Tanslate class * \brief File for Tanslate class
* \author Eric Seigne * \author Eric Seigne
* \author Laurent Destailleur * \author Laurent Destailleur
@ -126,16 +127,16 @@ class Translate {
/** /**
* \brief Load translation key-value for a particular file, into a memory array. * Load translation key-value for a particular file, into a memory array.
* If data for file already loaded, do nothing. * If data for file already loaded, do nothing.
* All data in translation array are stored in UTF-8 format. * All data in translation array are stored in UTF-8 format.
* \param domain File name to load (.lang file). Use file@module if file is in a module directory. * tab_loaded is completed with $domain key.
* \param alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US or fr_FR or es_ES) * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
* \param stopafterdirection Stop when the DIRECTION tag is found (optimize) * @param domain File name to load (.lang file). Use file@module if file is in a module directory.
* \param forcelangdir To force a lang directory * @param alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US or fr_FR or es_ES)
* \return int <0 if KO, 0 if already loaded, >0 if OK * @param stopafterdirection Stop when the DIRECTION tag is found (optimize)
* \remarks tab_loaded is completed with $domain key. * @param forcelangdir To force a lang directory
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache * @return int <0 if KO, 0 if already loaded, >0 if OK
*/ */
function Load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='') function Load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='')
{ {
@ -518,6 +519,7 @@ class Translate {
/** /**
* Return list of all available languages * Return list of all available languages
* @param langdir Directory to scan * @param langdir Directory to scan
* @param maxlength Max length for each value in combo box (will be truncated)
* @return array List of languages * @return array List of languages
*/ */
function get_available_languages($langdir=DOL_DOCUMENT_ROOT,$maxlength=0) function get_available_languages($langdir=DOL_DOCUMENT_ROOT,$maxlength=0)

View File

@ -1125,11 +1125,12 @@ class Societe extends CommonObject
} }
/** /**
* \brief Add a discount for third party * Add a discount for third party
* \param remise Montant de la remise * @param remise Montant de la remise
* \param user Utilisateur qui accorde la remise * @param user Utilisateur qui accorde la remise
* \param desc Motif de l'avoir * @param desc Motif de l'avoir
* \return int <0 si ko, id de la ligne de remise si ok * @param tva_tx VAT rate
* @return int <0 if KO, id or record if OK
*/ */
function set_remise_except($remise, $user, $desc, $tva_tx=0) function set_remise_except($remise, $user, $desc, $tva_tx=0)
{ {
@ -1887,8 +1888,8 @@ class Societe extends CommonObject
} }
/** /**
* \brief Return if third party is a company (Business) or an end user (Consumer) * Return if third party is a company (Business) or an end user (Consumer)
* \param boolean true=is a company, false=a and user * @return boolean true=is a company, false=a and user
*/ */
function isACompany() function isACompany()
{ {
@ -1905,8 +1906,8 @@ class Societe extends CommonObject
/** /**
* \brief Return if a country is inside the EEC (European Economic Community) * Return if a country is inside the EEC (European Economic Community)
* \param boolean true = pays inside EEC, false= pays outside EEC * @param boolean true = pays inside EEC, false= pays outside EEC
*/ */
function isInEEC() function isInEEC()
{ {
@ -1949,8 +1950,8 @@ class Societe extends CommonObject
} }
/** /**
* \brief Charge la liste des categories fournisseurs * Charge la liste des categories fournisseurs
* \return 0 in success, <> 0 in error * @return int 0 if success, <> 0 if error
*/ */
function LoadSupplierCateg() function LoadSupplierCateg()
{ {
@ -1976,7 +1977,7 @@ class Societe extends CommonObject
/** /**
* Charge la liste des categories fournisseurs * Charge la liste des categories fournisseurs
* @return 0 in success, <> 0 in error * @return int 0 if success, <> 0 if error
*/ */
function AddFournisseurInCategory($categorie_id) function AddFournisseurInCategory($categorie_id)
{ {
@ -2063,10 +2064,10 @@ class Societe extends CommonObject
} }
/** /**
* \brief Cree en base un tiers depuis l'objet adherent * Cree en base un tiers depuis l'objet adherent
* \param member Objet adherent source * @param member Objet adherent source
* \param socname Name of third to force * @param socname Name of third to force
* \return int Si erreur <0, si ok renvoie id compte cree * @return int Si erreur <0, si ok renvoie id compte cree
*/ */
function create_from_member($member,$socname='') function create_from_member($member,$socname='')
{ {