diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index a5c566391e9..9d24bbe3c48 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -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"]; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 2af686bdec7..35f3e1aedfe 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -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"]; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 4b02a954fac..da20dd3a7cd 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -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"]; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 7962b3f1059..4fbdbd7eaed 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -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"]; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 2942b62c912..a243cfedc34 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -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"]; diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index d02ebf630d6..3154c5de299 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -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 "".$langs->trans("Invoices").""; print "".$langs->trans("TotalToPay").""; print "\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 "".$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").")"; $var=true; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 18e021b15be..8fcfa734e51 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -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'); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 44a366f876c..5895d3a8c45 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -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
\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; diff --git a/htdocs/core/lib/accountancy.lib.php b/htdocs/core/lib/accountancy.lib.php index a1500797866..f0586fc50d7 100644 --- a/htdocs/core/lib/accountancy.lib.php +++ b/htdocs/core/lib/accountancy.lib.php @@ -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."'"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a9d7d4c01c0..42d8a8d5eea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -585,7 +585,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p $out.="\n"; if (! $notab) $out.="\n".'
'."\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='') { diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 29db22df3fd..5d46b2e8fc7 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -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 { diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 76fb65db8c7..68681e069fc 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -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 } } diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index f674b4fb11f..a25c78446e0 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -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) { diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 8695e9d6004..b01d7dc61b9 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -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 diff --git a/htdocs/langs/el_GR/compta.lang b/htdocs/langs/el_GR/compta.lang index d3a424b9c8f..8bfb3e10110 100755 --- a/htdocs/langs/el_GR/compta.lang +++ b/htdocs/langs/el_GR/compta.lang @@ -93,9 +93,9 @@ DeleteSocialContribution=Διαγραφή κοινωνικής εισφοράς ConfirmDeleteSocialContribution=Είστε σίγουροι ότι θέλετε να διαγράψετε την κοινωνική εισφορά; ExportDataset_tax_1=Social contributions and payments AnnualSummaryDueDebtMode=Balance of income and expenses, annual summary, mode %sClaims-Debts%s said Commitment accounting. -AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode %sRevenues-Expensens%s said cash accounting. +AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode %sIncomes-Expensens%s said cash accounting. AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third parties, mode %sClaims-Debts%s said Commitment accounting. -AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode %sRevenues-Expenses%s said cash accounting. +AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode %sIncomes-Expenses%s said cash accounting. SeeReportInInputOutputMode=See report %sIncomes-Expenses%s said cash accounting for a calculation on actual payments made SeeReportInDueDebtMode=See report %sClaims-Debts%s said commitment accounting for a calculation on issued invoices RulesResultDue=- Amounts shown are with all taxes included
- It includes outstanding invoices, expenses and VAT whether they are paid or not.
- It is based on the validation date of invoices and VAT and on the due date for expenses. diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 6fb68b6bd24..473ef385806 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -6,8 +6,8 @@ Treasury=Treasury MenuFinancial=Financial TaxModuleSetupToModifyRules=Go to module setup 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 %sClaims-Debts%s said Commitment accounting. -AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode %sRevenues-Expenses%s said cash accounting. +AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary, mode %sIncomes-Expenses%s said cash accounting. AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by third parties, mode %sClaims-Debts%s said Commitment accounting. -AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode %sRevenues-Expenses%s said cash accounting. +AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by third parties, mode %sIncomes-Expenses%s said cash accounting. SeeReportInInputOutputMode=See report %sIncomes-Expenses%s said cash accounting for a calculation on actual payments made SeeReportInDueDebtMode=See report %sClaims-Debts%s said commitment accounting for a calculation on issued invoices RulesResultDue=- Amounts shown are with all taxes included
- It includes outstanding invoices, expenses and VAT whether they are paid or not.
- It is based on the validation date of invoices and VAT and on the due date for expenses. diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 1f223fc38f9..c56ded1c2aa 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -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; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 38a6635312b..ccb94dd5bc0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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'; } } diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 738bb8d35c6..d61d3f26a66 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -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; }