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

This commit is contained in:
Laurent Destailleur 2011-12-14 10:07:24 +01:00
commit c701eacbce
27 changed files with 746 additions and 573 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
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 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

View File

@ -85,7 +85,7 @@ function compare($x, $y)
/**
* Compare revisions
*
*
* @param array $x Parts of version 1
* @param array $y Parts of version 2
* @return int 1 if 1<2, 0 if 1=2, -1 if 1>2
@ -104,7 +104,7 @@ function revcompare($x, $y)
/**
* Output table
*
*
* @param array $list Array of records
* @return void
*/
@ -179,7 +179,7 @@ function create_script_table($list)
/**
* Output table
*
*
* @param array $list Array of records
* @return void
*/
@ -346,11 +346,9 @@ if (function_exists('eaccelerator_get'))
}
print "<br><br>";
print "<hr />";
print '<table><tr><td class="center">';
print '<strong>Eaccelerator is created by the eAccelerator team, <a href="http://eaccelerator.net">http://eaccelerator.net</a></strong><br><br>';
print "</td></tr></table>";
llxFooter();
$db->close();
?>

View File

@ -99,23 +99,25 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers') )
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
}
else
{
$result=$object->createFromClone($id,0,GETPOST('socid'),$hookmanager);
if ($result > 0)
if ($object->fetch($id) > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit;
}
else
{
$mesg=$object->error;
$action='';
//$_GET['id']=$_REQUEST['id'];
$result=$object->createFromClone($socid, $hookmanager);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit;
}
else
{
$mesg=$object->error;
$action='';
}
}
}
}
@ -1568,7 +1570,7 @@ if ($id > 0 || ! empty($ref))
}
// Send
if ($object->statut == 1)
if ($object->statut == 1 || $object->statut == 2)
{
$propref = dol_sanitizeFileName($object->ref);
$file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.pdf';

View File

@ -836,53 +836,45 @@ class Propal extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @param int $invertdetail Reverse sign of amounts for lines
* @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($fromid,$invertdetail=0,$socid=0,$hookmanager=false)
function createFromClone($socid=0,$hookmanager=false)
{
global $user,$langs,$conf;
$error=0;
$now=dol_now();
$object=new Propal($this->db);
$this->db->begin();
// Load source object
$object->fetch($fromid);
$objFrom = $object;
$objFrom = dol_clone($this);
$objsoc=new Societe($this->db);
// Change socid if needed
if (! empty($socid) && $socid != $object->socid)
if (! empty($socid) && $socid != $this->socid)
{
if ($objsoc->fetch($socid)>0)
if ($objsoc->fetch($socid) > 0)
{
$object->socid = $objsoc->id;
$object->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$object->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$object->fk_project = '';
$object->fk_delivery_address = '';
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = '';
$this->fk_delivery_address = '';
}
// TODO Change product price if multi-prices
}
else
{
$objsoc->fetch($object->socid);
$objsoc->fetch($this->socid);
}
$object->id=0;
$object->statut=0;
$objsoc->fetch($object->socid);
$this->id=0;
$this->statut=0;
if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
{
@ -891,28 +883,22 @@ class Propal extends CommonObject
}
// Clear fields
$object->user_author = $user->id;
$object->user_valid = '';
$object->date = '';
$object->datep = $now;
$object->fin_validite = $object->datep + ($this->duree_validite * 24 * 3600);
$object->ref_client = '';
$this->user_author = $user->id;
$this->user_valid = '';
$this->date = '';
$this->datep = $now;
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
$this->ref_client = '';
// Set ref
require_once(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php");
$obj = $conf->global->PROPALE_ADDON;
$modPropale = new $obj;
$object->ref = $modPropale->getNextValue($objsoc,$object);
$this->ref = $modPropale->getNextValue($objsoc,$this);
// Create clone
$result=$object->create($user);
// Other options
if ($result < 0)
{
$this->error=$object->error;
$error++;
}
$result=$this->create($user);
if ($result < 0) $error++;
if (! $error)
{
@ -921,14 +907,14 @@ class Propal extends CommonObject
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PROPAL_CLONE',$object,$user,$langs,$conf);
$result=$interface->run_triggers('PROPAL_CLONE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
@ -937,7 +923,7 @@ class Propal extends CommonObject
if (! $error)
{
$this->db->commit();
return $object->id;
return $this->id;
}
else
{

View File

@ -769,62 +769,51 @@ class Commande extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @param int $invertdetail Reverse sign of amounts for lines
* @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($fromid,$invertdetail=0,$socid=0,$hookmanager=false)
function createFromClone($socid=0,$hookmanager=false)
{
global $conf,$user,$langs;
$error=0;
$object=new Commande($this->db);
$this->db->begin();
// Load source object
$object->fetch($fromid);
$objFrom = $object;
$objFrom = dol_clone($this);
// Change socid if needed
if (! empty($socid) && $socid != $object->socid)
if (! empty($socid) && $socid != $this->socid)
{
$objsoc = new Societe($this->db);
if ($objsoc->fetch($socid)>0)
{
$object->socid = $objsoc->id;
$object->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$object->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$object->fk_project = '';
$object->fk_delivery_address = '';
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = '';
$this->fk_delivery_address = '';
}
// TODO Change product price if multi-prices
}
$object->id=0;
$object->statut=0;
$this->id=0;
$this->statut=0;
// Clear fields
$object->user_author_id = $user->id;
$object->user_valid = '';
$object->date_creation = '';
$object->date_validation = '';
$object->ref_client = '';
$this->user_author_id = $user->id;
$this->user_valid = '';
$this->date_creation = '';
$this->date_validation = '';
$this->ref_client = '';
// Create clone
$result=$object->create($user);
// Other options
if ($result < 0)
{
$this->error=$object->error;
$error++;
}
$result=$this->create($user);
if ($result < 0) $error++;
if (! $error)
{
@ -833,14 +822,14 @@ class Commande extends CommonObject
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('ORDER_CLONE',$object,$user,$langs,$conf);
$result=$interface->run_triggers('ORDER_CLONE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
@ -849,7 +838,7 @@ class Commande extends CommonObject
if (! $error)
{
$this->db->commit();
return $object->id;
return $this->id;
}
else
{

View File

@ -79,23 +79,26 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
if ( 1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers') )
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
}
else
{
$result=$object->createFromClone($id, 0, GETPOST('socid'), $hookmanager);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit;
}
else
{
$mesg='<div class="error">'.$object->error.'</div>';
$action='';
}
if ($object->fetch($id) > 0)
{
$result=$object->createFromClone($socid, $hookmanager);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit;
}
else
{
$mesg='<div class="error">'.$object->error.'</div>';
$action='';
}
}
}
}

View File

@ -228,7 +228,7 @@ print '<td align="center" valign="top">';
print '<table class="border" width="100%"><tr valign="top"><td align="center">';
if ($mesg) { print $mesg; }
else {
print '<img src="'.$fileurlnb.'" title="'.$langs->trans("NbOfOrders").'" alt="'.$langs->trans("NbOfProposals").'">';
print '<img src="'.$fileurlnb.'" title="'.$langs->trans("NbOfOrders").'" alt="'.$langs->trans("NbOfOrders").'">';
print "<br>\n";
print '<img src="'.$fileurlamount.'" title="'.$langs->trans("AmountTotal").'" alt="'.$langs->trans("AmountTotal").'">';
}

View File

@ -98,17 +98,20 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
}
else
{
$result=$object->createFromClone($id,0,$hookmanager);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result);
exit;
}
else
{
$mesg=$object->error;
$action='';
}
if ($object->fetch($id) > 0)
{
$result=$object->createFromClone($socid, $hookmanager);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result);
exit;
}
else
{
$mesg=$object->error;
$action='';
}
}
}
}

View File

@ -490,60 +490,65 @@ class Facture extends CommonObject
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @param int $invertdetail Reverse sign of amounts for lines
* @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($fromid,$invertdetail=0,$hookmanager=false)
function createFromClone($socid=0,$hookmanager=false)
{
global $conf,$user,$langs;
$error=0;
// Load source object
$objFrom=new Facture($this->db);
$objFrom->fetch($fromid);
// Load new object
$object=new Facture($this->db);
$object->fetch($fromid);
$this->db->begin();
$object->id=0;
$object->statut=0;
// Load source object
$objFrom = dol_clone($this);
// Change socid if needed
if (! empty($socid) && $socid != $this->socid)
{
$objsoc = new Societe($this->db);
if ($objsoc->fetch($socid)>0)
{
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = '';
$this->fk_delivery_address = '';
}
// TODO Change product price if multi-prices
}
$this->id=0;
$this->statut=0;
// Clear fields
$object->user_author = $user->id;
$object->user_valid = '';
$object->fk_facture_source = 0;
$object->date_creation = '';
$object->date_validation = '';
$object->ref_client = '';
$object->close_code = '';
$object->close_note = '';
$object->products = $object->lines; // Tant que products encore utilise
$this->user_author = $user->id;
$this->user_valid = '';
$this->fk_facture_source = 0;
$this->date_creation = '';
$this->date_validation = '';
$this->ref_client = '';
$this->close_code = '';
$this->close_note = '';
$this->products = $this->lines; // Tant que products encore utilise
// Loop on each line of new invoice
foreach($object->lines as $i => $line)
foreach($this->lines as $i => $line)
{
if (($object->lines[$i]->info_bits & 0x02) == 0x02) // We do not clone line of discounts
if (($this->lines[$i]->info_bits & 0x02) == 0x02) // We do not clone line of discounts
{
unset($object->lines[$i]);
unset($object->products[$i]); // Tant que products encore utilise
unset($this->lines[$i]);
unset($this->products[$i]); // Tant que products encore utilise
}
}
// Create clone
$result=$object->create($user);
// Other options
if ($result < 0)
{
$this->error=$object->error;
$error++;
}
$result=$this->create($user);
if ($result < 0) $error++;
if (! $error)
{
@ -552,14 +557,14 @@ class Facture extends CommonObject
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_CLONE',$object,$user,$langs,$conf);
$result=$interface->run_triggers('BILL_CLONE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
@ -568,7 +573,7 @@ class Facture extends CommonObject
if (! $error)
{
$this->db->commit();
return $object->id;
return $this->id;
}
else
{

View File

@ -25,10 +25,12 @@
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/modules/rapport/pdf_paiement.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
// Security check
if (! $user->rights->facture->lire)
accessforbidden();
if (! $user->rights->facture->lire) accessforbidden();
$action=GETPOST('action');
$dir = $conf->facture->dir_output.'/payments';
@ -48,7 +50,7 @@ if (! $year) { $year=date("Y"); }
* Actions
*/
if ($_POST["action"] == 'builddoc')
if ($action == 'builddoc')
{
$rap = new pdf_paiement($db);
@ -80,6 +82,8 @@ if ($_POST["action"] == 'builddoc')
* View
*/
$formother=new FormOther($db);
llxHeader();
$titre=($year?$langs->trans("PaymentsReportsForYear",$year):$langs->trans("PaymentsReports"));
@ -92,33 +96,10 @@ print '<input type="hidden" name="action" value="builddoc">';
$cmonth = GETPOST("remonth")?GETPOST("remonth"):date("n", time());
$syear = GETPOST("reyear")?GETPOST("reyear"):date("Y", time());
print '<select class="flat" name="remonth">';
for ($month = 1 ; $month < 13 ; $month++)
{
if ($month == $cmonth)
{
print "<option value=\"$month\" selected=\"true\">" . dol_print_date(mktime(0,0,0,$month),"%B");
}
else
{
print "<option value=\"$month\">" . dol_print_date(mktime(0,0,0,$month),"%B");
}
}
print "</select>";
print '<select class="flat" name="reyear">';
print $formother->select_month($cmonth,'remonth');
print $formother->select_year($syear,'reyear');
for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++)
{
if ($formyear == $syear)
{
print "<option value=\"$formyear\" selected=\"true\">".$formyear."</option>";
}
else
{
print "<option value=\"$formyear\">".$formyear."</option>";
}
}
print "</select>\n";
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '</form>';
print '<br>';
@ -183,7 +164,8 @@ if ($year)
print '</table>';
}
}
$db->close();
llxFooter();
$db->close();
?>

View File

@ -159,7 +159,6 @@ class Translate {
{
global $conf;
//var_dump($this->dir);exit;
// Check parameters
if (empty($domain))
{
@ -266,9 +265,6 @@ class Translate {
}
else
{
// On stocke toujours dans le tableau Tab en UTF-8
//if (! empty($this->charset_inputfile[$newdomain]) && $this->charset_inputfile[$newdomain] == 'ISO-8859-1') $value=utf8_encode($value);
$this->tab_translate[$key]=$value;
if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache
}
@ -289,7 +285,6 @@ class Translate {
dol_syslog($error, LOG_ERR);
}
}
//exit;
if (empty($conf->global->MAIN_FORCELANGDIR)) break; // Break loop on each root dir. If a module has forced dir, we do not stop loop.
}
@ -389,6 +384,8 @@ class Translate {
*/
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
{
global $conf;
if (! empty($this->tab_translate[$key])) // Translation is available
{
$str=$this->tab_translate[$key];
@ -400,14 +397,23 @@ class Translate {
// We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities
$str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str);
//$str=$this->convToOutputCharset($str); // Convert string to $this->charset_output
// Crypt string into HTML
// $str est une chaine stockee en memoire au format $this->charset_output
$str=htmlentities($str,ENT_QUOTES,$this->charset_output);
// Restore HTML tags
$str=str_replace(array('__lt__','__gt__','__quot__'),array('<','>','"',),$str);
// Overwrite translation
if (! empty($conf->global->MAIN_OVERWRITE_TRANS)) // Overwrite translation with string1:newstring1,string2:newstring2
{
$tmparray=explode(',', $conf->global->MAIN_OVERWRITE_TRANS);
foreach($tmparray as $tmp)
{
$tmparray2=explode(':',$tmp);
if ($tmparray2[0]==$str) { $str=$tmparray2[1]; break; }
}
}
return $str;
}
else // Translation is not available
@ -458,7 +464,7 @@ class Translate {
{
$str=$this->tab_translate[$key];
$str=sprintf($str,$param1,$param2,$param3,$param4);
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
}
else
{

View File

@ -542,6 +542,7 @@ class DoliDBMssql
/**
* Escape a string to insert data.
*
* @param stringtoencode String to escape
* @return string String escaped
*/
@ -554,19 +555,21 @@ class DoliDBMssql
/**
* Convert (by PHP) a GM Timestamp date into a PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
* @param param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*
* @param string $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param)
{
return adodb_strftime("%Y-%m-%d %H:%M:%S",$param);
return dol_print_date($param,"%Y-%m-%d %H:%M:%S");
}
/**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
* 19700101020000 -> 3600 with TZ+1
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
*/
function jdate($string)
{

View File

@ -537,20 +537,20 @@ class DoliDBMysql
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
*
* @param param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
* @param string $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param)
{
return adodb_strftime("%Y%m%d%H%M%S",$param);
return dol_print_date($param,"%Y%m%d%H%M%S");
}
/**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
* 19700101020000 -> 3600 with TZ+1
*
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
*/
function jdate($string)
{

View File

@ -549,20 +549,20 @@ class DoliDBMysqli
* Convert (by PHP) a GM Timestamp date into a PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
*
* @param param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
* @param string $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param)
{
return adodb_strftime("%Y%m%d%H%M%S",$param);
return dol_print_date($param,"%Y%m%d%H%M%S");
}
/**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
* 19700101020000 -> 3600 with TZ+1
*
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
*/
function jdate($string)
{

View File

@ -693,20 +693,20 @@ class DoliDBPgsql
* Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica
*
* @param param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
* @param string $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS
*/
function idate($param)
{
return adodb_strftime("%Y-%m-%d %H:%M:%S",$param);
return dol_print_date($param,"%Y-%m-%d %H:%M:%S");
}
/**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
* 19700101020000 -> 3600 with TZ+1
*
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS
*/
function jdate($string)
{

View File

@ -136,13 +136,13 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='')
if (preg_match('/^--\sV(MYSQL|PGSQL|)([0-9\.]+)/i',$buf,$reg))
{
$qualified=1;
// restrict on database type
if (! empty($reg[1]))
{
if (strtolower($reg[1]) != $db->type) $qualified=0;
if (strtolower($reg[1]) != $db->type) $qualified=0;
}
// restrict on version
if ($qualified)
{
@ -154,7 +154,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='')
$qualified=0;
}
}
if ($qualified)
{
// Version qualified, delete SQL comments
@ -856,19 +856,40 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq
$orders = array();
$categ = array();
$dirmod = array();
$modulesdir = array();
$i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined.
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot . "/core/modules/";
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules");
foreach ($conf->file->dol_document_root as $type => $dirroot)
{
$modulesdir[$dirroot . '/core/modules/'] = $dirroot . '/core/modules/';
$handle=@opendir($dirroot);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
{
if (is_dir($dirroot . '/' . $file . '/core/modules/'))
{
$modulesdir[$dirroot . '/' . $file . '/core/modules/'] = $dirroot . '/' . $file . '/core/modules/';
}
}
}
closedir($handle);
}
}
//var_dump($modulesdir);
foreach ($modulesdir as $dir)
{
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules");
$handle=@opendir(dol_osencode($dir));
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
//print "$i ".$file."\n<br>";

View File

@ -804,13 +804,13 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
$to_gmt=false;
$offsettz=$offsetdst=0;
}
if ($tzoutput == 'tzuser')
elseif ($tzoutput == 'tzuser')
{
$to_gmt=true;
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60;
}
if ($tzoutput == 'tzcompany')
elseif ($tzoutput == 'tzcompany')
{
$to_gmt=false;
$offsettz=$offsetdst=0; // TODO Define this and use it later

View File

@ -23,7 +23,7 @@
/**
* Return array head with list of tabs to view object informations
*
*
* @param object Member
* @return array head
*/
@ -113,7 +113,7 @@ function member_admin_prepare_head($object)
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin');
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
@ -123,7 +123,7 @@ function member_admin_prepare_head($object)
$head[$h][1] = $langs->trans("BlankSubscriptionForm");
$head[$h][2] = 'public';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin','remove');
return $head;
@ -132,8 +132,9 @@ function member_admin_prepare_head($object)
/**
* Return array head with list of tabs to view object stats informations
* @param object Member
* @return array head
*
* @param Object $object Member or null
* @return array head
*/
function member_stats_prepare_head($object)
{

View File

@ -154,99 +154,96 @@ function task_prepare_head($object)
*/
function select_projects($socid=-1, $selected='', $htmlname='projectid')
{
global $db,$user,$conf,$langs;
$hideunselectables = false;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
$projectstatic=new Project($db);
$projectsListId = '';
if (empty($user->rights->projet->all->lire))
{
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
}
// On recherche les projets
$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.= " WHERE p.entity = ".$conf->entity;
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=".$socid." OR p.fk_soc='0' OR p.fk_soc IS NULL)"; // We will filter later
$sql.= " ORDER BY p.title ASC";
//print $sql;
//var_dump($user->rights);
dol_syslog("project.lib::select_projects sql=".$sql);
$resql=$db->query($sql);
if ($resql)
{
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="0">&nbsp;</option>';
$num = $db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && ! $user->rights->societe->lire)
{
// Do nothing
}
else
{
$labeltoshow=dol_trunc($obj->ref,16);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
{
print '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
}
else
{
$disabled=0;
if (! $obj->fk_statut > 0)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Draft");
}
if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
}
if ($hideunselectables && $disabled)
{
$resultat='';
}
else
{
$resultat='<option value="'.$obj->rowid.'"';
if ($disabled) $resultat.=' disabled="disabled"';
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat.='>'.$labeltoshow;
if (! $disabled) $resultat.=' - '.dol_trunc($obj->title,12);
$resultat.='</option>';
}
print $resultat;
}
}
$i++;
}
}
print '</select>';
$db->free($resql);
return $num;
}
else
{
dol_print_error($db);
return -1;
}
global $db,$user,$conf,$langs;
$hideunselectables = false;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
$projectsListId = false;
if (empty($user->rights->projet->all->lire))
{
$projectstatic=new Project($db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
}
// On recherche les projets
$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.= " WHERE p.entity = ".$conf->entity;
if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
$sql.= " ORDER BY p.title ASC";
dol_syslog("project.lib::select_projects sql=".$sql);
$resql=$db->query($sql);
if ($resql)
{
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="0">&nbsp;</option>';
$num = $db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && ! $user->rights->societe->lire)
{
// Do nothing
}
else
{
$labeltoshow=dol_trunc($obj->ref,16);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
{
print '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
}
else
{
$disabled=0;
if (! $obj->fk_statut > 0)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Draft");
}
if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
}
if ($hideunselectables && $disabled)
{
$resultat='';
}
else
{
$resultat='<option value="'.$obj->rowid.'"';
if ($disabled) $resultat.=' disabled="disabled"';
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat.='>'.$labeltoshow;
if (! $disabled) $resultat.=' - '.dol_trunc($obj->title,12);
$resultat.='</option>';
}
print $resultat;
}
}
$i++;
}
}
print '</select>';
$db->free($resql);
return $num;
}
else
{
dol_print_error($db);
return -1;
}
}

View File

@ -253,7 +253,7 @@ class FactureFournisseur extends Facture
function fetch($id='',$ref='')
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.facnumber,";
@ -461,9 +461,9 @@ class FactureFournisseur extends Facture
if (isset($this->tva)) $this->tva=trim($this->tva);
if (isset($this->localtax1)) $this->localtax1=trim($this->localtax1);
if (isset($this->localtax2)) $this->localtax2=trim($this->localtax2);
if (isset($this->total)) $this->total=trim($this->total);
if (isset($this->total_ht)) $this->total_ht=trim($this->total_ht);
if (isset($this->total_tva)) $this->total_tva=trim($this->total_tva);
if (empty($this->total)) $this->total=0;
if (empty($this->total_ht)) $this->total_ht=0;
if (empty($this->total_tva)) $this->total_tva=0;
// if (isset($this->total_localtax1)) $this->total_localtax1=trim($this->total_localtax1);
// if (isset($this->total_localtax2)) $this->total_localtax2=trim($this->total_localtax2);
if (isset($this->total_ttc)) $this->total_ttc=trim($this->total_ttc);

View File

@ -1,22 +1,22 @@
<?php
/* Copyright (C) 2003-2004 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-2009 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/fourn/facture/document.php
@ -35,7 +35,7 @@ $langs->load('bills');
$langs->load('other');
$langs->load("companies");
$facid = isset($_GET["facid"])?$_GET["facid"]:'';
$facid = GETPOST("facid")?GETPOST("facid"):GETPOST("id");
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action'];
// Security check
@ -46,13 +46,16 @@ $result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
if ($page == -1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$object = new FactureFournisseur($db);
/*
@ -62,61 +65,70 @@ if (! $sortfield) $sortfield="name";
// Envoi fichier
if ($_POST['sendit'] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref;
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref;
if (create_exdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
}
else
{
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
}
else // Known error
{
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
}
}
}
}
if (create_exdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
}
else
{
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
}
else // Known error
{
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
}
}
}
}
}
// Delete
if ($action=='delete')
{
$facid=$_GET['id'];
$facid=$_GET['id'];
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref;
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans('FileWasRemoved').'</div>';
}
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans('FileWasRemoved').'</div>';
}
}
// Set label
if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
{
$object->fetch($facid);
$object->label=$_POST['label'];
$result=$object->update($user);
if ($result < 0) dol_print_error($db);
}
/*
* Affichage
* View
*/
$form = new Form($db);
@ -125,71 +137,116 @@ llxHeader();
if ($facid > 0)
{
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$facture->fetch_thirdparty();
if ($object->fetch($facid))
{
$object->fetch_thirdparty();
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref;
$ref=dol_sanitizeFileName($object->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref;
$head = facturefourn_prepare_head($facture);
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill');
$head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill');
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
foreach($filearray as $key => $file)
{
$totalsize+=$file['size'];
}
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
foreach($filearray as $key => $file)
{
$totalsize+=$file['size'];
}
print '<table class="border"width="100%">';
print '<table class="border"width="100%">';
// Ref
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($facture,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref
print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref supplier
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$facture->ref_supplier.'</td>';
print "</tr>\n";
// Ref supplier
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
print "</tr>\n";
// Societe
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$facture->thirdparty->getNomUrl(1).'</td></tr>';
// Thirdparty
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.count($filearray).'</td></tr>';
// Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
print $object->getLibType();
if ($object->type == 1)
{
$facreplaced=new FactureFournisseur($db);
$facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
}
if ($object->type == 2)
{
$facusing=new FactureFournisseur($db);
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
}
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';
$facidavoir=$object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0)
{
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
$i=0;
foreach($facidavoir as $id)
{
if ($i==0) print ' ';
else print ',';
$facavoir=new FactureFournisseur($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
print ')';
}
if ($facidnext > 0)
{
$facthatreplace=new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
print '</td></tr>';
print '</table>';
print '</div>';
// Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td>';
if ($mesg) { print $mesg.'<br>'; }
// Nb of files
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';
print '</table>';
print '</div>';
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$facture->id,'',0,0,$user->rights->fournisseur->facture->creer);
dol_htmloutput_mesg($mesg);
// List of document
$param='&facid='.$facture->id;
$formfile->list_of_documents($filearray,$facture,'facture_fournisseur',$param,0,get_exdir($facture->id,2,0).$facture->id.'/');
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer);
}
else
{
print 'facid='.$facid.'<br>';
dol_print_error($db);
}
// List of document
$param='&facid='.$object->id;
$formfile->list_of_documents($filearray,$object,'facture_fournisseur',$param,0,get_exdir($object->id,2,0).$object->id.'/');
}
else
{
print 'facid='.$facid.'<br>';
dol_print_error($db);
}
}
else
{
print $langs->trans('UnkownError');
print $langs->trans('UnkownError');
}
$db->close();

View File

@ -149,7 +149,7 @@ if (($action == 'setref_supplier' || $action == 'set_ref_supplier') && $user->ri
$result=$object->set_ref_supplier($user, $_POST['ref_supplier']);
}
// Set supplier ref
// Set label
if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
{
$object->fetch($id);
@ -217,9 +217,8 @@ if ($action == 'update' && ! $_POST['cancel'])
$result = $db->query($sql);
}
}
/*
* Action creation
*/
// Create
if ($action == 'add' && $user->rights->fournisseur->facture->creer)
{
$error=0;
@ -640,9 +639,7 @@ if ($action == 'reopen' && $user->rights->fournisseur->facture->creer)
}
}
/*
* Add file in email form
*/
// Add file in email form
if ($_POST['addfile'])
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
@ -656,9 +653,7 @@ if ($_POST['addfile'])
$action='presend';
}
/*
* Remove file in email form
*/
// Remove file in email form
if (! empty($_POST['removedfile']))
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
@ -672,9 +667,7 @@ if (! empty($_POST['removedfile']))
$action='presend';
}
/*
* Send mail
*/
// Send mail
if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{
$langs->load('mails');
@ -830,10 +823,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
//$action = 'presend';
}
/*
* Build document
*/
// Build document
if ($action == 'builddoc')
{
// Save modele used
@ -879,7 +869,7 @@ if ($action == 'remove_file')
/*
* View
*/
*/
$form = new Form($db);
$formfile = new FormFile($db);
@ -1312,7 +1302,6 @@ else
}
print '</td></tr>';
// Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td><td colspan="3">';
print $form->editfieldval("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer));

View File

@ -29,27 +29,27 @@ require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
if (!$user->rights->fournisseur->facture->lire)
accessforbidden();
if (!$user->rights->fournisseur->facture->lire) accessforbidden();
$langs->load("companies");
$langs->load("bills");
$socid = $_GET["socid"];
$socid = GETPOST("socid");
// Security check
if ($user->societe_id > 0)
{
$_GET["action"] = '';
$action='';
$_GET["action"] = '';
$socid = $user->societe_id;
}
$mode=GETPOST("mode");
$modesearch=GETPOST("mode_search");
$page=$_GET["page"];
$sortorder = $_GET["sortorder"];
$sortfield = $_GET["sortfield"];
$page=GETPOST("page");
$sortorder = GETPOST("sortorder");
$sortfield = GETPOST("sortfield");
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
@ -59,8 +59,8 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="fac.datef";
$month =$_GET['month'];
$year =$_GET['year'];
$month = GETPOST('month','int');
$year = GETPOST('year','int');
/*
@ -122,13 +122,13 @@ if ($_GET["filtre"])
}
}
if ($_REQUEST["search_ref"])
if (GETPOST("search_ref"))
{
$sql .= " AND fac.rowid like '%".$db->escape($_REQUEST["search_ref"])."%'";
$sql .= " AND fac.rowid like '%".$db->escape(GETPOST("search_ref"))."%'";
}
if ($_REQUEST["search_ref_supplier"])
if (GETPOST("search_ref_supplier"))
{
$sql .= " AND fac.facnumber like '%".$db->escape($_REQUEST["search_ref_supplier"])."%'";
$sql .= " AND fac.facnumber like '%".$db->escape(GETPOST("search_ref_supplier"))."%'";
}
if ($month > 0)
{
@ -141,24 +141,24 @@ else if ($year > 0)
{
$sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if ($_GET["search_libelle"])
if (GETPOST("search_libelle"))
{
$sql .= " AND fac.libelle like '%".$db->escape($_GET["search_libelle"])."%'";
$sql .= " AND fac.libelle like '%".$db->escape(GETPOST("search_libelle"))."%'";
}
if ($_GET["search_societe"])
if (GETPOST("search_societe"))
{
$sql .= " AND s.nom like '%".$db->escape($_GET["search_societe"])."%'";
$sql .= " AND s.nom like '%".$db->escape(GETPOST("search_societe"))."%'";
}
if ($_GET["search_montant_ht"])
if (GETPOST("search_montant_ht"))
{
$sql .= " AND fac.total_ht = '".$db->escape($_GET["search_montant_ht"])."'";
$sql .= " AND fac.total_ht = '".$db->escape(GETPOST("search_montant_ht"))."'";
}
if ($_GET["search_montant_ttc"])
if (GETPOST("search_montant_ttc"))
{
$sql .= " AND fac.total_ttc = '".$db->escape($_GET["search_montant_ttc"])."'";
$sql .= " AND fac.total_ttc = '".$db->escape(GETPOST("search_montant_ttc"))."'";
}
$sql.= $db->order($sortfield,$sortorder);
@ -175,11 +175,15 @@ if ($resql)
$soc->fetch($socid);
}
$param='&amp;socid='.$socid;
if ($month) $param.='&amp;month='.$month;
if ($year) $param.='&amp;year=' .$year;
if ($month) $param.='&amp;month='.urlencode($month);
if ($year) $param.='&amp;year=' .urlencode($year);
if (GETPOST("search_ref")) $param.='&amp;search_ref='.urlencode(GETPOST("search_ref"));
if (GETPOST("search_ref_supplier")) $param.='&amp;search_ref_supplier'.urlencode(GETPOST("search_ref_supplier"));
if (GETPOST("search_libelle")) $param.='&amp;search_libelle='.urlencode(GETPOST("search_libelle"));
if (GETPOST("search_societe")) $param.='&amp;search_societe='.urlencode(GETPOST("search_societe"));
if (GETPOST("search_montant_ht")) $param.='&amp;search_montant_ht='.urlencode(GETPOST("search_montant_ht"));
if (GETPOST("search_montant_ttc")) $param.='&amp;search_montant_ttc='.urlencode(GETPOST("search_montant_ttc"));
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->nom":""),$page,"index.php",$param,$sortfield,$sortorder,'',$num);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -200,10 +204,10 @@ if ($resql)
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$_REQUEST["search_ref"].'">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.GETPOST("search_ref").'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$_REQUEST["search_ref_supplier"].'">';
print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.GETPOST("search_ref_supplier").'">';
print '</td>';
print '<td class="liste_titre" colspan="1" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
@ -214,14 +218,14 @@ if ($resql)
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="16" type="text" name="search_libelle" value="'.$_GET["search_libelle"].'">';
print '<input class="flat" size="16" type="text" name="search_libelle" value="'.GETPOST("search_libelle").'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="8" name="search_societe" value="'.$_GET["search_societe"].'">';
print '<input class="flat" type="text" size="8" name="search_societe" value="'.GETPOST("search_societe").'">';
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.$_GET["search_montant_ht"].'">';
print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.GETPOST("search_montant_ht").'">';
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.$_GET["search_montant_ttc"].'">';
print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.GETPOST("search_montant_ttc").'">';
print '</td><td class="liste_titre" colspan="2" align="center">';
print '<input type="image" class="liste_titre" align="right" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
@ -238,16 +242,16 @@ if ($resql)
$obj = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap>';
print "<tr ".$bc[$var].">";
print '<td nowrap="nowrap">';
$facturestatic->id=$obj->facid;
$facturestatic->ref=$obj->ref;
$facturestatic->ref_supplier=$obj->facnumber;
print $facturestatic->getNomUrl(1);
print "</td>\n";
print '<td nowrap>'.dol_trunc($obj->facnumber,10)."</td>";
print '<td align="center" nowrap="1">'.dol_print_date($db->jdate($obj->datef),'day').'</td>';
print '<td align="center" nowrap="1">'.dol_print_date($db->jdate($obj->date_echeance),'day');
print '<td nowrap="nowrap">'.dol_trunc($obj->facnumber,10)."</td>";
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($obj->datef),'day').'</td>';
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($obj->date_echeance),'day');
if (($obj->paye == 0) && ($obj->fk_statut > 0) && $db->jdate($obj->date_echeance) < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print '</td>';
print '<td>'.dol_trunc($obj->libelle,36).'</td>';

View File

@ -1,21 +1,21 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/fourn/facture/note.php
@ -31,138 +31,191 @@ require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
$langs->load('bills');
$langs->load("companies");
$facid = isset($_GET["facid"])?$_GET["facid"]:'';
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action'];
$facid = GETPOST("facid")?GETPOST("facid"):GETPOST('id');
$action = GETPOST('action');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture');
$fac = new FactureFournisseur($db);
$fac->fetch($_GET["facid"]);
$object = new FactureFournisseur($db);
$object->fetch($facid);
/******************************************************************************/
/* Actions */
/******************************************************************************/
if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
if ($action == 'update_public' && $user->rights->facture->creer)
{
$db->begin();
$db->begin();
$res=$fac->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$fac->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
$res=$object->update_note_public($_POST["note_public"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$object->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
}
if ($_POST["action"] == 'update' && $user->rights->fournisseur->facture->creer)
if ($action == 'update' && $user->rights->fournisseur->facture->creer)
{
$db->begin();
$db->begin();
$res=$fac->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$fac->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
$res=$object->update_note($_POST["note"],$user);
if ($res < 0)
{
$mesg='<div class="error">'.$object->error.'</div>';
$db->rollback();
}
else
{
$db->commit();
}
}
// Set label
if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
{
$object->fetch($facid);
$object->label=$_POST['label'];
$result=$object->update($user);
if ($result < 0) dol_print_error($db);
}
/*
* View
*/
*/
$form = new Form($db);
llxHeader();
if ($_GET["facid"])
if ($facid)
{
$fac->fetch_thirdparty();
$object->fetch_thirdparty();
$head = facturefourn_prepare_head($fac);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'note', $titre, 0, 'bill');
$head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'note', $titre, 0, 'bill');
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($fac,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref
print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object,'facid','',1,'rowid','ref',$morehtmlref);
print '</td>';
print "</tr>\n";
// Ref supplier
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$fac->ref_supplier.'</td>';
print "</tr>\n";
// Ref supplier
print '<tr><td nowrap="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
print "</tr>\n";
// Company
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$fac->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
// Note publique
// Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">';
print $object->getLibType();
if ($object->type == 1)
{
$facreplaced=new FactureFournisseur($db);
$facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
}
if ($object->type == 2)
{
$facusing=new FactureFournisseur($db);
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
}
$facidavoir=$object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0)
{
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
$i=0;
foreach($facidavoir as $id)
{
if ($i==0) print ' ';
else print ',';
$facavoir=new FactureFournisseur($db);
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
print ')';
}
if ($facidnext > 0)
{
$facthatreplace=new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
print '</td></tr>';
// Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">';
print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td>';
// Note public
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
print '<td valign="top" colspan="3">';
print '<td valign="top" colspan="3">';
if ($_GET["action"] == 'edit')
{
print '<form method="post" action="note.php?facid='.$fac->id.'">';
print '<form method="post" action="note.php?facid='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update_public">';
print '<textarea name="note_public" cols="80" rows="8">'.$fac->note_public."</textarea><br>";
print '<textarea name="note_public" cols="80" rows="8">'.$object->note_public."</textarea><br>";
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</form>';
}
else
{
print ($fac->note_public?nl2br($fac->note_public):"&nbsp;");
print ($object->note_public?nl2br($object->note_public):"&nbsp;");
}
print "</td></tr>";
print "</td></tr>";
// Note private
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
print '<td valign="top" colspan="3">';
if ($_GET["action"] == 'edit')
{
print '<form method="post" action="note.php?facid='.$fac->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<textarea name="note" cols="80" rows="8">'.$fac->note."</textarea><br>";
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</form>';
}
else
{
print ($fac->note?nl2br($fac->note):"&nbsp;");
}
print "</td></tr>";
}
// Note private
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
print '<td valign="top" colspan="3">';
if ($_GET["action"] == 'edit')
{
print '<form method="post" action="note.php?facid='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<textarea name="note" cols="80" rows="8">'.$object->note."</textarea><br>";
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</form>';
}
else
{
print ($object->note?nl2br($object->note):"&nbsp;");
}
print "</td></tr>";
}
print "</table>";
dol_fiche_end();
/*
* Actions
* Buttons
*/
print '<div class="tabsAction">';
if ($user->rights->fournisseur->facture->creer && $_GET["action"] <> 'edit')
{
print "<a class=\"butAction\" href=\"note.php?facid=$fac->id&amp;action=edit\">".$langs->trans('Modify')."</a>";
print "<a class=\"butAction\" href=\"note.php?facid=$object->id&amp;action=edit\">".$langs->trans('Modify')."</a>";
}
print "</div>";

File diff suppressed because one or more lines are too long

View File

@ -146,5 +146,79 @@ class DateLibTest extends PHPUnit_Framework_TestCase
return $result;
}
/**
*/
public function testDolPrintDate()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// Check %Y-%m-%d %H:%M:%S format
$result=dol_print_date(0,'%Y-%m-%d %H:%M:%S',true);
print __METHOD__." result=".$result."\n";
$this->assertEquals('1970-01-01 00:00:00',$result);
// Check dayhour format for fr_FR
$outputlangs=new Translate('',$conf);
$outputlangs->setDefaultLang('fr_FR');
$outputlangs->load("main");
$result=dol_print_date(0+24*3600,'dayhour',true,$outputlangs);
print __METHOD__." result=".$result."\n";
$this->assertEquals('02/01/1970 00:00',$result);
// Check day format for en_US
$outputlangs=new Translate('',$conf);
$outputlangs->setDefaultLang('en_US');
$outputlangs->load("main");
$result=dol_print_date(0+24*3600,'day',true,$outputlangs);
print __METHOD__." result=".$result."\n";
$this->assertEquals('01/02/1970',$result);
// Check %a and %b format for en_US
$result=dol_print_date(0,'%a %b',true,$outputlangs);
print __METHOD__." result=".$result."\n";
$this->assertEquals('Thu jan',$result);
return $result;
}
/**
*/
public function testDolTimePlusDuree()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// Check dayhour format for fr_FR
$outputlangs=new Translate('',$conf);
$outputlangs->setDefaultLang('fr_FR');
$outputlangs->load("main");
$result=dol_print_date(dol_time_plus_duree(dol_time_plus_duree(dol_time_plus_duree(0,1,'m'),1,'y'),1,'d'),'dayhour',true,$outputlangs);
print __METHOD__." result=".$result."\n";
$this->assertEquals('02/02/1971 00:00',$result);
return $result;
}
/**
*/
public function testDolGetFirstDay()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
}
}
?>