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

This commit is contained in:
Regis Houssin 2011-10-29 20:49:55 +02:00
commit cbc27b2ac9
19 changed files with 110 additions and 89 deletions

View File

@ -87,7 +87,7 @@ else
}
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->compta->mode;
$modecompta = $conf->global->COMPTA_MODE;
if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"];

View File

@ -44,7 +44,7 @@ if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->compta
accessforbidden();
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->compta->mode;
$modecompta = $conf->global->COMPTA_MODE;
if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"];

View File

@ -34,7 +34,7 @@ if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->compta
accessforbidden();
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->compta->mode;
$modecompta = $conf->global->COMPTA_MODE;
if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"];
$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];

View File

@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
$langs->load("companies");
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->compta->mode;
$modecompta = $conf->global->COMPTA_MODE;
if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"];
$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];

View File

@ -45,7 +45,7 @@ if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->compta
accessforbidden();
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->compta->mode;
$modecompta = $conf->global->COMPTA_MODE;
if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"];

View File

@ -49,7 +49,8 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
* Gets VAT to collect for the given month of the given year
* The function gets the VAT in split results, as the VAT declaration asks
* to report the amounts for different VAT rates as different lines.
* This function also accounts recurrent invoices
* This function also accounts recurrent invoices.
*
* @param db Database handler
* @param y Year
* @param q Year quarter (1-4)
@ -57,7 +58,8 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
function tva_coll($db,$y,$q)
{
global $conf;
if ($conf->compta->mode == "CREANCES-DETTES")
if ($conf->global->COMPTA_MODE == "CREANCES-DETTES")
{
// if vat paid on due invoices
$sql = "SELECT d.fk_facture as facid, f.facnumber as facnum, d.tva_tx as rate, d.total_ht as totalht, d.total_tva as amount";
@ -124,7 +126,7 @@ function tva_paye($db, $y,$q)
{
global $conf;
if ($conf->compta->mode == "CREANCES-DETTES")
if ($conf->global->COMPTA_MODE == "CREANCES-DETTES")
{
// Si on paye la tva sur les factures dues (non brouillon)
$sql = "SELECT d.fk_facture_fourn as facid, f.facnumber as facnum, d.tva_tx as rate, d.total_ht as totalht, d.tva as amount";
@ -208,10 +210,9 @@ print "<td align=\"right\">".$langs->trans("Invoices")."</td>";
print "<td align=\"right\">".$langs->trans("TotalToPay")."</td>";
print "</tr>\n";
if ($conf->compta->mode == "CREANCES-DETTES")
if ($conf->global->COMPTA_MODE == "CREANCES-DETTES")
{
$y = $year_current ;
$y = $year_current;
$total = 0; $subtotal = 0;
$i=0;
@ -219,7 +220,7 @@ if ($conf->compta->mode == "CREANCES-DETTES")
$subtot_coll_vat = 0;
$subtot_paye_total = 0;
$subtot_paye_vat = 0;
for ($q = 1 ; $q <= 4 ; $q++ )
for ($q = 1 ; $q <= 4 ; $q++)
{
print "<tr class=\"liste_titre\"><td colspan=\"8\">".$langs->trans("Quadri")." $q (".dol_print_date(dol_mktime(0,0,0,(($q-1)*3)+1,1,$y),"%b %Y").' - '.dol_print_date(dol_mktime(0,0,0,($q*3),1,$y),"%b %Y").")</td></tr>";
$var=true;

View File

@ -944,35 +944,35 @@ class Contact extends CommonObject
if ($statut==4) return $langs->trans('StatusContactValidated');
if ($statut==5) return $langs->trans('StatusContactValidated');
}
if ($mode == 1)
elseif ($mode == 1)
{
if ($statut==0) return $langs->trans('StatusContactDraftShort');
if ($statut==1) return $langs->trans('StatusContactValidatedShort');
if ($statut==4) return $langs->trans('StatusContactValidatedShort');
if ($statut==5) return $langs->trans('StatusContactValidatedShort');
}
if ($mode == 2)
elseif ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans('StatusContactDraftShort'),'statut0').' '.$langs->trans('StatusContactDraft');
if ($statut==1) return img_picto($langs->trans('StatusContactValidatedShort'),'statut1').' '.$langs->trans('StatusContactValidated');
if ($statut==4) return img_picto($langs->trans('StatusContactValidatedShort'),'statut4').' '.$langs->trans('StatusContactValidated');
if ($statut==5) return img_picto($langs->trans('StatusContactValidatedShort'),'statut5').' '.$langs->trans('StatusContactValidated');
}
if ($mode == 3)
elseif ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans('StatusContactDraft'),'statut0');
if ($statut==1) return img_picto($langs->trans('StatusContactValidated'),'statut1');
if ($statut==4) return img_picto($langs->trans('StatusContactValidated'),'statut4');
if ($statut==5) return img_picto($langs->trans('StatusContactValidated'),'statut5');
}
if ($mode == 4)
elseif ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans('StatusContactDraft'),'statut0').' '.$langs->trans('StatusContactDraft');
if ($statut==1) return img_picto($langs->trans('StatusContactValidated'),'statut1').' '.$langs->trans('StatusContactValidated');
if ($statut==4) return img_picto($langs->trans('StatusContactValidated'),'statut4').' '.$langs->trans('StatusContactValidated');
if ($statut==5) return img_picto($langs->trans('StatusContactValidated'),'statut5').' '.$langs->trans('StatusContactValidated');
}
if ($mode == 5)
elseif ($mode == 5)
{
if ($statut==0) return $langs->trans('StatusContactDraftShort').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0');
if ($statut==1) return $langs->trans('StatusContactValidatedShort').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1');

View File

@ -38,6 +38,9 @@ class Conf
var $db;
//! To store properties found in conf file
var $file;
//! To store properties found into database
var $global;
//! To store if javascript/ajax is enabked
var $use_javascript_ajax;
@ -73,10 +76,15 @@ class Conf
*/
function Conf()
{
//! Charset for HTML output and for storing data in memory
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
// $this->agendas_modules['comm/action'][]= 'ActionAgenda';
// Avoid warnings when filling this->xxx
$this->file=(object) array();
$this->db=(object) array();
$this->global=(object) array();
$this->mycompany=(object) array();
$this->admin=(object) array();
$this->user=(object) array();
//! Charset for HTML output and for storing data in memory
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
}
@ -172,6 +180,7 @@ class Conf
{
$module=strtolower($reg[1]);
//print "Module ".$module." is enabled<br>\n";
$this->$module=(object) array();
$this->$module->enabled=true;
// Add this module in list of enabled modules
$this->modules[]=$module;
@ -231,7 +240,6 @@ class Conf
// For backward compatibility
// TODO Replace this->xxx->enabled by this->modulename->enabled to remove this code
if (isset($this->comptabilite->enabled)) $this->compta->enabled=$this->comptabilite->enabled;
if (isset($this->propale->enabled)) $this->propal->enabled=$this->propale->enabled;
// Define default dir_output and dir_temp for directories of modules
@ -313,10 +321,8 @@ class Conf
$this->monnaie=$this->global->MAIN_MONNAIE; // TODO deprecated
$this->currency=$this->global->MAIN_MONNAIE;
// $this->compta->mode = Option du module Comptabilite (simple ou expert):
// Defini le mode de calcul des etats comptables (CA,...)
$this->compta->mode = 'RECETTES-DEPENSES'; // By default
if (isset($this->global->COMPTA_MODE)) $this->compta->mode = $this->global->COMPTA_MODE; // Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
// $this->global->COMPTA_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if (empty($this->global->COMPTA_MODE)) $this->global->COMPTA_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
// $this->liste_limit = constante de taille maximale des listes
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;

View File

@ -50,10 +50,11 @@ function get_ca_propal ($db, $year, $socid)
function get_ca ($db, $year, $socid)
{
global $conf;
$sql = "SELECT sum(f.amount) as sum FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE f.fk_statut in (1,2)";
if ($conf->compta->mode != 'CREANCES-DETTES') {
if ($conf->global->COMPTA_MODE != 'CREANCES-DETTES')
{
$sql .= " AND f.paye = 1";
}
$sql .= " AND date_format(f.datef , '%Y') = '".$year."'";

View File

@ -585,7 +585,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
$out.="</div>\n";
if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
// Parameters for edit in place
if (! empty($GLOBALS['object']))
{
@ -3848,10 +3848,10 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
/**
* Format output for start and end date
*
* @param date_start Start date
* @param date_end End date
* @param format Output format
* @param outputlangs Output language
* @param timestamp $date_start Start date
* @param timestamp $date_end End date
* @param string $format Output format
* @param Translate $outputlangs Output language
* @return void
*/
function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
@ -3862,11 +3862,11 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
/**
* Format output for start and end date
*
* @param date_start Start date
* @param date_end End date
* @param format Output format
* @param outputlangs Output language
* @return string String
* @param timestamp $date_start Start date
* @param timestamp $date_end End date
* @param string $format Output format
* @param Translate $outputlangs Output language
* @return string String
*/
function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
{

View File

@ -362,15 +362,13 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Make substitutions into odt of freetext
if ($newfreetext)
{
try {
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
}
catch(OdfException $e)
{
}
try {
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
}
catch(OdfException $e)
{
}
// Make substitutions into odt of user info
$tmparray=$this->get_substitutionarray_user($user,$outputlangs);
//var_dump($tmparray); exit;
@ -432,8 +430,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{
}
}
// Replace tags of object
// Replace tags of object + external modules
$tmparray=$this->get_substitutionarray_object($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object);
foreach($tmparray as $key=>$value)
{
try {

View File

@ -43,7 +43,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $db Database handler
*/
function doc_generic_odt($db)
{
@ -226,7 +226,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc
// Open and load template
require_once(ODTPHP_PATH.'odf.php');
$odfHandler = new odf($srctemplatepath, array(
$odfHandler = new odf($srctemplatepath, array
(
'PATH_TO_TMP' => $conf->societe->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
@ -255,6 +256,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
catch(OdfException $e)
{
// setVars failed, probably because key not found
}
}
// Make substitutions into odt of mysoc info
@ -276,11 +278,12 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
catch(OdfException $e)
{
// setVars failed, probably because key not found
}
}
// Make substitutions into odt of thirdparty + external modules
$tmparray=$this->get_substitutionarray_thirdparty($object,$outputlangs);
complete_substitutions_array($tmparray, $langs, $object);
complete_substitutions_array($tmparray, $outputlangs, $object);
//var_dump($object->id); exit;
foreach($tmparray as $key=>$value)
{
@ -297,6 +300,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
catch(OdfException $e)
{
// setVars failed, probably because key not found
}
}

View File

@ -352,12 +352,12 @@ abstract class ModeleAccountancyCode
/**
* Create a document for third party
*
* @param db Database handler
* @param id Id of third party to use
* @param message Message
* @param modele Force model to use ('' to not force). model can be a model name or a template file.
* @param outputlangs Objet lang to use for translation
* @return int <0 if KO, >0 if OK
* @param DoliDB $db Database handler
* @param int $id Id of third party to use
* @param string $message Message
* @param string $modele Force model to use ('' to not force). model can be a model name or a template file.
* @param Translate $outputlangs Object lang to use for translation
* @return int <0 if KO, >0 if OK
*/
function thirdparty_doc_create($db, $id, $message, $modele, $outputlangs)
{

View File

@ -33,30 +33,29 @@ if (! defined('DOL_VERSION')) define('DOL_VERSION','3.2.0-alpha'); // Also defin
if (! defined('EURO')) define('EURO',chr(128));
// Definition des constantes syslog
if (function_exists("define_syslog_variables"))
if (! defined('LOG_DEBUG'))
{
if (version_compare(PHP_VERSION, '5.3.0', '<'))
{
define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized
}
if (function_exists("define_syslog_variables"))
{
define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized
}
else
{
// Pour PHP sans syslog (comme sous Windows)
define('LOG_EMERG',0);
define('LOG_ALERT',1);
define('LOG_CRIT',2);
define('LOG_ERR',3);
define('LOG_WARNING',4);
define('LOG_NOTICE',5);
define('LOG_INFO',6);
define('LOG_DEBUG',7);
}
}
else
{
// Pour PHP sans syslog (comme sous Windows)
define('LOG_EMERG',0);
define('LOG_ALERT',1);
define('LOG_CRIT',2);
define('LOG_ERR',3);
define('LOG_WARNING',4);
define('LOG_NOTICE',5);
define('LOG_INFO',6);
define('LOG_DEBUG',7);
}
// Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL)
error_reporting(E_ALL ^ E_NOTICE);
//error_reporting(E_ALL);
//error_reporting(E_ALL | E_STRICT);
// Define vars

View File

@ -93,9 +93,9 @@ DeleteSocialContribution=Διαγραφή κοινωνικής εισφοράς
ConfirmDeleteSocialContribution=Είστε σίγουροι ότι θέλετε να διαγράψετε την κοινωνική εισφορά;
ExportDataset_tax_1=Social contributions and payments
AnnualSummaryDueDebtMode=Balance of income and expenses, annual summary, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode <b>%sRevenues-Expensens%s</b> said <b>cash accounting</b>.
AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode <b>%sIncomes-Expensens%s</b> said <b>cash accounting</b>.
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third parties, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sRevenues-Expenses%s</b> said <b>cash accounting</b>.
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
SeeReportInInputOutputMode=See report <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b> for a calculation on actual payments made
SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices
RulesResultDue=- Amounts shown are with all taxes included<br>- It includes outstanding invoices, expenses and VAT whether they are paid or not. <br>- It is based on the validation date of invoices and VAT and on the due date for expenses.

View File

@ -6,8 +6,8 @@ Treasury=Treasury
MenuFinancial=Financial
TaxModuleSetupToModifyRules=Go to <a href="%s">module setup</a> to modify rules for calculation
OptionMode=Option for accountancy
OptionModeTrue=Option Input-Output
OptionModeVirtual=Option Credits-Debits
OptionModeTrue=Option Incomes-Expenses
OptionModeVirtual=Option Claims-Debts
OptionModeTrueDesc=In this context, the turnover is calculated over payments (date of payments). \nThe validity of the figures is assured only if the book-keeping is scrutinized through the input/output on the accounts via invoices.
OptionModeVirtualDesc=In this context, the turnover is calculated over invoices (date of validation). When these invoices are due, whether they have been paid or not, they are listed in the turnover output.
FeatureIsSupportedInInOutModeOnly=Feature only available in CREDITS-DEBTS accountancy mode (See Accountancy module configuration)
@ -102,9 +102,9 @@ DeleteSocialContribution=Delete a social contribution
ConfirmDeleteSocialContribution=Are you sure you want to delete this social contribution?
ExportDataset_tax_1=Social contributions and payments
AnnualSummaryDueDebtMode=Balance of income and expenses, annual summary, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode <b>%sRevenues-Expenses%s</b> said <b>cash accounting</b>.
AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third parties, mode <b>%sClaims-Debts%s</b> said <b>Commitment accounting</b>.
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sRevenues-Expenses%s</b> said <b>cash accounting</b>.
AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b>.
SeeReportInInputOutputMode=See report <b>%sIncomes-Expenses%s</b> said <b>cash accounting</b> for a calculation on actual payments made
SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices
RulesResultDue=- Amounts shown are with all taxes included<br>- It includes outstanding invoices, expenses and VAT whether they are paid or not. <br>- It is based on the validation date of invoices and VAT and on the due date for expenses.

View File

@ -42,7 +42,6 @@ require_once("filefunc.inc.php"); // May have been already require by main.inc.p
require_once(DOL_DOCUMENT_ROOT."/core/class/conf.class.php");
$conf = new Conf();
// Identifiant propres au serveur base de donnee
$conf->db->host = $dolibarr_main_db_host;
$conf->db->port = $dolibarr_main_db_port;

View File

@ -150,7 +150,6 @@ class Societe extends CommonObject
$this->db = $DB;
$this->id = $id;
$this->client = 0;
$this->prospect = 0;
$this->fournisseur = 0;
@ -720,12 +719,12 @@ class Societe extends CommonObject
$this->parent = $obj->parent;
$this->siren = $obj->siren; // TODO obsolete
$this->idprof1 = $obj->siren;
$this->siret = $obj->siret; // TODO obsolete
$this->idprof2 = $obj->siret;
$this->ape = $obj->ape; // TODO obsolete
$this->idprof3 = $obj->ape;
$this->siren = $obj->idprof1; // TODO obsolete
$this->idprof1 = $obj->idprof1;
$this->siret = $obj->idprof2; // TODO obsolete
$this->idprof2 = $obj->idprof2;
$this->ape = $obj->idprof3; // TODO obsolete
$this->idprof3 = $obj->idprof3;
$this->idprof4 = $obj->idprof4;
$this->capital = $obj->capital;
@ -2521,6 +2520,11 @@ class Societe extends CommonObject
$this->tva_intra='EU1234567';
$this->note_public='This is a comment (public)';
$this->note='This is a comment (private)';
$this->idprof1='idprof1';
$this->idprof2='idprof2';
$this->idprof3='idprof3';
$this->idprof4='idprof4';
}
}

View File

@ -177,6 +177,10 @@ class SocieteTest extends PHPUnit_Framework_TestCase
$localobject->fax='New fax';
$localobject->email='New email';
$localobject->url='New url';
$localobject->idprof1='new idprof1';
$localobject->idprof2='new idprof2';
$localobject->idprof3='new idprof3';
$localobject->idprof4='new idprof4';
$result=$localobject->update($localobject->id,$user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
@ -203,6 +207,10 @@ class SocieteTest extends PHPUnit_Framework_TestCase
$this->assertEquals($localobject->fax, $newobject->fax);
$this->assertEquals($localobject->email, $newobject->email);
$this->assertEquals($localobject->url, $newobject->url);
$this->assertEquals($localobject->idprof1, $newobject->idprof1);
$this->assertEquals($localobject->idprof2, $newobject->idprof2);
$this->assertEquals($localobject->idprof3, $newobject->idprof3);
$this->assertEquals($localobject->idprof4, $newobject->idprof4);
return $localobject;
}