diff --git a/ChangeLog b/ChangeLog index ddd3c6f33b2..ec144c6534b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ For users: - New: Can create proposal from an intervention. - New: Can filter events on a group of users. - New: Add thirdparty to filter on events. +- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action For translators: - Update language files. diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 4a9c359f5c1..a069a0718c9 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; if (!$user->admin) accessforbidden(); @@ -70,11 +71,20 @@ if (preg_match('/del_(.*)/',$action,$reg)) } } +if ($action == 'set') +{ + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); +} + /** * View */ +$formactions=new FormActions($db); + llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; @@ -86,43 +96,71 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action'); -print_titre($langs->trans("OtherOptions")); +//print_titre($langs->trans("OtherOptions")); $var=true; +print '
'; +print ''; + print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; print ''."\n"; // Manual or automatic $var=!$var; print ''."\n"; print ''."\n"; -print ''."\n"; - -print ''."\n"; +print ''."\n"; +// AGENDA_DEFAULT_FILTER_TYPE +$var=!$var; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +// AGENDA_DEFAULT_FILTER_STATUS +$var=!$var; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +// AGENDA_DEFAULT_VIEW +$var=!$var; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").' '.$langs->trans("Value").'
'.$langs->trans("AGENDA_USE_EVENT_TYPE").' '."\n"; -if ($conf->use_javascript_ajax) +print ' '."\n"; +//print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list +if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - if($conf->global->AGENDA_USE_EVENT_TYPE == 0) - { - print ''.img_picto($langs->trans("Disabled"),'off').''; - } - else if($conf->global->BUSINESS_VISIBLE_TO_ALL_BY_DEFAULT == 1) - { - print ''.img_picto($langs->trans("Enabled"),'on').''; - } + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; +print $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 1); +print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; +$formactions->form_select_status_action('agenda',$conf->global->AGENDA_DEFAULT_FILTER_STATUS,1,'AGENDA_DEFAULT_FILTER_STATUS',1,2); +print '
'.$langs->trans("AGENDA_DEFAULT_VIEW").' '."\n"; +$tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_list'=>$langs->trans("ViewList"), 'show_peruser'=>$langs->trans("ViewPerUser")); +print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); +print '
'; +print '
'; + +print '
'; + dol_fiche_end(); print "
"; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 2cf381b31cb..fd3629b1cba 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -158,6 +158,31 @@ if ( ($action == 'update' && empty($_POST["cancel"])) // Local taxes dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity); + + if($_POST["optionlocaltax1"]=="localtax1on") + { + if(!isset($_REQUEST['lt1'])) + { + dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0,'chaine',0,'',$conf->entity); + } + else + { + dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1'),'chaine',0,'',$conf->entity); + } + dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", $_POST["clt1"],'chaine',0,'',$conf->entity); + } + if($_POST["optionlocaltax2"]=="localtax2on") + { + if(!isset($_REQUEST['lt2'])) + { + dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0,'chaine',0,'',$conf->entity); + } + else + { + dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2'),'chaine',0,'',$conf->entity); + } + dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", $_POST["clt2"],'chaine',0,'',$conf->entity); + } if ($action != 'updateedit' && ! $error) { @@ -570,6 +595,17 @@ if ($action == 'edit' || $action == 'updateedit') print "".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code).""; $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code); print ($example!="LocalTax1IsUsedExample"?"".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."\n":""); + if(! isOnlyOneLocalTax(1)) + { + print ''.$langs->transcountry("LocalTax1Management",$mysoc->country_code).': '; + $formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); + } + print ''; + + print ''.$langs->trans("CalcLocaltax").': '; + $opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code)); + print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); + print ''; print ""; print "\n"; @@ -603,6 +639,16 @@ if ($action == 'edit' || $action == 'updateedit') print "".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code).""; $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code); print ($example!="LocalTax2IsUsedExample"?"".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."\n":""); + print ''.$langs->transcountry("LocalTax2Management",$mysoc->country_code).': '; + if(! isOnlyOneLocalTax(2)) + { + $formcompany->select_localtax(2,$conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2"); + print ''; + } + print ''.$langs->trans("CalcLocaltax").': '; + $opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code)); + print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2); + print ''; print ""; print "\n"; @@ -954,6 +1000,19 @@ else print "".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code).""; $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code); print ($example!="LocalTax1IsUsedExample"?"".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."\n":""); + if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0){ + print ''.$langs->transcountry("LocalTax1Management",$mysoc->country_code).': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .''; + } + print ''.$langs->trans("CalcLocaltax").': '; + if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0){ + print $langs->transcountry("CalcLocaltax1",$mysoc->country_code); + }else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==1){ + print $langs->transcountry("CalcLocaltax2",$mysoc->country_code); + }else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ + print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); + } + + print ''; print ""; print "\n"; @@ -987,6 +1046,19 @@ else print "".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code).""; $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code); print ($example!="LocalTax2IsUsedExample"?"".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."\n":""); + if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0){ + print ''.$langs->transcountry("LocalTax2Management",$mysoc->country_code).': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .''; + } + print ''.$langs->trans("CalcLocaltax").': '; + if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0){ + print $langs->transcountry("CalcLocaltax1",$mysoc->country_code); + }else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1){ + print $langs->transcountry("CalcLocaltax2",$mysoc->country_code); + }else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2){ + print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); + } + + print ''; print ""; print "\n"; diff --git a/htdocs/boutique/index.php b/htdocs/boutique/index.php index 040e81b726a..01b3928a96b 100644 --- a/htdocs/boutique/index.php +++ b/htdocs/boutique/index.php @@ -128,7 +128,7 @@ else } /* - * Last 5 commands in wait + * Last 5 orders on hold */ $sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method"; $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id "; @@ -200,7 +200,7 @@ else print ''; /* - * Last customers who commanded + * Last customers who ordered */ $sql = "SELECT o.orders_id, o.customers_name, o.delivery_country, o.date_purchased, t.value, s.orders_status_name as statut"; $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id "; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index e7f277a116b..a50ee50dd14 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -81,7 +81,11 @@ $pid=GETPOST("projectid","int",3); $status=GETPOST("status"); $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); -$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); +$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':''); + +if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; @@ -93,11 +97,6 @@ if (GETPOST('viewday') || $action == 'show_day') { $action='show_day'; $day=($day?$day:date("d")); } // View by day -if (empty($action)) -{ - if (empty($conf->global->AGENDA_DEFAULT_VIEW)) $action='show_month'; - else $action=$conf->global->AGENDA_DEFAULT_VIEW; -} $langs->load("agenda"); $langs->load("other"); @@ -110,7 +109,8 @@ $hookmanager->initHooks(array('agenda')); /* * Actions */ -if (GETPOST("viewlist")) + +if (GETPOST("viewlist") || $action == 'show_list') { $param=''; foreach($_POST as $key => $val) @@ -123,6 +123,19 @@ if (GETPOST("viewlist")) exit; } +if (GETPOST("viewperuser") || $action == 'show_peruser') +{ + $param=''; + foreach($_POST as $key => $val) + { + if ($key=='token') continue; + $param.='&'.$key.'='.urlencode($val); + } + //print $param; + header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param); + exit; +} + if ($action=='delete_action') { $event = new ActionComm($db); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 0c220a89194..15e75e85661 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -44,11 +44,9 @@ $status=GETPOST("status",'alpha'); $type=GETPOST('type'); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); -if (empty($action)) -{ - if (empty($conf->global->AGENDA_DEFAULT_VIEW)) $action='show_list'; - else $action=$conf->global->AGENDA_DEFAULT_VIEW; -} +if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); +if ($status == '') $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); +if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_list':$conf->global->AGENDA_DEFAULT_VIEW); $filter=GETPOST("filter",'',3); $filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",3); @@ -214,6 +212,7 @@ if ($resql) if ($action == 'show_week') $tabactive='cardweek'; if ($action == 'show_day') $tabactive='cardday'; if ($action == 'show_list') $tabactive='cardlist'; + if ($action == 'show_peruser') $tabactive='cardperuser'; $head = calendars_prepare_head($param); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8bcabf7f17b..8a940c6db22 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -74,6 +74,7 @@ class Account extends CommonObject var $type_lib=array(); var $account_number; + var $accountancy_journal; var $currency_code; var $min_allowed; @@ -382,6 +383,7 @@ class Account extends CommonObject $sql.= ", label"; $sql.= ", entity"; $sql.= ", account_number"; + $sql.= ", accountancy_journal"; $sql.= ", currency_code"; $sql.= ", rappro"; $sql.= ", min_allowed"; @@ -395,6 +397,7 @@ class Account extends CommonObject $sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->account_number)."'"; + $sql.= ", '".$this->db->escape($this->accountancy_journal)."'"; $sql.= ", '".$this->currency_code."'"; $sql.= ", ".$this->rappro; $sql.= ", ".price2num($this->min_allowed); @@ -500,6 +503,7 @@ class Account extends CommonObject $sql.= ",rappro = ".$this->rappro; $sql.= ",url = ".($this->url?"'".$this->url."'":"null"); $sql.= ",account_number = '".$this->account_number."'"; + $sql.= ",accountancy_journal = '".$this->accountancy_journal."'"; $sql.= ",currency_code = '".$this->currency_code."'"; @@ -606,7 +610,7 @@ class Account extends CommonObject $sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,"; $sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,"; $sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,"; - $sql.= " ba.account_number, ba.currency_code,"; + $sql.= " ba.account_number, ba.accountancy_journal, ba.currency_code,"; $sql.= " ba.min_allowed, ba.min_desired, ba.comment,"; $sql.= ' p.code as country_code, p.libelle as country,'; $sql.= ' d.code_departement as state_code, d.nom as state'; @@ -656,6 +660,7 @@ class Account extends CommonObject $this->country = $obj->country; $this->account_number = $obj->account_number; + $this->accountancy_journal = $obj->accountancy_journal; $this->currency_code = $obj->currency_code; $this->account_currency_code = $obj->currency_code; diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index bdb30e46528..57c5e2b075a 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -1,8 +1,9 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2012 Laurent Destailleur - * Copytight (C) 2005-2009 Regis Houssin +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2012 Laurent Destailleur + * Copytight (C) 2005-2009 Regis Houssin + * Copytight (C) 2014 Alexandre Spangaro * * 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 @@ -34,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); $langs->load("companies"); +$langs->load("compta"); $action=GETPOST("action"); @@ -65,6 +67,7 @@ if ($_POST["action"] == 'add') $account->url = $_POST["url"]; $account->account_number = trim($_POST["account_number"]); + $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->solde = $_POST["solde"]; $account->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); @@ -139,6 +142,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->owner_address = trim($_POST["owner_address"]); $account->account_number = trim($_POST["account_number"]); + $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->currency_code = trim($_POST["account_currency_code"]); @@ -292,18 +296,6 @@ if ($action == 'create') } print ''; - // Accountancy code - if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) - { - print ''.$langs->trans("AccountancyCode").''; - print ''; - } - else - { - print ''.$langs->trans("AccountancyCode").''; - print ''; - } - // Web print ''.$langs->trans("Web").''; print ''; @@ -334,6 +326,27 @@ if ($action == 'create') print ''.$langs->trans("BalanceMinimalDesired").''; print 'account_min_desired).'">'; + print ''; + + print '
'; + + print ''; + // Accountancy code + if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) + { + print ''; + print ''; + } + else + { + print ''; + print ''; + } + + // Accountancy journal + print ''; + print ''; + print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyJournal").'
'; print '

'; @@ -431,10 +444,6 @@ else else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); print ''; - // Accountancy code - print ''.$langs->trans("AccountancyCode").''; - print ''.$account->account_number.''; - print ''.$langs->trans("BalanceMinimalAllowed").''; print ''.$account->min_allowed.''; @@ -451,7 +460,19 @@ else print ''.$account->comment.''; print ''; - + + print '
'; + print ''; + // Accountancy code + print ''; + print ''; + + // Accountancy journal + print ''; + print ''; + + print '
'.$langs->trans("AccountancyCode").''.$account->account_number.'
'.$langs->trans("AccountancyJournal").''.$account->accountancy_journal.'
'; + print ''; @@ -574,19 +595,7 @@ else else print 'rappro?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation"); print ''; - // Accountancy code - if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) - { - print ''.$langs->trans("AccountancyCode").''; - print 'account_number).'">'; - } - else - { - print ''.$langs->trans("AccountancyCode").''; - print 'account_number).'">'; - } - - // Balance + // Balance print ''.$langs->trans("BalanceMinimalAllowed").''; print 'min_allowed).'">'; @@ -606,6 +615,22 @@ else $doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print ''; + + // Accountancy code + if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) + { + print ''.$langs->trans("AccountancyCode").''; + print 'account_number).'">'; + } + else + { + print ''.$langs->trans("AccountancyCode").''; + print 'account_number).'">'; + } + + // Accountancy journal + print ''.$langs->trans("AccountancyJournalCode").''; + print 'accountancy_journal).'">'; print ''; print '   '; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 2b3fc89d33b..7ae2e6aeb96 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -217,12 +217,15 @@ if ($action == 'create') if ($num) { print ''; - print ''.$langs->trans("Description").''; - print ''.$langs->trans("VAT").''; - print ''.$langs->trans("Qty").''; - print ''.$langs->trans("ReductionShort").''; - print ''.$langs->trans("PriceU").''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print ''.$langs->trans("CurrentProductPrice").''; + print ''.$langs->trans("Description").''; + print ''.$langs->trans("VAT").''; + print ''.$langs->trans("Qty").''; + print ''.$langs->trans("ReductionShort").''; + print ''.$langs->trans("TotalHT").''; + print ''.$langs->trans("TotalVAT").''; + print ''.$langs->trans("TotalTTC").''; + print ''.$langs->trans("PriceUHT").''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print ''.$langs->trans("CurrentProductPrice").''; print "\n"; } $var=True; @@ -288,9 +291,13 @@ if ($action == 'create') print "\n"; } - + // Vat rate print ''.vatrate($objp->tva_tx).'%'; + + // Qty print ''.$objp->qty.''; + + // Percent if ($objp->remise_percent > 0) { print ''.$objp->remise_percent." %\n"; @@ -300,9 +307,19 @@ if ($action == 'create') print ' '; } + // Total HT + print ''.price($objp->total_ht)."\n"; + + // Total VAT + print ''.price($objp->total_vat)."\n"; + + // Total TTC + print ''.price($objp->total_ttc)."\n"; + + // Total Unit price print ''.price($objp->subprice)."\n"; - // Price of product + // Current price of product if (empty($conf->global->PRODUIT_MULTIPRICES)) { if ($objp->fk_product > 0) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 0eea10bf510..1d077f933da 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -248,10 +248,8 @@ class Paiement extends CommonObject if (! $error) { // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_CUSTOMER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + $result=$this->call_trigger('PAYMENT_CUSTOMER_CREATE', $user); + if ($result < 0) { $error++; } // Fin appel triggers } } @@ -363,11 +361,13 @@ class Paiement extends CommonObject if (! $notrigger) { // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + $result=$this->call_trigger('PAYMENT_DELETE', $user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // Fin appel triggers } $this->db->commit(); @@ -516,11 +516,9 @@ class Paiement extends CommonObject if (! $error && ! $notrigger) { // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_ADD_TO_BANK',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + $result=$this->call_trigger('PAYMENT_ADD_TO_BANK', $user); + if ($result < 0) { $error++; } + // Fin appel triggers } } else diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 81a7ea1f048..ed32fcc9f0d 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -120,7 +120,7 @@ class FormActions { //var_dump($selected); if ($selected == 'done') $selected='100'; - print ''; if ($showempty) print ''; foreach($listofstatus as $key => $val) { @@ -230,9 +230,10 @@ class FormActions * @param string $htmlname Nom champ formulaire * @param string $excludetype Type to exclude * @param string $onlyautoornot Group list by auto events or not: We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) + * @param int $hideinfohelp 1=Do not show info help * @return void */ - function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0) + function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0) { global $langs,$user,$form; @@ -251,7 +252,7 @@ class FormActions if ($selected == 'auto') $selected='AC_OTH_AUTO'; print $form->selectarray($htmlname, $arraylist, $selected); - if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + if ($user->admin && empty($onlyautoornot) && empty($hideinfohelp)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a22f0b38c10..1634998d023 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2008-2012 Regis Houssin + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -775,6 +776,43 @@ class FormCompany return $out; } + + /** + * Return a select with localtax values for thirds + * + * @param int $local LocalTax + * @param int $selected Preselected value + * @param varchar $htmlname HTML select name + */ + function select_localtax($local, $selected, $htmlname) + { + $tax=get_localtax_by_third($local); + + $num = $this->db->num_rows($tax); + $i = 0; + if ($num) + { + $valors=explode(":", $tax); + + if(count($valors)>1) + { + //montar select + print ''; + + } + } + } } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 3367d227dd8..8e09c9323b5 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -359,6 +359,11 @@ function agenda_prepare_head() $h = 0; $head = array(); + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'other'; + $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php"; $head[$h][1] = $langs->trans("AutoActions"); $head[$h][2] = 'autoactions'; @@ -374,11 +379,6 @@ function agenda_prepare_head() $head[$h][2] = 'extsites'; $h++; - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php"; - $head[$h][1] = $langs->trans("Other"); - $head[$h][2] = 'other'; - $h++; - complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin'); $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index f36dc59c43a..47363ac8d06 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -399,44 +399,52 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); - $out= "\n".' - '."\n"; - // Del constant - $("#del_" + code).click(function() { - if (input.alert && input.alert.del) { - if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; - if (input.alert.del.noButton) noButton = input.alert.del.noButton; - confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton); - } else { - delConstant(url, code, input, entity); - } - }); - }); - '."\n"; - - $out.= ''; - $out.= ''.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).''; - $out.= ''.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).''; - $out.="\n"; + $out.= ''; + $out.= ''.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).''; + $out.= ''.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).''; + $out.="\n"; + } return $out; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e81c8b3b2d9..365dd408a2e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7,7 +7,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro * @@ -2886,26 +2886,31 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") if (empty($thirdparty_seller) || ! is_object($thirdparty_seller)) $thirdparty_seller=$mysoc; dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')."/country_code=".(is_object($thirdparty_buyer)?$thirdparty_buyer->country_code:'')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj); - + + if($thirdparty_buyer->country_code!=$thirdparty_seller->country_code) + { + return 0; + } // Some test to guess with no need to make database access if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe { if ($local == 1) { + if(! $mysoc->localtax1_assuj) return 0; if ($thirdparty_seller->id==$mysoc->id) { if (! $thirdparty_buyer->localtax1_assuj) return 0; } else { - if (! $thirdparty_seller->localtax1_assuj) return 0; + if (! $thirdparty_seller->localtax1_assuj) return 0; } } if ($local == 2) { - - if ($thirdparty_seller->id==$mysoc->id) + if(! $mysoc->localtax2_assuj) return 0; + if ($thirdparty_seller->id==$mysoc->id ) { if (! $thirdparty_buyer->localtax2_assuj) return 0; } @@ -2931,6 +2936,43 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") }*/ // Search local taxes + if ($local==1) + { + if($thirdparty_seller!=$mysoc ) + { + if(!isOnlyOneLocalTax($local)) + { + return $thirdparty_seller->localtax1_value; + } + } + else + { + if(!isOnlyOneLocalTax($local)) + { + return $conf->global->MAIN_INFO_VALUE_LOCALTAX1; + } + } + } + if ($local==2) + { + if($thirdparty_seller!=$mysoc) + { + if(!isOnlyOneLocalTax($local)) + { + return $thirdparty_seller->localtax2_value; + } + } + else + { + if(!isOnlyOneLocalTax($local)) + { + return $conf->global->MAIN_INFO_VALUE_LOCALTAX2; + } + } + } + + + $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; @@ -2948,6 +2990,57 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") return 0; } + +/** + * Return true if LocalTax is unique + * + * @param int $local Local taxt to test + * @return boolean True if LocalTax have multiple values, False if not + */ +function isOnlyOneLocalTax($local) +{ + $tax=get_localtax_by_third($local); + + $valors=explode(":", $tax); + + if(count($valors)>1) + { + return false; + } + else + { + return true; + } +} + +/** + * Get values of localtaxes + * + * @param int $local LocalTax to get + * @return number Values of localtax + */ +function get_localtax_by_third($local) +{ + global $db, $mysoc; + $sql="SELECT t.localtax1, t.localtax2 "; + $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_pays as p ON p.rowid=t.fk_pays"; + $sql.=" WHERE p.code = '".$mysoc->country_code."' AND t.taux=(SELECT max(tt.taux)"; + $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_pays as p ON p.rowid=tt.fk_pays"; + $sql.= " WHERE p.code = '".$mysoc->country_code."')"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($local==1) return $obj->localtax1; + elseif ($local==2) return $obj->localtax2; + } + + return 0; + +} + + /** * Get type and rate of localtaxes for a particular vat rate/country fo thirdparty * TODO @@ -2960,7 +3053,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") * @param int $thirdparty Company object * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) */ -function getLocalTaxesFromRate($vatrate, $local, $thirdparty) +function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) { global $db; @@ -2969,16 +3062,84 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty) // Search local taxes $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$buyer->country_code."'"; $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; $resql=$db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); - if ($local == 1) return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); - elseif ($local == 2) return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); - else return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + if ($local == 1) + { + if (! isOnlyOneLocalTax(1)) + { + return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + elseif ($local == 2) + { + if (! isOnlyOneLocalTax(2)) + { + return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + else + { + if(! isOnlyOneLocalTax(1)) + { + if(! isOnlyOneLocalTax(2)) + { + return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + else + { + if(! isOnlyOneLocalTax(2)) + { + return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type,get_localtax($vatrate, 2, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + + if(! isOnlyOneLocalTax(2)) + { + if(! isOnlyOneLocalTax(1)) + { + return array($obj->localtax2_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax2_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + else + { + if(! isOnlyOneLocalTax(1)) + { + return array($obj->localtax2_type, $obj->localtax2, $obj->localtax1_type,get_localtax($vatrate, 1, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + else + { + return array($obj->localtax2_type, $obj->localtax2, $obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); + } + } + + } } return 0; diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index b13177f9127..095e325cb81 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -97,10 +97,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Define position of columns $this->posxdesc=$this->marge_gauche+1; - $this->posxcomm=112; + $this->posxcomm=900; //$this->posxtva=112; //$this->posxup=126; - $this->posxqty=174; + $this->posxqty=140; + $this->posxremainingqty=165; //$this->posxdiscount=162; //$this->postotalht=174; if ($this->page_largeur < 210) // To work with US executive format @@ -207,6 +208,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $commande->fetch($expedition->origin_id); } $object->commande=$commande; // We set order of shipment onto delivery. + $object->commande->loadExpeditions(); $pdf->Open(); @@ -355,7 +357,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Quantity //$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); + $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); + + // Remaining to ship + $pdf->SetXY($this->posxremainingqty, $curY); + $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line]; + $pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R'); /* // Remise sur ligne $pdf->SetXY($this->posxdiscount, $curY); @@ -606,7 +613,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L'); } - + // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); if (empty($hidetop)) { @@ -615,12 +622,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder } // Qty - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + $pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); + $pdf->SetXY($this->posxqty, $tab_top+1); + $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','C'); } + // Remain to ship + $pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxremainingqty, $tab_top+1); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShip"),'','C'); + } } /** diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 93c7f63b4ad..c0c647698e8 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -590,6 +590,8 @@ class Expedition extends CommonObject $cpt = $this->db->num_rows($resql); for ($i = 0; $i < $cpt; $i++) { + if($obj->qty <= 0) continue; + dol_syslog(get_class($this)."::valid movement index ".$i); $obj = $this->db->fetch_object($resql); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 89d0995fb45..ff6b23c10be 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -163,7 +163,7 @@ if ($action == 'add') { $qty = "qtyl".$i; if (! isset($batch_line[$i])) { - if (GETPOST($qty,'int') > 0) + if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { $ent = "entl".$i; $idl = "idl".$i; diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index c8091e3889e..1d4572591d1 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -216,10 +216,10 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (20 INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2023, 202, '0', '0', 'VAT Rate 0', 1); -- SPAIN (id country=4) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-21','1','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-21','1','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-21','1','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-21','1','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 41, 4,'21','0','5.2','3','-21:-9:-2','1','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 42, 4,'10','0','1.4','3','-21:-9:-2','1','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 43, 4, '4','0','0.5','3','-21:-9:-2','1','VAT super-reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values ( 44, 4, '0','0', '0','3','-21:-9:-2','1','VAT Rate 0',1); -- SWEDEN (id country=20) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (201,20, '25','0','VAT standard rate',1); diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index ae439127c06..f5757a39754 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -19,3 +19,42 @@ ALTER TABLE llx_c_paiement ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER active; + + +ALTER TABLE llx_accountingaccount add column entity integer DEFAULT 1 NOT NULL AFTER rowid; +ALTER TABLE llx_accountingaccount add column datec datetime NOT NULL AFTER entity; +ALTER TABLE llx_accountingaccount add column tms timestamp DEFAULT NULL AFTER datec; +ALTER TABLE llx_accountingaccount add column fk_user_author integer DEFAULT NULL AFTER label; +ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author; + + +-- Drop old table +DROP TABLE llx_compta; +DROP TABLE llx_compta_account; +DROP TABLE llx_compta_compte_generaux; + +-- Align size for accounting account +ALTER TABLE llx_accountingaccount MODIFY COLUMN account_number varchar(32); +ALTER TABLE llx_accountingaccount MODIFY COLUMN account_parent varchar(32); +ALTER TABLE llx_accountingdebcred MODIFY COLUMN account_number varchar(32); +ALTER TABLE llx_bank_account MODIFY COLUMN account_number varchar(32); +ALTER TABLE llx_c_chargesociales MODIFY COLUMN accountancy_code varchar(32); +ALTER TABLE llx_c_revenuestamp MODIFY COLUMN accountancy_code_sell varchar(32); +ALTER TABLE llx_c_revenuestamp MODIFY COLUMN accountancy_code_buy varchar(32); +ALTER TABLE llx_c_tva MODIFY COLUMN accountancy_code_sell varchar(32); +ALTER TABLE llx_c_tva MODIFY COLUMN accountancy_code_buy varchar(32); +ALTER TABLE llx_c_product MODIFY COLUMN accountancy_code_sell varchar(32); +ALTER TABLE llx_c_product MODIFY COLUMN accountancy_code_buy varchar(32); +ALTER TABLE llx_user MODIFY COLUMN accountancy_code varchar(32); + + +ALTER TABLE llx_bank_account ADD COLUMN accountancy_journal varchar(3) DEFAULT NULL AFTER account_number; + +ALTER TABLE llx_projet_task_time ADD COLUMN task_datehour datetime after task_date; + +-- Localtaxes by thirds +ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10); +ALTER TABLE llx_c_tva MODIFY COLUMN localtax2 varchar(10); +ALTER TABLE llx_localtax ADD COLUMN localtaxtype tinyint(4) after entity; +ALTER TABLE llx_societe ADD COLUMN localtax1_value double(6,3) after localtax1_assuj; +ALTER TABLE llx_societe ADD COLUMN localtax2_value double(6,3) after localtax2_assuj; diff --git a/htdocs/install/mysql/tables/llx_accountingaccount.sql b/htdocs/install/mysql/tables/llx_accountingaccount.sql index a3143a263f9..a3fe0747238 100644 --- a/htdocs/install/mysql/tables/llx_accountingaccount.sql +++ b/htdocs/install/mysql/tables/llx_accountingaccount.sql @@ -20,11 +20,16 @@ create table llx_accountingaccount ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, + datec datetime, + tms timestamp DEFAULT NULL, fk_pcg_version varchar(12) NOT NULL, pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, - account_number varchar(20) NOT NULL, - account_parent varchar(20), + account_number varchar(32) NOT NULL, + account_parent varchar(32), label varchar(255) NOT NULL, + fk_user_author integer DEFAULT NULL, + fk_user_modif integer DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_accountingdebcred.sql b/htdocs/install/mysql/tables/llx_accountingdebcred.sql index f1191803d0e..f7ea28b127a 100644 --- a/htdocs/install/mysql/tables/llx_accountingdebcred.sql +++ b/htdocs/install/mysql/tables/llx_accountingdebcred.sql @@ -20,7 +20,7 @@ create table llx_accountingdebcred ( fk_transaction integer NOT NULL, - account_number varchar(20) NOT NULL, + account_number varchar(32) NOT NULL, amount real NOT NULL, direction varchar(1) NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql b/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql index 6d6999e7232..caaa0969944 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_resources.key.sql @@ -21,5 +21,5 @@ ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX idx_actioncomm_resources_idx1 (fk_actioncomm, element_type, fk_element); ALTER TABLE llx_actioncomm_resources ADD INDEX idx_actioncomm_resources_fk_element (fk_element); --- Pas de contraite sur fk_source et fk_target car pointe sur differentes tables +-- Pas de contrainte sur fk_source et fk_target car pointe sur differentes tables diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index 198b0ca87ab..63a0e23762d 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -1,7 +1,8 @@ -- ============================================================================= --- Copyright (C) 2000-2004 Rodolphe Quiedeville --- Copyright (C) 2004-2007 Laurent Destailleur --- Copyright (C) 2005-2012 Regis Houssin +-- Copyright (C) 2000-2004 Rodolphe Quiedeville +-- Copyright (C) 2004-2014 Laurent Destailleur +-- Copyright (C) 2005-2012 Regis Houssin +-- Copyright (C) 2014 Alexandre Spangaro -- -- 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 @@ -18,39 +19,39 @@ -- -- ============================================================================= --- courant : type de compte: 0 epargne, 1 courant, 2 caisse --- clos : le compte est-il clos ou encore ouvert +-- courant : type of account: 0 epargne, 1 curent/card/cheque, 2 cash +-- clos : is account opened or closed create table llx_bank_account ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - tms timestamp, - ref varchar(12) NOT NULL, - label varchar(30) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - bank varchar(60), - code_banque varchar(8), - code_guichet varchar(6), - number varchar(255), - cle_rib varchar(5), - bic varchar(11), - iban_prefix varchar(34), -- 34 according to ISO 13616 - country_iban varchar(2), -- deprecated - cle_iban varchar(2), - domiciliation varchar(255), - state_id integer DEFAULT NULL, - fk_pays integer NOT NULL, - proprio varchar(60), - owner_address varchar(255), - courant smallint DEFAULT 0 NOT NULL, - clos smallint DEFAULT 0 NOT NULL, - rappro smallint DEFAULT 1, - url varchar(128), - account_number varchar(24), -- bank accountancy number - currency_code varchar(3) NOT NULL, - min_allowed integer DEFAULT 0, - min_desired integer DEFAULT 0, - comment text - + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime, + tms timestamp, + ref varchar(12) NOT NULL, + label varchar(30) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + bank varchar(60), + code_banque varchar(8), + code_guichet varchar(6), + number varchar(255), + cle_rib varchar(5), + bic varchar(11), + iban_prefix varchar(34), -- 34 according to ISO 13616 + country_iban varchar(2), -- deprecated + cle_iban varchar(2), + domiciliation varchar(255), + state_id integer DEFAULT NULL, + fk_pays integer NOT NULL, + proprio varchar(60), + owner_address varchar(255), + courant smallint DEFAULT 0 NOT NULL, + clos smallint DEFAULT 0 NOT NULL, + rappro smallint DEFAULT 1, + url varchar(128), + account_number varchar(32), -- bank accountancy number + accountancy_journal varchar(3) DEFAULT NULL, -- bank accountancy journal + currency_code varchar(3) NOT NULL, + min_allowed integer DEFAULT 0, + min_desired integer DEFAULT 0, + comment text )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_chargesociales.sql b/htdocs/install/mysql/tables/llx_c_chargesociales.sql index b9c448e1d95..5b5cf1edf24 100644 --- a/htdocs/install/mysql/tables/llx_c_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_c_chargesociales.sql @@ -24,7 +24,7 @@ create table llx_c_chargesociales deductible smallint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, code varchar(12) NOT NULL, - accountancy_code varchar(24) DEFAULT NULL, + accountancy_code varchar(32) DEFAULT NULL, fk_pays integer DEFAULT 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_revenuestamp.sql b/htdocs/install/mysql/tables/llx_c_revenuestamp.sql index 7a47c05dca3..0eb5a46216d 100644 --- a/htdocs/install/mysql/tables/llx_c_revenuestamp.sql +++ b/htdocs/install/mysql/tables/llx_c_revenuestamp.sql @@ -23,7 +23,7 @@ create table llx_c_revenuestamp taux double NOT NULL, note varchar(128), active tinyint DEFAULT 1 NOT NULL, - accountancy_code_sell varchar(15) DEFAULT NULL, - accountancy_code_buy varchar(15) DEFAULT NULL + accountancy_code_sell varchar(32) DEFAULT NULL, + accountancy_code_buy varchar(32) DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_tva.sql b/htdocs/install/mysql/tables/llx_c_tva.sql index 46aa3632faa..2a0b275ce96 100644 --- a/htdocs/install/mysql/tables/llx_c_tva.sql +++ b/htdocs/install/mysql/tables/llx_c_tva.sql @@ -1,6 +1,6 @@ -- ======================================================================== -- Copyright (C) 2005 Laurent Destailleur --- Copyright (C) 2010 Juanjo Menent +-- Copyright (C) 2010-2014 Juanjo Menent -- Copyright (C) 2011-2012 Alexandre Spangaro -- -- This program is free software; you can redistribute it and/or modify @@ -23,14 +23,14 @@ create table llx_c_tva rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, fk_pays integer NOT NULL, taux double NOT NULL, - localtax1 double NOT NULL DEFAULT 0, + localtax1 varchar(10) NOT NULL DEFAULT '0', localtax1_type varchar(10) NOT NULL DEFAULT '0', - localtax2 double NOT NULL DEFAULT 0, - localtax2_type varchar(10) NOT NULL DEFAULT '0', + localtax2 varchar(10) NOT NULL DEFAULT '0', + localtax2_type varchar(10) NOT NULL DEFAULT '0', recuperableonly integer NOT NULL DEFAULT 0, note varchar(128), active tinyint DEFAULT 1 NOT NULL, - accountancy_code_sell varchar(15) DEFAULT NULL, - accountancy_code_buy varchar(15) DEFAULT NULL + accountancy_code_sell varchar(32) DEFAULT NULL, + accountancy_code_buy varchar(32) DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_compta.sql b/htdocs/install/mysql/tables/llx_compta.sql deleted file mode 100644 index b7b06636e51..00000000000 --- a/htdocs/install/mysql/tables/llx_compta.sql +++ /dev/null @@ -1,32 +0,0 @@ --- =================================================================== --- Copyright (C) 2000-2002 Rodolphe Quiedeville --- --- 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 3 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 . --- --- =================================================================== - -create table llx_compta -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - datev date, -- date de valeur - amount real DEFAULT 0 NOT NULL , - label varchar(255), - fk_compta_account integer, - fk_user_author integer, - fk_user_valid integer, - valid tinyint DEFAULT 0, - note text - -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_compta_account.sql b/htdocs/install/mysql/tables/llx_compta_account.sql deleted file mode 100644 index b70ad9ba160..00000000000 --- a/htdocs/install/mysql/tables/llx_compta_account.sql +++ /dev/null @@ -1,28 +0,0 @@ --- =================================================================== --- Copyright (C) 2000-2002 Rodolphe Quiedeville --- --- 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 3 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 . --- --- =================================================================== - -create table llx_compta_account -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - number varchar(12), - label varchar(255), - fk_user_author integer, - note text - -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_compta_compte_generaux.sql b/htdocs/install/mysql/tables/llx_compta_compte_generaux.sql deleted file mode 100644 index d830e8dbd66..00000000000 --- a/htdocs/install/mysql/tables/llx_compta_compte_generaux.sql +++ /dev/null @@ -1,29 +0,0 @@ --- =================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- --- 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 3 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 . --- --- =================================================================== - -create table llx_compta_compte_generaux -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date_creation datetime, - numero varchar(50), - intitule varchar(255), - fk_user_author integer, - note text, - - UNIQUE(numero) -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_localtax.sql b/htdocs/install/mysql/tables/llx_localtax.sql index c7ca3ca44f6..bc646ffc245 100644 --- a/htdocs/install/mysql/tables/llx_localtax.sql +++ b/htdocs/install/mysql/tables/llx_localtax.sql @@ -1,6 +1,6 @@ -- =================================================================== --- Copyright (C) 2011 Juanjo Menent --- Copyright (C) 2011 Regis Houssin +-- Copyright (C) 2011-2014 Juanjo Menent +-- Copyright (C) 2011 Regis Houssin -- -- 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 @@ -21,6 +21,7 @@ create table llx_localtax ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, + localtaxtype tinyint(4), tms timestamp, datep date, -- date of payment datev date, -- date of value diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 582f8161365..0ff94c19530 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -57,8 +57,8 @@ create table llx_product url varchar(255), barcode varchar(255) DEFAULT NULL, fk_barcode_type integer DEFAULT 0, - accountancy_code_sell varchar(15), -- Selling accountancy code - accountancy_code_buy varchar(15), -- Buying accountancy code + accountancy_code_sell varchar(32), -- Selling accountancy code + accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Not used. Used by external modules. weight float DEFAULT NULL, weight_units tinyint DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql index 8bef980a12e..d5d89812b4a 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_time.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql @@ -20,7 +20,8 @@ create table llx_projet_task_time ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_task integer NOT NULL, - task_date date, + task_date date, -- only the day + task_datehour datetime, -- day + hour task_duration double, fk_user integer, thm double(24,8), diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index e2c08d246be..b7f91c2d1ef 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -81,7 +81,9 @@ create table llx_societe cond_reglement_supplier tinyint, -- condition de reglement fournisseur tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 + localtax1_value double(6,3), localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2 + localtax2_value double(6,3), barcode varchar(255), -- barcode fk_barcode_type integer NULL DEFAULT 0, -- barcode type price_level integer NULL, -- level of price for multiprices diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 4b537e21f0c..6fccf1804c4 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -67,7 +67,7 @@ create table llx_user color varchar(6), barcode varchar(255) DEFAULT NULL, fk_barcode_type integer DEFAULT 0, - accountancy_code varchar(24) NULL, + accountancy_code varchar(32) NULL, nb_holiday integer DEFAULT 0, salary double(24,8) )ENGINE=innodb; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 03a733447de..a10074e0f04 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -807,6 +807,13 @@ LocalTax2IsUsedDescES= The RE rate by default when creating prospects, invoices, LocalTax2IsNotUsedDescES= By default the proposed IRPF is 0. End of rule. LocalTax2IsUsedExampleES= In Spain, freelancers and independent professionals who provide services and companies who have chosen the tax system of modules. LocalTax2IsNotUsedExampleES= In Spain they are bussines not subject to tax system of modules. +CalcLocaltax=Reports +CalcLocaltax1ES=Sales - Purchases +CalcLocaltax1Desc=Local Taxes reports are calculated with the difference between localtaxes sales and localtaxes purchases +CalcLocaltax2ES=Purchases +CalcLocaltax2Desc=Local Taxes reports are the total of localtaxes purchases +CalcLocaltax3ES=Sales +CalcLocaltax3Desc=Local Taxes reports are the total of localtaxes sales LabelUsedByDefault=Label used by default if no translation can be found for code LabelOnDocuments=Label on documents NbOfDays=Nb of days @@ -1453,6 +1460,9 @@ AgendaSetup=Events and agenda module setup PasswordTogetVCalExport=Key to authorize export link PastDelayVCalExport=Do not export event older than AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionary -> Type of agenda events) +AGENDA_DEFAULT_FILTER_TYPE=Set automatically this type of event into search filter of agenda view +AGENDA_DEFAULT_FILTER_STATUS=Set automatically this status for events into search filter of agenda view +AGENDA_DEFAULT_VIEW=Which tab do you want to open by default when selecting menu Agenda ##### ClickToDial ##### ClickToDialDesc=This module allows to add an icon after phone numbers. A click on this icon will call a server with a particular URL you define below. This can be used to call a call center system from Dolibarr that can call the phone number on a SIP system for example. ##### Point Of Sales (CashDesk) ##### diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 281ee374343..2b98ccc5608 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -175,6 +175,7 @@ CalculationRuleDesc=To calculate total VAT, there is two methods:
Method 1 is CalculationRuleDescSupplier=according to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier. TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a cash accountancy mode is not relevant. This report is only available when using engagement accountancy mode (see setup of accountancy module). CalculationMode=Calculation mode +AccountancyJournal=Accountancy code journal COMPTA_PRODUCT_BUY_ACCOUNT=Default accountancy code to buy products COMPTA_PRODUCT_SOLD_ACCOUNT=Default accountancy code to sell products COMPTA_SERVICE_BUY_ACCOUNT=Default accountancy code to buy services diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 58ad4f1bc0d..647983491a0 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -677,7 +677,7 @@ class Livraison extends CommonObject { $this->lines = array(); - $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,"; + $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped, ld.fk_origin_line, "; $sql.= " cd.qty as qty_asked, cd.label as custom_label,"; $sql.= " p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."livraisondet as ld"; @@ -709,6 +709,7 @@ class Livraison extends CommonObject $line->product_ref = $obj->product_ref; // Product ref $line->product_desc = $obj->product_desc; // Product description $line->product_type = $obj->fk_product_type; + $line->fk_origin_line = $obj->fk_origin_line; $line->price = $obj->price; $line->total_ht = $obj->total_ht; diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 74b82cbcb3b..781bc748f8a 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -74,7 +74,7 @@ $form = new Form($db); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Agents")); $text=$langs->trans("Margins"); -print_fiche_titre($text); +//print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 6675753d4d6..8a7cae92d39 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -66,7 +66,7 @@ $form = new Form($db); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Clients")); $text=$langs->trans("Margins"); -print_fiche_titre($text); +//print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index ca7b2c4845b..714b13e1036 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -89,8 +89,7 @@ $form = new Form($db); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Products")); $text=$langs->trans("Margins"); - -print_fiche_titre($text); +//print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index f0bdce25fca..722e3c9aaae 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -245,7 +245,7 @@ if ($id > 0 || ! empty($ref)) $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - print $form->showrefnav($object,'id',$linkback,1,'rowid','ref','',$param); + print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','',$param); print ''; // Label diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 50763f839f7..03ca7bae452 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -209,7 +209,7 @@ if ($object->id > 0) $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - print $form->showrefnav($object,'id',$linkback,1,'rowid','ref','',$param); + print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','',$param); print ''; print ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index a6f8846ce0e..04e92c7c7f2 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -181,7 +181,7 @@ if ($object->id > 0) $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - print $form->showrefnav($object,'id',$linkback,1,'rowid','ref','',$param); + print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','',$param); print ''; // Label diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2ef635dbe53..f6c5a1840ea 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -276,7 +276,7 @@ if ($id > 0 || ! empty($ref)) $object->next_prev_filter=" fk_projet in (".$projectsListId.")"; } else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; - print $form->showrefnav($object,'id',$linkback,1,'rowid','ref','',$param); + print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','',$param); print ''; // Label diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5893fbab021..307c2fe03de 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2013 Peter Fontaine @@ -196,7 +196,9 @@ class Societe extends CommonObject // Local taxes var $localtax1_assuj; + var $localtax1_value; var $localtax2_assuj; + var $localtax2_value; var $managers; var $capital; @@ -597,6 +599,24 @@ class Societe extends CommonObject return $result; } + /** + * Update localtax value of third party + * @param int $id id societe + * @param int $local Localtax to update + * @param double $value value of localtax + */ + function update_localtax($id, $local, $value) + { + global $db; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; + if($local==1) $sql .= "localtax1_value = '" .$value."'"; + else $sql.="localtax2_value='".$value."'"; + $sql.="WHERE rowid=".$id; + + $resql=$this->db->query($sql); + + } + /** * Update parameters of third party * @@ -654,6 +674,9 @@ class Societe extends CommonObject // Local taxes $this->localtax1_assuj=trim($this->localtax1_assuj); $this->localtax2_assuj=trim($this->localtax2_assuj); + + $this->localtax1_value=trim($this->localtax1_value); + $this->localtax2_value=trim($this->localtax2_value); $this->capital=price2num(trim($this->capital),'MT'); if (empty($this->capital)) $this->capital = 0; @@ -753,6 +776,27 @@ class Societe extends CommonObject // Local taxes $sql .= ",localtax1_assuj = ".($this->localtax1_assuj!=''?"'".$this->localtax1_assuj."'":"null"); $sql .= ",localtax2_assuj = ".($this->localtax2_assuj!=''?"'".$this->localtax2_assuj."'":"null"); + if($this->localtax1_assuj==1) + { + if($this->localtax1_value!='') + { + $sql .=",localtax1_value =".$this->localtax1_value; + } + else $sql .=",localtax1_value =0.000"; + + } + else $sql .=",localtax1_value =0.000"; + + if($this->localtax2_assuj==1) + { + if($this->localtax2_value!='') + { + $sql .=",localtax2_value =".$this->localtax2_value; + } + else $sql .=",localtax2_value =0.000"; + + } + else $sql .=",localtax2_value =0.000"; $sql .= ",capital = ".$this->capital; @@ -933,7 +977,7 @@ class Societe extends CommonObject $sql .= ', s.fk_forme_juridique as forme_juridique_code'; $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; - $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo'; + $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo'; $sql .= ', s.outstanding_limit, s.import_key, s.canvas'; $sql .= ', fj.libelle as forme_juridique'; $sql .= ', e.libelle as effectif'; @@ -1034,7 +1078,9 @@ class Societe extends CommonObject // Local Taxes $this->localtax1_assuj = $obj->localtax1_assuj; $this->localtax2_assuj = $obj->localtax2_assuj; - + + $this->localtax1_value = $obj->localtax1_value; + $this->localtax2_value = $obj->localtax2_value; $this->typent_id = $obj->typent_id; $this->typent_code = $obj->typent_code; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index da6c7771eb3..d903b4d540b 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011-2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -32,6 +32,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -100,6 +101,23 @@ if (empty($reshook)) // We defined value code_fournisseur $_POST["code_fournisseur"]="Acompleter"; } + + if($action=='set_localtax1') + { + //obtidre selected del combobox + $value=GETPOST('lt1'); + $object = new Societe($db); + $res=$object->update_localtax($socid, 1, $value); + + } + if($action=='set_localtax2') + { + //obtidre selected del combobox + $value=GETPOST('lt2'); + $object = new Societe($db); + $res=$object->update_localtax($socid, 2, $value); + + } // Add new third party if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) @@ -157,6 +175,9 @@ if (empty($reshook)) // Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); + + $object->localtax1_value = GETPOST('lt1'); + $object->localtax2_value = GETPOST('lt2'); $object->forme_juridique_code = GETPOST('forme_juridique_code'); $object->effectif_id = GETPOST('effectif_id'); @@ -659,6 +680,9 @@ else //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); + + $object->localtax1_value =GETPOST('lt1'); + $object->localtax2_value =GETPOST('lt2'); $object->tva_intra = GETPOST('tva_intra'); @@ -1004,13 +1028,14 @@ else print $form->selectyesno('localtax2assuj_value',0,1); print ''; } - +/* if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='') ) { print ''.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value',0,1); print ''; } +*/ if (! empty($conf->global->MAIN_MULTILANGS)) { print ''.$langs->trans("DefaultLang").''."\n"; @@ -1150,6 +1175,9 @@ else //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); + + $object->localtax1_value =GETPOST('lt1'); + $object->localtax2_value =GETPOST('lt2'); // We set country_id, and country_code label of the chosen country if ($object->country_id > 0) @@ -1162,6 +1190,53 @@ else dol_htmloutput_errors($error,$errors); + if($object->localtax1_assuj==0){ + $sub=0; + }else{$sub=1;} + if($object->localtax2_assuj==0){ + $sub2=0; + }else{$sub2=1;} + + + print "\n".''."\n"; + + if ($conf->use_javascript_ajax) { print "\n".'