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
* \ingroup core
* \brief Fichier de la classe mere de gestion des graph
* \version $Id$
*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,10 +19,10 @@
/**
* \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
* \version $Id$
*/
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
* \ingroup core
* \brief File of predefined functions for HTML forms for order module
* \version $Id$
*/

View File

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

View File

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

View File

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

View File

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

View File

@ -18,6 +18,7 @@
/**
* \file htdocs/core/class/smartphone.class.php
* \ingroup core
* \brief Fichier de la classe de gestion des smartphones
* \version $Id$
*/
@ -30,7 +31,7 @@
class Smartphone {
var $db;
var $phone;
var $theme;
var $title;
@ -44,7 +45,7 @@ class Smartphone {
{
$this->db = $DB;
}
/**
* Get template directory
*/
@ -68,7 +69,7 @@ class Smartphone {
$this->template_dir=DOL_DOCUMENT_ROOT."/theme/phones/others/tpl/";
}
}
/**
* Show HTML header
* @param title Web page title
@ -76,29 +77,29 @@ class Smartphone {
function smartheader($type='default')
{
global $conf;
if ($type == 'default') include_once($this->template_dir.'header.tpl.php');
}
/**
* Show HTML footer
*/
function smartfooter()
{
{
include_once($this->template_dir.'footer.tpl.php');
}
/**
* Show menu
*/
function smartmenu()
{
{
global $conf, $langs;
if (! $conf->smart_menu) $conf->smart_menu ='iphone_backoffice.php';
$smart_menu=$conf->smart_menu;
if (GETPOST('top_menu')) $smart_menu=GETPOST('top_menu');
// Load the smartphone menu manager
$result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$smart_menu);
if (! $result) // If failed to include, we try with standard
@ -108,7 +109,7 @@ class Smartphone {
}
$menusmart = new MenuSmart($this->db);
$menusmart->atarget=$target;
include_once($this->template_dir.'menu.tpl.php');
}

View File

@ -20,6 +20,7 @@
/**
* \file htdocs/core/class/translate.class.php
* \ingroup core
* \brief File for Tanslate class
* \author Eric Seigne
* \author Laurent Destailleur
@ -126,16 +127,16 @@ class Translate {
/**
* \brief Load translation key-value for a particular file, into a memory array.
* If data for file already loaded, do nothing.
* 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.
* \param alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US or fr_FR or es_ES)
* \param stopafterdirection Stop when the DIRECTION tag is found (optimize)
* \param forcelangdir To force a lang directory
* \return int <0 if KO, 0 if already loaded, >0 if OK
* \remarks tab_loaded is completed with $domain key.
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
* Load translation key-value for a particular file, into a memory array.
* If data for file already loaded, do nothing.
* All data in translation array are stored in UTF-8 format.
* tab_loaded is completed with $domain key.
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
* @param domain File name to load (.lang file). Use file@module if file is in a module 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)
* @param stopafterdirection Stop when the DIRECTION tag is found (optimize)
* @param forcelangdir To force a lang directory
* @return int <0 if KO, 0 if already loaded, >0 if OK
*/
function Load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='')
{
@ -518,6 +519,7 @@ class Translate {
/**
* Return list of all available languages
* @param langdir Directory to scan
* @param maxlength Max length for each value in combo box (will be truncated)
* @return array List of languages
*/
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
* \param remise Montant de la remise
* \param user Utilisateur qui accorde la remise
* \param desc Motif de l'avoir
* \return int <0 si ko, id de la ligne de remise si ok
* Add a discount for third party
* @param remise Montant de la remise
* @param user Utilisateur qui accorde la remise
* @param desc Motif de l'avoir
* @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)
{
@ -1887,8 +1888,8 @@ class Societe extends CommonObject
}
/**
* \brief Return if third party is a company (Business) or an end user (Consumer)
* \param boolean true=is a company, false=a and user
* Return if third party is a company (Business) or an end user (Consumer)
* @return boolean true=is a company, false=a and user
*/
function isACompany()
{
@ -1905,8 +1906,8 @@ class Societe extends CommonObject
/**
* \brief Return if a country is inside the EEC (European Economic Community)
* \param boolean true = pays inside EEC, false= pays outside EEC
* Return if a country is inside the EEC (European Economic Community)
* @param boolean true = pays inside EEC, false= pays outside EEC
*/
function isInEEC()
{
@ -1949,8 +1950,8 @@ class Societe extends CommonObject
}
/**
* \brief Charge la liste des categories fournisseurs
* \return 0 in success, <> 0 in error
* Charge la liste des categories fournisseurs
* @return int 0 if success, <> 0 if error
*/
function LoadSupplierCateg()
{
@ -1976,7 +1977,7 @@ class Societe extends CommonObject
/**
* 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)
{
@ -2063,10 +2064,10 @@ class Societe extends CommonObject
}
/**
* \brief Cree en base un tiers depuis l'objet adherent
* \param member Objet adherent source
* \param socname Name of third to force
* \return int Si erreur <0, si ok renvoie id compte cree
* Cree en base un tiers depuis l'objet adherent
* @param member Objet adherent source
* @param socname Name of third to force
* @return int Si erreur <0, si ok renvoie id compte cree
*/
function create_from_member($member,$socname='')
{