Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop-api

This commit is contained in:
Neil Orley 2017-10-24 10:50:17 +02:00
commit 37cad81a68
15 changed files with 117 additions and 197 deletions

View File

@ -319,7 +319,7 @@ script:
php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE > $TRAVIS_BUILD_DIR/upgrade600700-2.log php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
cd - cd -
set +e set +e

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -67,8 +67,8 @@ $arrayfields=array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'), 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
); );
@ -105,14 +105,32 @@ if (empty($reshook))
$search_array_options=array(); $search_array_options=array();
} }
if (GETPOST('change_chart')) if (GETPOST('change_chart','alpha'))
{ {
$chartofaccounts = GETPOST('chartofaccounts', 'int'); $chartofaccounts = GETPOST('chartofaccounts', 'int');
if (! empty($chartofaccounts)) { if ($chartofaccounts > 0)
{
// Get language code for this $chartofaccounts
$sql ='SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
$sql.=' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$country_code = $obj->code;
}
else dol_print_error($db);
// Try to load sql file
if ($country_code)
{
$sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql';
$result = run_sql($sqlfile, 1, 0, 1);
}
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error ++; $error++;
} }
} else { } else {
$error ++; $error ++;
@ -216,25 +234,29 @@ if ($resql)
// Box to select active chart of account // Box to select active chart of account
print $langs->trans("Selectchartofaccounts") . " : "; print $langs->trans("Selectchartofaccounts") . " : ";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">'; print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
$sql = "SELECT rowid, pcg_version, label, active"; $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
$sql .= " WHERE active = 1"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON a.fk_country = c.rowid";
dol_syslog('accountancy/admin/account.php:: $sql=' . $sql); $sql .= " WHERE a.active = 1";
dol_syslog('accountancy/admin/account.php $sql='.$sql);
print $sql;
$resqlchart = $db->query($sql); $resqlchart = $db->query($sql);
if ($resqlchart) { if ($resqlchart) {
$numbis = $db->num_rows($resqlchart); $numbis = $db->num_rows($resqlchart);
$i = 0; $i = 0;
while ( $i < $numbis ) { while ($i < $numbis) {
$row = $db->fetch_row($resqlchart); $obj = $db->fetch_object($resqlchart);
print '<option value="' . $row[0] . '"'; print '<option value="' . $obj->rowid . '"';
print $pcgver == $row[0] ? ' selected' : ''; print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>' . $row[1] . ' - ' . $row[2] . '</option>'; print '>' . $obj->pcg_version . ' - ' . $obj->label . ' - (' . $obj->country_code . ')</option>';
$i ++; $i++;
} }
} }
else dol_print_error($db);
print "</select>"; print "</select>";
print ajax_combobox("chartofaccounts");
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">'; print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>'; print '<br>';
print '<br>'; print '<br>';

View File

@ -41,14 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->load("errors"); $langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm"));
$langs->load("admin");
$langs->load("main");
$langs->load("companies");
$langs->load("resource");
$langs->load("holiday");
$langs->load("accountancy");
$langs->load("hrm");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
@ -100,7 +93,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
// Requests to extract data // Requests to extract data
$tabsql=array(); $tabsql=array();
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; $tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; $tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
// Criteria to sort dictionaries // Criteria to sort dictionaries
@ -110,17 +103,17 @@ $tabsqlsort[32]="position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire // Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array(); $tabfield=array();
$tabfield[31]= "pcg_version,label"; $tabfield[31]= "pcg_version,label,country_id,country";
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country"; $tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
// Nom des champs d'edition pour modification d'un enregistrement // Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array(); $tabfieldvalue=array();
$tabfieldvalue[31]= "pcg_version,label"; $tabfieldvalue[31]= "pcg_version,label,country";
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country"; $tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
// Nom des champs dans la table pour insertion d'un enregistrement // Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array(); $tabfieldinsert=array();
$tabfieldinsert[31]= "pcg_version,label"; $tabfieldinsert[31]= "pcg_version,label,fk_country";
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country"; $tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
// Nom du rowid si le champ n'est pas de type autoincrement // Nom du rowid si le champ n'est pas de type autoincrement
@ -173,7 +166,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1; $ok=1;
foreach ($listfield as $f => $value) foreach ($listfield as $f => $value)
{ {
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancyCategory','Pcg_version'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
@ -188,6 +181,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=0; $ok=0;
$fieldnamekey=$listfield[$f]; $fieldnamekey=$listfield[$f];
// We take translate key of field // We take translate key of field
if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version';
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays'; if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays';

View File

@ -569,6 +569,7 @@ if ($id)
print "</tr>"; print "</tr>";
$colspan=count($fieldlist)+3; $colspan=count($fieldlist)+3;
if ($id == 32) $colspan++;
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
} }

View File

@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$action=GETPOST('action','aZ09'); $action=GETPOST('action','aZ09');
$cancel=GETPOST('cancel','alpha');
$langs->load("companies"); $langs->load("companies");
$langs->load("products"); $langs->load("products");
@ -62,22 +63,22 @@ error_reporting($err);
* Actions * Actions
*/ */
if ($action == 'update' && empty($_POST["cancel"])) if ($action == 'update' && ! $cancel)
{ {
$_SESSION["mainmenu"]="home"; // Le gestionnaire de menu a pu changer $_SESSION["mainmenu"]="home"; // Le gestionnaire de menu a pu changer
dolibarr_set_const($db, "MAIN_MENU_STANDARD", $_POST["MAIN_MENU_STANDARD"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MENU_STANDARD", GETPOST('MAIN_MENU_STANDARD','alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENU_SMARTPHONE", $_POST["MAIN_MENU_SMARTPHONE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MENU_SMARTPHONE", GETPOST('MAIN_MENU_SMARTPHONE','alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENUFRONT_STANDARD", $_POST["MAIN_MENUFRONT_STANDARD"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MENUFRONT_STANDARD", GETPOST('MAIN_MENUFRONT_STANDARD','alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENUFRONT_SMARTPHONE",$_POST["MAIN_MENUFRONT_SMARTPHONE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MENUFRONT_SMARTPHONE", GETPOST('MAIN_MENUFRONT_SMARTPHONE','alpha'),'chaine',0,'',$conf->entity);
// Define list of menu handlers to initialize // Define list of menu handlers to initialize
$listofmenuhandler=array(); $listofmenuhandler=array();
$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_STANDARD"])]=1; $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENU_STANDARD','alpha'))]=1;
$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_STANDARD"])]=1; $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENUFRONT_STANDARD','alpha'))]=1;
if (isset($_POST["MAIN_MENU_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_SMARTPHONE"])]=1; if (GETPOST('MAIN_MENU_SMARTPHONE','alpha')) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENU_SMARTPHONE','alpha'))]=1;
if (isset($_POST["MAIN_MENUFRONT_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_SMARTPHONE"])]=1; if (GETPOST('MAIN_MENUFRONT_SMARTPHONE','alpha')) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENUFRONT_SMARTPHONE','alpha'))]=1;
// Initialize menu handlers // Initialize menu handlers
foreach ($listofmenuhandler as $key => $val) foreach ($listofmenuhandler as $key => $val)

View File

@ -110,10 +110,10 @@ $formother=new FormOther($db);
$formadmin=new FormAdmin($db); $formadmin=new FormAdmin($db);
$arraydetailsforpdffoot = array( $arraydetailsforpdffoot = array(
0 => $langs->trans('NoDetails'), 0 => $langs->transnoentitiesnoconv('NoDetails'),
1 => $langs->trans('DisplayCompanyInfo'), 1 => $langs->transnoentitiesnoconv('DisplayCompanyInfo'),
2 => $langs->trans('DisplayCompanyManagers'), 2 => $langs->transnoentitiesnoconv('DisplayCompanyManagers'),
3 => $langs->trans('DisplayCompanyInfoAndManagers') 3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
); );
print load_fiche_titre($langs->trans("PDF"),'','title_setup'); print load_fiche_titre($langs->trans("PDF"),'','title_setup');
@ -589,7 +589,7 @@ else // Show
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">'; print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print $arraydetailsforpdffoot[$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS]; print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)];
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -207,7 +207,7 @@ class Contracts extends DolibarrApi
} }
/** /**
* Get lines of an contract * Get lines of a contract
* *
* @param int $id Id of contract * @param int $id Id of contract
* *

View File

@ -691,8 +691,8 @@ class Contrat extends CommonObject
$sql.= " d.fk_user_ouverture,"; $sql.= " d.fk_user_ouverture,";
$sql.= " d.fk_user_cloture,"; $sql.= " d.fk_user_cloture,";
$sql.= " d.fk_unit"; $sql.= " d.fk_unit";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d, ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid"; $sql.= " WHERE d.fk_contrat = ".$this->id;
$sql.= " ORDER by d.rowid ASC"; $sql.= " ORDER by d.rowid ASC";
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
@ -728,7 +728,7 @@ class Contrat extends CommonObject
$line->total_localtax1 = $objp->total_localtax1; $line->total_localtax1 = $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2; $line->total_localtax2 = $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc; $line->total_ttc = $objp->total_ttc;
$line->fk_product = $objp->fk_product; $line->fk_product = (($objp->fk_product > 0)?$objp->fk_product:0);
$line->info_bits = $objp->info_bits; $line->info_bits = $objp->info_bits;
$line->fk_fournprice = $objp->fk_fournprice; $line->fk_fournprice = $objp->fk_fournprice;
@ -740,9 +740,17 @@ class Contrat extends CommonObject
$line->fk_user_cloture = $objp->fk_user_cloture; $line->fk_user_cloture = $objp->fk_user_cloture;
$line->fk_unit = $objp->fk_unit; $line->fk_unit = $objp->fk_unit;
$line->ref = $objp->product_ref; // deprecated $line->ref = $objp->product_ref; // deprecated
$line->label = $objp->product_label; // deprecated if (empty($objp->fk_product))
$line->libelle = $objp->product_label; // deprecated {
$line->label = ''; // deprecated
$line->libelle = $objp->description; // deprecated
}
else
{
$line->label = $objp->product_label; // deprecated
$line->libelle = $objp->product_label; // deprecated
}
$line->product_ref = $objp->product_ref; // Ref product $line->product_ref = $objp->product_ref; // Ref product
$line->product_desc = $objp->product_desc; // Description product $line->product_desc = $objp->product_desc; // Description product
$line->product_label = $objp->product_label; // Label product $line->product_label = $objp->product_label; // Label product
@ -759,7 +767,7 @@ class Contrat extends CommonObject
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite); $line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
$line->date_fin_reel = $this->db->jdate($objp->date_cloture); $line->date_fin_reel = $this->db->jdate($objp->date_cloture);
// Retreive all extrafield for propal // Retreive all extrafield for contract
// fetch optionals attributes and labels // fetch optionals attributes and labels
$line->fetch_optionals($line->id,$extralabelsline); $line->fetch_optionals($line->id,$extralabelsline);
@ -789,108 +797,6 @@ class Contrat extends CommonObject
return -3; return -3;
} }
// Selectionne les lignes contrat liees a aucun produit
$sql = "SELECT d.rowid, d.fk_contrat, d.statut, d.qty, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.rowid, d.remise_percent, d.subprice,";
$sql.= " d.total_ht,";
$sql.= " d.total_tva,";
$sql.= " d.total_localtax1,";
$sql.= " d.total_localtax2,";
$sql.= " d.total_ttc,";
$sql.= " d.info_bits, d.fk_product,";
$sql.= " d.date_ouverture_prevue, d.date_ouverture,";
$sql.= " d.date_fin_validite, d.date_cloture,";
$sql.= " d.fk_user_author,";
$sql.= " d.fk_user_ouverture,";
$sql.= " d.fk_user_cloture,";
$sql.= " d.fk_unit";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d";
$sql.= " WHERE d.fk_contrat = ".$this->id;
$sql.= " AND (d.fk_product IS NULL OR d.fk_product = 0)"; // fk_product = 0 gardee pour compatibilitee
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$line = new ContratLigne($this->db);
$line->id = $objp->rowid;
$line->fk_contrat = $objp->fk_contrat;
$line->libelle = $objp->description;
$line->desc = $objp->description;
$line->qty = $objp->qty;
$line->statut = $objp->statut;
$line->ref = '';
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
$line->localtax1_type = $objp->localtax1_type;
$line->localtax2_type = $objp->localtax2_type;
$line->subprice = $objp->subprice;
$line->remise_percent = $objp->remise_percent;
$line->price_ht = $objp->price_ht;
$line->price = (isset($objp->price)?$objp->price:null); // For backward compatibility
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_localtax1= $objp->total_localtax1;
$line->total_localtax2= $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc;
$line->fk_product = 0;
$line->info_bits = $objp->info_bits;
$line->fk_user_author = $objp->fk_user_author;
$line->fk_user_ouverture= $objp->fk_user_ouverture;
$line->fk_user_cloture = $objp->fk_user_cloture;
$line->description = $objp->description;
$line->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_ouverture = $this->db->jdate($objp->date_ouverture);
$line->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
$line->date_cloture = $this->db->jdate($objp->date_cloture);
// For backward compatibility
$line->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_debut_reel = $this->db->jdate($objp->date_ouverture);
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
$line->fk_unit = $objp->fk_unit;
if ($line->statut == 0) $this->nbofserviceswait++;
if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++;
if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
if ($line->statut == 5) $this->nbofservicesclosed++;
// Retreive all extrafield for propal
// fetch optionals attributes and labels
$line->fetch_optionals($line->id,$extralabelsline);
$this->lines[$pos] = $line;
$this->lines_id_index_mapper[$line->id] = $pos;
$total_ttc+=$objp->total_ttc;
$total_vat+=$objp->total_tva;
$total_ht+=$objp->total_ht;
$i++;
$pos++;
}
$this->db->free($result);
}
else
{
dol_syslog(get_class($this)."::Fetch Erreur lecture des lignes de contrat non liees aux produits");
$this->error=$this->db->error();
return -2;
}
$this->nbofservices=count($this->lines); $this->nbofservices=count($this->lines);
$this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products $this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products
$this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products $this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products

View File

@ -226,7 +226,7 @@ class modResource extends DolibarrModules
'type'=> 'left', // Toujours un menu gauche 'type'=> 'left', // Toujours un menu gauche
'titre'=> 'MenuResourceAdd', 'titre'=> 'MenuResourceAdd',
'mainmenu'=> 'tools', 'mainmenu'=> 'tools',
'leftmenu'=> '', // On n'indique rien ici car on ne souhaite pas intégrer de sous-menus à ce menu 'leftmenu'=> 'resource_add',
'url'=> '/resource/add.php', 'url'=> '/resource/add.php',
'langs'=> 'resource', 'langs'=> 'resource',
'position'=> 101, 'position'=> 101,
@ -241,7 +241,7 @@ class modResource extends DolibarrModules
'type'=> 'left', // Toujours un menu gauche 'type'=> 'left', // Toujours un menu gauche
'titre'=> 'List', 'titre'=> 'List',
'mainmenu'=> 'tools', 'mainmenu'=> 'tools',
'leftmenu'=> '', // On n'indique rien ici car on ne souhaite pas intégrer de sous-menus à ce menu 'leftmenu'=> 'resource_list',
'url'=> '/resource/list.php', 'url'=> '/resource/list.php',
'langs'=> 'resource', 'langs'=> 'resource',
'position'=> 102, 'position'=> 102,

View File

@ -37,21 +37,21 @@ INSERT INTO llx_accounting_journal (code, label, nature, active) VALUES ('ER', '
-- Description of chart of account FR PCG99-ABREGE -- Description of chart of account FR PCG99-ABREGE
INSERT INTO llx_accounting_system (pcg_version, label, active) VALUES ('PCG99-ABREGE', 'The simple accountancy french plan', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 1, 'PCG99-ABREGE', 'The simple accountancy french plan', 1);
-- Description of chart of account FR PCG99-BASE -- Description of chart of account FR PCG99-BASE
INSERT INTO llx_accounting_system (pcg_version, label, active) VALUES ('PCG99-BASE', 'The base accountancy french plan', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 1, 'PCG99-BASE', 'The base accountancy french plan', 1);
-- Description of chart of account BE PCMN-BASE -- Description of chart of account BE PCMN-BASE
INSERT INTO llx_accounting_system (pcg_version, label, active) VALUES ('PCMN-BASE', 'The base accountancy belgium plan', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 2, 'PCMN-BASE', 'The base accountancy belgium plan', 1);
-- Description of chart of account ES PCG08-PYME -- Description of chart of account ES PCG08-PYME
INSERT INTO llx_accounting_system (pcg_version, label, active) VALUES ('PCG08-PYME', 'The PYME accountancy spanish plan', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 4, 'PCG08-PYME', 'The PYME accountancy spanish plan', 1);
-- Description of chart of account DK DK-STD -- Description of chart of account DK DK-STD
INSERT INTO llx_accounting_system (pcg_version, label, active) VALUES ('DK-STD', 'Standardkontoplan fra SKAT', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (80, 'DK-STD', 'Standardkontoplan fra SKAT', 1);
-- Description of chart of account CL CL-PYME -- Description of chart of account CL CL-PYME
INSERT INTO llx_accounting_system (pcg_version, label, active) VALUES ('PC-MIPYME', 'The PYME accountancy Chile plan', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (67, 'PC-MIPYME', 'The PYME accountancy Chile plan', 1);

View File

@ -365,6 +365,8 @@ UPDATE llx_const set name = 'ONLINE_PAYMENT_CSS_URL' where name = 'PAYPAL_CS
UPDATE llx_const set name = 'ONLINE_PAYMENT_NEWFORMTEXT' where name = 'PAYPAL_NEWFORMTEXT'; UPDATE llx_const set name = 'ONLINE_PAYMENT_NEWFORMTEXT' where name = 'PAYPAL_NEWFORMTEXT';
UPDATE llx_const set name = 'ONLINE_PAYMENT_LOGO' where name = 'PAYPAL_LOGO'; UPDATE llx_const set name = 'ONLINE_PAYMENT_LOGO' where name = 'PAYPAL_LOGO';
ALTER TABLE llx_accounting_system ADD COLUMN fk_country integer;
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'PROD'; UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'PROD';
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'CHARGE'; UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'CHARGE';
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS'; UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS';
@ -434,5 +436,16 @@ create table llx_c_email_senderprofile
ALTER TABLE llx_c_email_senderprofile ADD UNIQUE INDEX uk_c_email_senderprofile(entity, label, email); ALTER TABLE llx_c_email_senderprofile ADD UNIQUE INDEX uk_c_email_senderprofile(entity, label, email);
-- Description of chart of account CL CL-PYME
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (67, 'PC-MIPYME', 'The PYME accountancy Chile plan', 1);
UPDATE llx_accounting_system SET fk_country = 1 WHERE pcg_version = 'PCG99-ABREGE';
UPDATE llx_accounting_system SET fk_country = 1 WHERE pcg_version = 'PCG99-BASE';
UPDATE llx_accounting_system SET fk_country = 2 WHERE pcg_version = 'PCMN-BASE';
UPDATE llx_accounting_system SET fk_country = 4 WHERE pcg_version = 'PCG08-PYME';
UPDATE llx_accounting_system SET fk_country = 80 WHERE pcg_version = 'DK-STD';
UPDATE llx_accounting_system SET fk_country = 67 WHERE pcg_version = 'PC-MIPYME';
-- May have error due to duplicate keys -- May have error due to duplicate keys
ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity); ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);

View File

@ -21,6 +21,7 @@
create table llx_accounting_system create table llx_accounting_system
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_country integer,
pcg_version varchar(32) NOT NULL, pcg_version varchar(32) NOT NULL,
label varchar(128) NOT NULL, label varchar(128) NOT NULL,
active smallint DEFAULT 0 active smallint DEFAULT 0

View File

@ -4361,31 +4361,10 @@ function migrate_reload_menu($db,$langs,$conf,$versionto)
// Define list of menu handlers to initialize // Define list of menu handlers to initialize
$listofmenuhandler=array(); $listofmenuhandler=array();
if ($conf->global->MAIN_MENU_STANDARD == 'auguria_menu' || $conf->global->MAIN_MENU_SMARTPHONE == 'auguria_menu'
$versiontoarray=explode('.',$versionto); || $conf->global->MAIN_MENUFRONT_STANDARD == 'auguria_menu' || $conf->global->MAIN_MENUFRONT_SMARTPHONE == 'auguria_menu')
// Migration required when target version is between
$afterversionarray=explode('.','2.8.9');
$beforeversionarray=explode('.','2.9.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{ {
$listofmenuhandler['auguria']=1; // We set here only dynamic menu handlers $listofmenuhandler['auguria']=1; // We set here only dynamic menu handlers
}
// Migration required when target version is between
$afterversionarray=explode('.','3.1.9');
$beforeversionarray=explode('.','3.2.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{
$listofmenuhandler['auguria']=1; // We set here only dynamic menu handlers
}
// Migration required when target version is between
$afterversionarray=explode('.','3.7.9');
$beforeversionarray=explode('.','4.0.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{
$listofmenuhandler['auguria']=1; // We set here only dynamic menu handlers
} }
foreach ($listofmenuhandler as $key => $val) foreach ($listofmenuhandler as $key => $val)

View File

@ -253,7 +253,7 @@ class modMyModule extends DolibarrModules
'type'=>'left', // This is a Left menu entry 'type'=>'left', // This is a Left menu entry
'titre'=>'List MyObject', 'titre'=>'List MyObject',
'mainmenu'=>'mymodule', 'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule', 'leftmenu'=>'mymodule_myobject_list',
'url'=>'/mymodule/myobject_list.php', 'url'=>'/mymodule/myobject_list.php',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r, 'position'=>1000+$r,
@ -265,7 +265,7 @@ class modMyModule extends DolibarrModules
'type'=>'left', // This is a Left menu entry 'type'=>'left', // This is a Left menu entry
'titre'=>'New MyObject', 'titre'=>'New MyObject',
'mainmenu'=>'mymodule', 'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule', 'leftmenu'=>'mymodule_myobject_new',
'url'=>'/mymodule/myobject_page.php?action=create', 'url'=>'/mymodule/myobject_page.php?action=create',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r, 'position'=>1000+$r,

View File

@ -81,6 +81,8 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->global->MAIN_MODULE_SUPPLIERPROPOSAL)) { print "\n".__METHOD__." module Supplier proposal must be enabled.\n"; die(); }
print __METHOD__."\n"; print __METHOD__."\n";
} }