2
0
forked from Wavyzz/dolibarr

Merge branch 'Upstream/develop'

This commit is contained in:
aspangaro
2014-07-04 06:21:00 +02:00
47 changed files with 891 additions and 324 deletions

View File

@@ -9,6 +9,7 @@ For users:
- New: Can create proposal from an intervention. - New: Can create proposal from an intervention.
- New: Can filter events on a group of users. - New: Can filter events on a group of users.
- New: Add thirdparty to filter on events. - New: Add thirdparty to filter on events.
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
For translators: For translators:
- Update language files. - Update language files.

View File

@@ -26,6 +26,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.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/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
if (!$user->admin) if (!$user->admin)
accessforbidden(); 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 * View
*/ */
$formactions=new FormActions($db);
llxHeader(); llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
@@ -86,43 +96,71 @@ $head=agenda_prepare_head();
dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action'); dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action');
print_titre($langs->trans("OtherOptions")); //print_titre($langs->trans("OtherOptions"));
$var=true; $var=true;
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="action" value="set">';
print '<table class="noborder allwidth">'."\n"; print '<table class="noborder allwidth">'."\n";
print '<tr class="liste_titre">'."\n"; print '<tr class="liste_titre">'."\n";
print '<td>'.$langs->trans("Parameters").'</td>'."\n"; print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>'."\n"; print '<td align="center">&nbsp;</td>'."\n";
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n"; print '<td align="right">'.$langs->trans("Value").'</td>'."\n";
print '</tr>'."\n"; print '</tr>'."\n";
// Manual or automatic // Manual or automatic
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'."\n"; print '<tr '.$bc[$var].'>'."\n";
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE").'</td>'."\n"; print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>'."\n"; print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
print '<td align="center" width="100">'."\n"; //print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list
if ($conf->use_javascript_ajax) if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
{ {
print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
else else
{ {
if($conf->global->AGENDA_USE_EVENT_TYPE == 0) print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
else if($conf->global->BUSINESS_VISIBLE_TO_ALL_BY_DEFAULT == 1)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// AGENDA_DEFAULT_FILTER_TYPE
$var=!$var;
print '<tr '.$bc[$var].'>'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right" class="nowrap">'."\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 '</td></tr>'."\n";
// AGENDA_DEFAULT_FILTER_STATUS
$var=!$var;
print '<tr '.$bc[$var].'>'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
$formactions->form_select_status_action('agenda',$conf->global->AGENDA_DEFAULT_FILTER_STATUS,1,'AGENDA_DEFAULT_FILTER_STATUS',1,2);
print '</td></tr>'."\n";
// AGENDA_DEFAULT_VIEW
$var=!$var;
print '<tr '.$bc[$var].'>'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\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 '</td></tr>'."\n";
print '</table>'; print '</table>';
print '<center><input class="button" type="submit" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></center>';
print '</form>';
dol_fiche_end(); dol_fiche_end();
print "<br>"; print "<br>";

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -159,6 +159,31 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity); 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); 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) if ($action != 'updateedit' && ! $error)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
@@ -570,6 +595,17 @@ if ($action == 'edit' || $action == 'updateedit')
print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>";
$example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code); $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":""); print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
if(! isOnlyOneLocalTax(1))
{
print '<tr><td align="left">'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).': ';
$formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
}
print '</td></tr>';
print '<tr><td align="left">'.$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 '</td></tr>';
print "</table>"; print "</table>";
print "</td></tr>\n"; print "</td></tr>\n";
@@ -603,6 +639,16 @@ if ($action == 'edit' || $action == 'updateedit')
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";
$example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code); $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":""); print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print '<tr><td align="left">'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).': ';
if(! isOnlyOneLocalTax(2))
{
$formcompany->select_localtax(2,$conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
print '</td></tr>';
}
print '<tr><td align="left">'.$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 '</td></tr>';
print "</table>"; print "</table>";
print "</td></tr>\n"; print "</td></tr>\n";
@@ -954,6 +1000,19 @@ else
print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>";
$example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code); $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":""); print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0){
print '<tr><td>'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
}
print '<tr><td align="left">'.$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 '</td></tr>';
print "</table>"; print "</table>";
print "</td></tr>\n"; print "</td></tr>\n";
@@ -987,6 +1046,19 @@ else
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>"; print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";
$example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code); $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":""); print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0){
print '<tr><td>'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
}
print '<tr><td align="left">'.$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 '</td></tr>';
print "</table>"; print "</table>";
print "</td></tr>\n"; print "</td></tr>\n";

View File

@@ -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 = "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 "; $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 '</td></tr><tr>'; print '</td></tr><tr>';
/* /*
* 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 = "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 "; $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 ";

View File

@@ -81,7 +81,11 @@ $pid=GETPOST("projectid","int",3);
$status=GETPOST("status"); $status=GETPOST("status");
$type=GETPOST("type"); $type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $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') { if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') {
$action='show_month'; $day=''; $action='show_month'; $day='';
@@ -93,11 +97,6 @@ if (GETPOST('viewday') || $action == 'show_day') {
$action='show_day'; $day=($day?$day:date("d")); $action='show_day'; $day=($day?$day:date("d"));
} // View by day } // 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("agenda");
$langs->load("other"); $langs->load("other");
@@ -110,7 +109,8 @@ $hookmanager->initHooks(array('agenda'));
/* /*
* Actions * Actions
*/ */
if (GETPOST("viewlist"))
if (GETPOST("viewlist") || $action == 'show_list')
{ {
$param=''; $param='';
foreach($_POST as $key => $val) foreach($_POST as $key => $val)
@@ -123,6 +123,19 @@ if (GETPOST("viewlist"))
exit; 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') if ($action=='delete_action')
{ {
$event = new ActionComm($db); $event = new ActionComm($db);

View File

@@ -44,11 +44,9 @@ $status=GETPOST("status",'alpha');
$type=GETPOST('type'); $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':'')); $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 ($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($conf->global->AGENDA_DEFAULT_VIEW)) $action='show_list'; if (empty($action)) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_list':$conf->global->AGENDA_DEFAULT_VIEW);
else $action=$conf->global->AGENDA_DEFAULT_VIEW;
}
$filter=GETPOST("filter",'',3); $filter=GETPOST("filter",'',3);
$filtera = GETPOST("userasked","int",3)?GETPOST("userasked","int",3):GETPOST("filtera","int",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_week') $tabactive='cardweek';
if ($action == 'show_day') $tabactive='cardday'; if ($action == 'show_day') $tabactive='cardday';
if ($action == 'show_list') $tabactive='cardlist'; if ($action == 'show_list') $tabactive='cardlist';
if ($action == 'show_peruser') $tabactive='cardperuser';
$head = calendars_prepare_head($param); $head = calendars_prepare_head($param);

View File

@@ -74,6 +74,7 @@ class Account extends CommonObject
var $type_lib=array(); var $type_lib=array();
var $account_number; var $account_number;
var $accountancy_journal;
var $currency_code; var $currency_code;
var $min_allowed; var $min_allowed;
@@ -382,6 +383,7 @@ class Account extends CommonObject
$sql.= ", label"; $sql.= ", label";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ", account_number"; $sql.= ", account_number";
$sql.= ", accountancy_journal";
$sql.= ", currency_code"; $sql.= ", currency_code";
$sql.= ", rappro"; $sql.= ", rappro";
$sql.= ", min_allowed"; $sql.= ", min_allowed";
@@ -395,6 +397,7 @@ class Account extends CommonObject
$sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->escape($this->account_number)."'"; $sql.= ", '".$this->db->escape($this->account_number)."'";
$sql.= ", '".$this->db->escape($this->accountancy_journal)."'";
$sql.= ", '".$this->currency_code."'"; $sql.= ", '".$this->currency_code."'";
$sql.= ", ".$this->rappro; $sql.= ", ".$this->rappro;
$sql.= ", ".price2num($this->min_allowed); $sql.= ", ".price2num($this->min_allowed);
@@ -500,6 +503,7 @@ class Account extends CommonObject
$sql.= ",rappro = ".$this->rappro; $sql.= ",rappro = ".$this->rappro;
$sql.= ",url = ".($this->url?"'".$this->url."'":"null"); $sql.= ",url = ".($this->url?"'".$this->url."'":"null");
$sql.= ",account_number = '".$this->account_number."'"; $sql.= ",account_number = '".$this->account_number."'";
$sql.= ",accountancy_journal = '".$this->accountancy_journal."'";
$sql.= ",currency_code = '".$this->currency_code."'"; $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 = "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.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.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.= " ba.min_allowed, ba.min_desired, ba.comment,";
$sql.= ' p.code as country_code, p.libelle as country,'; $sql.= ' p.code as country_code, p.libelle as country,';
$sql.= ' d.code_departement as state_code, d.nom as state'; $sql.= ' d.code_departement as state_code, d.nom as state';
@@ -656,6 +660,7 @@ class Account extends CommonObject
$this->country = $obj->country; $this->country = $obj->country;
$this->account_number = $obj->account_number; $this->account_number = $obj->account_number;
$this->accountancy_journal = $obj->accountancy_journal;
$this->currency_code = $obj->currency_code; $this->currency_code = $obj->currency_code;
$this->account_currency_code = $obj->currency_code; $this->account_currency_code = $obj->currency_code;

View File

@@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copytight (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* 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
@@ -34,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks"); $langs->load("banks");
$langs->load("categories"); $langs->load("categories");
$langs->load("companies"); $langs->load("companies");
$langs->load("compta");
$action=GETPOST("action"); $action=GETPOST("action");
@@ -65,6 +67,7 @@ if ($_POST["action"] == 'add')
$account->url = $_POST["url"]; $account->url = $_POST["url"];
$account->account_number = trim($_POST["account_number"]); $account->account_number = trim($_POST["account_number"]);
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
$account->solde = $_POST["solde"]; $account->solde = $_POST["solde"];
$account->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $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->owner_address = trim($_POST["owner_address"]);
$account->account_number = trim($_POST["account_number"]); $account->account_number = trim($_POST["account_number"]);
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
$account->currency_code = trim($_POST["account_currency_code"]); $account->currency_code = trim($_POST["account_currency_code"]);
@@ -292,18 +296,6 @@ if ($action == 'create')
} }
print '</td></tr>'; print '</td></tr>';
// Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
}
else
{
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
}
// Web // Web
print '<tr><td valign="top">'.$langs->trans("Web").'</td>'; print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>'; print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
@@ -336,6 +328,27 @@ if ($action == 'create')
print '</table>'; print '</table>';
print '<br>';
print '<table class="border" width="100%">';
// Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
}
else
{
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
}
// Accountancy journal
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.$account->accountancy_journal.'"></td></tr>';
print '</table>';
print '<center><br><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></center>'; print '<center><br><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></center>';
print '</form>'; print '</form>';
@@ -431,10 +444,6 @@ else
else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
print '</td></tr>'; print '</td></tr>';
// Accountancy code
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3">'.$account->account_number.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>'; print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3">'.$account->min_allowed.'</td></tr>'; print '<td colspan="3">'.$account->min_allowed.'</td></tr>';
@@ -452,6 +461,18 @@ else
print '</table>'; print '</table>';
print '<br>';
print '<table class="border" width="100%">';
// Accountancy code
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3">'.$account->account_number.'</td></tr>';
// Accountancy journal
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
print '<td colspan="3">'.$account->accountancy_journal.'</td></tr>';
print '</table>';
print '</div>'; print '</div>';
@@ -574,19 +595,7 @@ else
else print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation"); else print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
print '</td></tr>'; print '</td></tr>';
// Accountancy code // Balance
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
else
{
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
// Balance
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>'; print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"])?$_POST["account_min_allowed"]:$account->min_allowed).'"></td></tr>'; print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"])?$_POST["account_min_allowed"]:$account->min_allowed).'"></td></tr>';
@@ -607,6 +616,22 @@ else
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
// Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
else
{
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
// Accountancy journal
print '<tr><td valign="top">'.$langs->trans("AccountancyJournalCode").'</td>';
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?$_POST["accountancy_journal"]:$account->accountancy_journal).'"></td></tr>';
print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">'; print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">'; print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
print '</td></tr>'; print '</td></tr>';

View File

@@ -217,12 +217,15 @@ if ($action == 'create')
if ($num) if ($num)
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="54%">'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td width="8%" align="center">'.$langs->trans("VAT").'</td>'; print '<td align="center">'.$langs->trans("VAT").'</td>';
print '<td width="8%" align="center">'.$langs->trans("Qty").'</td>'; print '<td align="center">'.$langs->trans("Qty").'</td>';
print '<td width="8%" align="right">'.$langs->trans("ReductionShort").'</td>'; print '<td>'.$langs->trans("ReductionShort").'</td>';
print '<td width="12%" align="right">'.$langs->trans("PriceU").'</td>'; print '<td align="right">'.$langs->trans("TotalHT").'</td>';
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td width="12%" align="right">'.$langs->trans("CurrentProductPrice").'</td>'; print '<td align="right">'.$langs->trans("TotalVAT").'</td>';
print '<td align="right">'.$langs->trans("TotalTTC").'</td>';
print '<td align="right">'.$langs->trans("PriceUHT").'</td>';
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">'.$langs->trans("CurrentProductPrice").'</td>';
print "</tr>\n"; print "</tr>\n";
} }
$var=True; $var=True;
@@ -288,9 +291,13 @@ if ($action == 'create')
print "</td>\n"; print "</td>\n";
} }
// Vat rate
print '<td align="center">'.vatrate($objp->tva_tx).'%</td>'; print '<td align="center">'.vatrate($objp->tva_tx).'%</td>';
// Qty
print '<td align="center">'.$objp->qty.'</td>'; print '<td align="center">'.$objp->qty.'</td>';
// Percent
if ($objp->remise_percent > 0) if ($objp->remise_percent > 0)
{ {
print '<td align="right">'.$objp->remise_percent." %</td>\n"; print '<td align="right">'.$objp->remise_percent." %</td>\n";
@@ -300,9 +307,19 @@ if ($action == 'create')
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
// Total HT
print '<td align="right">'.price($objp->total_ht)."</td>\n";
// Total VAT
print '<td align="right">'.price($objp->total_vat)."</td>\n";
// Total TTC
print '<td align="right">'.price($objp->total_ttc)."</td>\n";
// Total Unit price
print '<td align="right">'.price($objp->subprice)."</td>\n"; print '<td align="right">'.price($objp->subprice)."</td>\n";
// Price of product // Current price of product
if (empty($conf->global->PRODUIT_MULTIPRICES)) if (empty($conf->global->PRODUIT_MULTIPRICES))
{ {
if ($objp->fk_product > 0) if ($objp->fk_product > 0)

View File

@@ -248,10 +248,8 @@ class Paiement extends CommonObject
if (! $error) if (! $error)
{ {
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $result=$this->call_trigger('PAYMENT_CUSTOMER_CREATE', $user);
$interface=new Interfaces($this->db); if ($result < 0) { $error++; }
$result=$interface->run_triggers('PAYMENT_CUSTOMER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
} }
} }
@@ -363,11 +361,13 @@ class Paiement extends CommonObject
if (! $notrigger) if (! $notrigger)
{ {
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $result=$this->call_trigger('PAYMENT_DELETE', $user);
$interface=new Interfaces($this->db); if ($result < 0)
$result=$interface->run_triggers('PAYMENT_DELETE',$this,$user,$langs,$conf); {
if ($result < 0) { $error++; $this->errors=$interface->errors; } $this->db->rollback();
// Fin appel triggers return -1;
}
// Fin appel triggers
} }
$this->db->commit(); $this->db->commit();
@@ -516,11 +516,9 @@ class Paiement extends CommonObject
if (! $error && ! $notrigger) if (! $error && ! $notrigger)
{ {
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $result=$this->call_trigger('PAYMENT_ADD_TO_BANK', $user);
$interface=new Interfaces($this->db); if ($result < 0) { $error++; }
$result=$interface->run_triggers('PAYMENT_ADD_TO_BANK',$this,$user,$langs,$conf); // Fin appel triggers
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
} }
} }
else else

View File

@@ -120,7 +120,7 @@ class FormActions
{ {
//var_dump($selected); //var_dump($selected);
if ($selected == 'done') $selected='100'; if ($selected == 'done') $selected='100';
print '<select '.($canedit?'':'disabled="disabled" ').'name="status" id="select'.$htmlname.'" class="flat">'; print '<select '.($canedit?'':'disabled="disabled" ').'name="'.$htmlname.'" id="select'.$htmlname.'" class="flat">';
if ($showempty) print '<option value=""'.($selected == ''?' selected="selected"':'').'></option>'; if ($showempty) print '<option value=""'.($selected == ''?' selected="selected"':'').'></option>';
foreach($listofstatus as $key => $val) foreach($listofstatus as $key => $val)
{ {
@@ -230,9 +230,10 @@ class FormActions
* @param string $htmlname Nom champ formulaire * @param string $htmlname Nom champ formulaire
* @param string $excludetype Type to exclude * @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 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 * @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; global $langs,$user,$form;
@@ -251,7 +252,7 @@ class FormActions
if ($selected == 'auto') $selected='AC_OTH_AUTO'; if ($selected == 'auto') $selected='AC_OTH_AUTO';
print $form->selectarray($htmlname, $arraylist, $selected); 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);
} }
} }

View File

@@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* *
* 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
@@ -776,5 +777,42 @@ class FormCompany
return $out; 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 '<select class="flat" name="'.$htmlname.'">';
while($i <= (count($valors))-1){
if ($selected == $valors[$i]){
print '<option value="'.$valors[$i].'" selected="selected">';
}else{
print '<option value="'.$valors[$i].'">';
}
print $valors[$i];
print '</option>';
$i++;
}
print'</select>';
}
}
}
} }

View File

@@ -359,6 +359,11 @@ function agenda_prepare_head()
$h = 0; $h = 0;
$head = array(); $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][0] = DOL_URL_ROOT."/admin/agenda.php";
$head[$h][1] = $langs->trans("AutoActions"); $head[$h][1] = $langs->trans("AutoActions");
$head[$h][2] = 'autoactions'; $head[$h][2] = 'autoactions';
@@ -374,11 +379,6 @@ function agenda_prepare_head()
$head[$h][2] = 'extsites'; $head[$h][2] = 'extsites';
$h++; $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'); complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";

View File

@@ -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); $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
$out= "\n<!-- Ajax code to switch constant ".$code." -->".' if (empty($conf->use_javascript_ajax))
<script type="text/javascript"> {
$(document).ready(function() { if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
var input = '.json_encode($input).'; else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\'; }
var code = \''.$code.'\'; else
var entity = \''.$entity.'\'; {
var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'"; $out= "\n<!-- Ajax code to switch constant ".$code." -->".'
var noButton = "'.dol_escape_js($langs->transnoentities("No")).'"; <script type="text/javascript">
$(document).ready(function() {
var input = '.json_encode($input).';
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
var code = \''.$code.'\';
var entity = \''.$entity.'\';
var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'";
var noButton = "'.dol_escape_js($langs->transnoentities("No")).'";
// Set constant // Set constant
$("#set_" + code).click(function() { $("#set_" + code).click(function() {
if (input.alert && input.alert.set) { if (input.alert && input.alert.set) {
if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton; if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
if (input.alert.set.noButton) noButton = input.alert.set.noButton; if (input.alert.set.noButton) noButton = input.alert.set.noButton;
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton); confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
} else { } else {
setConstant(url, code, input, entity); setConstant(url, code, input, entity);
} }
});
// 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);
}
});
}); });
</script>'."\n";
// Del constant $out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
$("#del_" + code).click(function() { $out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).'</span>';
if (input.alert && input.alert.del) { $out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).'</span>';
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; $out.="\n";
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);
}
});
});
</script>'."\n";
$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).'</span>';
$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).'</span>';
$out.="\n";
return $out; return $out;
} }

View File

@@ -7,7 +7,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
@@ -2887,11 +2887,16 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
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); 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 // 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 ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe
{ {
if ($local == 1) if ($local == 1)
{ {
if(! $mysoc->localtax1_assuj) return 0;
if ($thirdparty_seller->id==$mysoc->id) if ($thirdparty_seller->id==$mysoc->id)
{ {
if (! $thirdparty_buyer->localtax1_assuj) return 0; if (! $thirdparty_buyer->localtax1_assuj) return 0;
@@ -2904,8 +2909,8 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
if ($local == 2) if ($local == 2)
{ {
if(! $mysoc->localtax2_assuj) return 0;
if ($thirdparty_seller->id==$mysoc->id) if ($thirdparty_seller->id==$mysoc->id )
{ {
if (! $thirdparty_buyer->localtax2_assuj) return 0; if (! $thirdparty_buyer->localtax2_assuj) return 0;
} }
@@ -2931,6 +2936,43 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
}*/ }*/
// Search local taxes // 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 = "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 .= " 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."'"; $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 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 * Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
* TODO * TODO
@@ -2960,7 +3053,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
* @param int $thirdparty Company object * @param int $thirdparty Company object
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) * @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; global $db;
@@ -2969,16 +3062,84 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
// Search local taxes // Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $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 .= " 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"; $sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($local == 1) return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); if ($local == 1)
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 (! 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; return 0;

View File

@@ -97,10 +97,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
// Define position of columns // Define position of columns
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxcomm=112; $this->posxcomm=900;
//$this->posxtva=112; //$this->posxtva=112;
//$this->posxup=126; //$this->posxup=126;
$this->posxqty=174; $this->posxqty=140;
$this->posxremainingqty=165;
//$this->posxdiscount=162; //$this->posxdiscount=162;
//$this->postotalht=174; //$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format 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); $commande->fetch($expedition->origin_id);
} }
$object->commande=$commande; // We set order of shipment onto delivery. $object->commande=$commande; // We set order of shipment onto delivery.
$object->commande->loadExpeditions();
$pdf->Open(); $pdf->Open();
@@ -355,7 +357,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
// Quantity // Quantity
//$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); //$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxqty, $curY); $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 // Remise sur ligne
$pdf->SetXY($this->posxdiscount, $curY); $pdf->SetXY($this->posxdiscount, $curY);
@@ -615,12 +622,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder
} }
// Qty // 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)) { if (empty($hidetop)) {
$pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->SetXY($this->posxqty, $tab_top+1);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); $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');
}
} }
/** /**

View File

@@ -590,6 +590,8 @@ class Expedition extends CommonObject
$cpt = $this->db->num_rows($resql); $cpt = $this->db->num_rows($resql);
for ($i = 0; $i < $cpt; $i++) for ($i = 0; $i < $cpt; $i++)
{ {
if($obj->qty <= 0) continue;
dol_syslog(get_class($this)."::valid movement index ".$i); dol_syslog(get_class($this)."::valid movement index ".$i);
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);

View File

@@ -163,7 +163,7 @@ if ($action == 'add')
{ {
$qty = "qtyl".$i; $qty = "qtyl".$i;
if (! isset($batch_line[$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; $ent = "entl".$i;
$idl = "idl".$i; $idl = "idl".$i;

View File

@@ -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); 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) -- 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 ( 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','1','VAT reduced 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','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 ( 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','1','VAT Rate 0',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) -- 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); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (201,20, '25','0','VAT standard rate',1);

View File

@@ -19,3 +19,42 @@
ALTER TABLE llx_c_paiement ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER active; 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;

View File

@@ -20,11 +20,16 @@
create table llx_accountingaccount create table llx_accountingaccount
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, 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, fk_pcg_version varchar(12) NOT NULL,
pcg_type varchar(20) NOT NULL, pcg_type varchar(20) NOT NULL,
pcg_subtype varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL,
account_number varchar(20) NOT NULL, account_number varchar(32) NOT NULL,
account_parent varchar(20), account_parent varchar(32),
label varchar(255) NOT NULL, label varchar(255) NOT NULL,
fk_user_author integer DEFAULT NULL,
fk_user_modif integer DEFAULT NULL,
active tinyint DEFAULT 1 NOT NULL active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -20,7 +20,7 @@
create table llx_accountingdebcred create table llx_accountingdebcred
( (
fk_transaction integer NOT NULL, fk_transaction integer NOT NULL,
account_number varchar(20) NOT NULL, account_number varchar(32) NOT NULL,
amount real NOT NULL, amount real NOT NULL,
direction varchar(1) NOT NULL direction varchar(1) NOT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -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 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); 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

View File

@@ -1,7 +1,8 @@
-- ============================================================================= -- =============================================================================
-- Copyright (C) 2000-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2000-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> -- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
-- --
-- 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
@@ -18,39 +19,39 @@
-- --
-- ============================================================================= -- =============================================================================
-- courant : type de compte: 0 epargne, 1 courant, 2 caisse -- courant : type of account: 0 epargne, 1 curent/card/cheque, 2 cash
-- clos : le compte est-il clos ou encore ouvert -- clos : is account opened or closed
create table llx_bank_account create table llx_bank_account
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime, datec datetime,
tms timestamp, tms timestamp,
ref varchar(12) NOT NULL, ref varchar(12) NOT NULL,
label varchar(30) NOT NULL, label varchar(30) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
bank varchar(60), bank varchar(60),
code_banque varchar(8), code_banque varchar(8),
code_guichet varchar(6), code_guichet varchar(6),
number varchar(255), number varchar(255),
cle_rib varchar(5), cle_rib varchar(5),
bic varchar(11), bic varchar(11),
iban_prefix varchar(34), -- 34 according to ISO 13616 iban_prefix varchar(34), -- 34 according to ISO 13616
country_iban varchar(2), -- deprecated country_iban varchar(2), -- deprecated
cle_iban varchar(2), cle_iban varchar(2),
domiciliation varchar(255), domiciliation varchar(255),
state_id integer DEFAULT NULL, state_id integer DEFAULT NULL,
fk_pays integer NOT NULL, fk_pays integer NOT NULL,
proprio varchar(60), proprio varchar(60),
owner_address varchar(255), owner_address varchar(255),
courant smallint DEFAULT 0 NOT NULL, courant smallint DEFAULT 0 NOT NULL,
clos smallint DEFAULT 0 NOT NULL, clos smallint DEFAULT 0 NOT NULL,
rappro smallint DEFAULT 1, rappro smallint DEFAULT 1,
url varchar(128), url varchar(128),
account_number varchar(24), -- bank accountancy number account_number varchar(32), -- bank accountancy number
currency_code varchar(3) NOT NULL, accountancy_journal varchar(3) DEFAULT NULL, -- bank accountancy journal
min_allowed integer DEFAULT 0, currency_code varchar(3) NOT NULL,
min_desired integer DEFAULT 0, min_allowed integer DEFAULT 0,
comment text min_desired integer DEFAULT 0,
comment text
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -24,7 +24,7 @@ create table llx_c_chargesociales
deductible smallint DEFAULT 0 NOT NULL, deductible smallint DEFAULT 0 NOT NULL,
active tinyint DEFAULT 1 NOT NULL, active tinyint DEFAULT 1 NOT NULL,
code varchar(12) 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, fk_pays integer DEFAULT 1 NOT NULL,
module varchar(32) NULL module varchar(32) NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -23,7 +23,7 @@ create table llx_c_revenuestamp
taux double NOT NULL, taux double NOT NULL,
note varchar(128), note varchar(128),
active tinyint DEFAULT 1 NOT NULL, active tinyint DEFAULT 1 NOT NULL,
accountancy_code_sell varchar(15) DEFAULT NULL, accountancy_code_sell varchar(32) DEFAULT NULL,
accountancy_code_buy varchar(15) DEFAULT NULL accountancy_code_buy varchar(32) DEFAULT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -1,6 +1,6 @@
-- ======================================================================== -- ========================================================================
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> -- Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com> -- Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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, rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
fk_pays integer NOT NULL, fk_pays integer NOT NULL,
taux double 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', localtax1_type varchar(10) NOT NULL DEFAULT '0',
localtax2 double NOT NULL DEFAULT 0, localtax2 varchar(10) NOT NULL DEFAULT '0',
localtax2_type varchar(10) NOT NULL DEFAULT '0', localtax2_type varchar(10) NOT NULL DEFAULT '0',
recuperableonly integer NOT NULL DEFAULT 0, recuperableonly integer NOT NULL DEFAULT 0,
note varchar(128), note varchar(128),
active tinyint DEFAULT 1 NOT NULL, active tinyint DEFAULT 1 NOT NULL,
accountancy_code_sell varchar(15) DEFAULT NULL, accountancy_code_sell varchar(32) DEFAULT NULL,
accountancy_code_buy varchar(15) DEFAULT NULL accountancy_code_buy varchar(32) DEFAULT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -1,32 +0,0 @@
-- ===================================================================
-- Copyright (C) 2000-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
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;

View File

@@ -1,28 +0,0 @@
-- ===================================================================
-- Copyright (C) 2000-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
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;

View File

@@ -1,29 +0,0 @@
-- ===================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
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;

View File

@@ -1,6 +1,6 @@
-- =================================================================== -- ===================================================================
-- Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> -- Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com> -- Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
-- --
-- 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
@@ -21,6 +21,7 @@ create table llx_localtax
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, entity integer DEFAULT 1 NOT NULL,
localtaxtype tinyint(4),
tms timestamp, tms timestamp,
datep date, -- date of payment datep date, -- date of payment
datev date, -- date of value datev date, -- date of value

View File

@@ -57,8 +57,8 @@ create table llx_product
url varchar(255), url varchar(255),
barcode varchar(255) DEFAULT NULL, barcode varchar(255) DEFAULT NULL,
fk_barcode_type integer DEFAULT 0, fk_barcode_type integer DEFAULT 0,
accountancy_code_sell varchar(15), -- Selling accountancy code accountancy_code_sell varchar(32), -- Selling accountancy code
accountancy_code_buy varchar(15), -- Buying accountancy code accountancy_code_buy varchar(32), -- Buying accountancy code
partnumber varchar(32), -- Not used. Used by external modules. partnumber varchar(32), -- Not used. Used by external modules.
weight float DEFAULT NULL, weight float DEFAULT NULL,
weight_units tinyint DEFAULT NULL, weight_units tinyint DEFAULT NULL,

View File

@@ -20,7 +20,8 @@ create table llx_projet_task_time
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_task integer NOT NULL, fk_task integer NOT NULL,
task_date date, task_date date, -- only the day
task_datehour datetime, -- day + hour
task_duration double, task_duration double,
fk_user integer, fk_user integer,
thm double(24,8), thm double(24,8),

View File

@@ -81,7 +81,9 @@ create table llx_societe
cond_reglement_supplier tinyint, -- condition de reglement fournisseur cond_reglement_supplier tinyint, -- condition de reglement fournisseur
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 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_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
localtax2_value double(6,3),
barcode varchar(255), -- barcode barcode varchar(255), -- barcode
fk_barcode_type integer NULL DEFAULT 0, -- barcode type fk_barcode_type integer NULL DEFAULT 0, -- barcode type
price_level integer NULL, -- level of price for multiprices price_level integer NULL, -- level of price for multiprices

View File

@@ -67,7 +67,7 @@ create table llx_user
color varchar(6), color varchar(6),
barcode varchar(255) DEFAULT NULL, barcode varchar(255) DEFAULT NULL,
fk_barcode_type integer DEFAULT 0, fk_barcode_type integer DEFAULT 0,
accountancy_code varchar(24) NULL, accountancy_code varchar(32) NULL,
nb_holiday integer DEFAULT 0, nb_holiday integer DEFAULT 0,
salary double(24,8) salary double(24,8)
)ENGINE=innodb; )ENGINE=innodb;

View File

@@ -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. 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. 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. 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 LabelUsedByDefault=Label used by default if no translation can be found for code
LabelOnDocuments=Label on documents LabelOnDocuments=Label on documents
NbOfDays=Nb of days NbOfDays=Nb of days
@@ -1453,6 +1460,9 @@ AgendaSetup=Events and agenda module setup
PasswordTogetVCalExport=Key to authorize export link PasswordTogetVCalExport=Key to authorize export link
PastDelayVCalExport=Do not export event older than PastDelayVCalExport=Do not export event older than
AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionary -> Type of agenda events) 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 ##### ##### 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. 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) ##### ##### Point Of Sales (CashDesk) #####

View File

@@ -175,6 +175,7 @@ CalculationRuleDesc=To calculate total VAT, there is two methods:<br>Method 1 is
CalculationRuleDescSupplier=according to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier. 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 <b>cash accountancy</b> mode is not relevant. This report is only available when using <b>engagement accountancy</b> mode (see setup of accountancy module). TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a <b>cash accountancy</b> mode is not relevant. This report is only available when using <b>engagement accountancy</b> mode (see setup of accountancy module).
CalculationMode=Calculation mode CalculationMode=Calculation mode
AccountancyJournal=Accountancy code journal
COMPTA_PRODUCT_BUY_ACCOUNT=Default accountancy code to buy products COMPTA_PRODUCT_BUY_ACCOUNT=Default accountancy code to buy products
COMPTA_PRODUCT_SOLD_ACCOUNT=Default accountancy code to sell products COMPTA_PRODUCT_SOLD_ACCOUNT=Default accountancy code to sell products
COMPTA_SERVICE_BUY_ACCOUNT=Default accountancy code to buy services COMPTA_SERVICE_BUY_ACCOUNT=Default accountancy code to buy services

View File

@@ -677,7 +677,7 @@ class Livraison extends CommonObject
{ {
$this->lines = array(); $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.= " 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.= " 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"; $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_ref = $obj->product_ref; // Product ref
$line->product_desc = $obj->product_desc; // Product description $line->product_desc = $obj->product_desc; // Product description
$line->product_type = $obj->fk_product_type; $line->product_type = $obj->fk_product_type;
$line->fk_origin_line = $obj->fk_origin_line;
$line->price = $obj->price; $line->price = $obj->price;
$line->total_ht = $obj->total_ht; $line->total_ht = $obj->total_ht;

View File

@@ -74,7 +74,7 @@ $form = new Form($db);
llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Agents")); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Agents"));
$text=$langs->trans("Margins"); $text=$langs->trans("Margins");
print_fiche_titre($text); //print_fiche_titre($text);
// Show tabs // Show tabs
$head=marges_prepare_head($user); $head=marges_prepare_head($user);

View File

@@ -66,7 +66,7 @@ $form = new Form($db);
llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Clients")); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Clients"));
$text=$langs->trans("Margins"); $text=$langs->trans("Margins");
print_fiche_titre($text); //print_fiche_titre($text);
// Show tabs // Show tabs
$head=marges_prepare_head($user); $head=marges_prepare_head($user);

View File

@@ -89,8 +89,7 @@ $form = new Form($db);
llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Products")); llxHeader('',$langs->trans("Margins").' - '.$langs->trans("Products"));
$text=$langs->trans("Margins"); $text=$langs->trans("Margins");
//print_fiche_titre($text);
print_fiche_titre($text);
// Show tabs // Show tabs
$head=marges_prepare_head($user); $head=marges_prepare_head($user);

View File

@@ -245,7 +245,7 @@ if ($id > 0 || ! empty($ref))
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; 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 '</td></tr>'; print '</td></tr>';
// Label // Label

View File

@@ -209,7 +209,7 @@ if ($object->id > 0)
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; 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 '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@@ -181,7 +181,7 @@ if ($object->id > 0)
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; 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 '</td></tr>'; print '</td></tr>';
// Label // Label

View File

@@ -276,7 +276,7 @@ if ($id > 0 || ! empty($ref))
$object->next_prev_filter=" fk_projet in (".$projectsListId.")"; $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
} }
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id; 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 '</td></tr>'; print '</td></tr>';
// Label // Label

View File

@@ -6,7 +6,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr> * Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
@@ -196,7 +196,9 @@ class Societe extends CommonObject
// Local taxes // Local taxes
var $localtax1_assuj; var $localtax1_assuj;
var $localtax1_value;
var $localtax2_assuj; var $localtax2_assuj;
var $localtax2_value;
var $managers; var $managers;
var $capital; var $capital;
@@ -597,6 +599,24 @@ class Societe extends CommonObject
return $result; 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 * Update parameters of third party
* *
@@ -655,6 +675,9 @@ class Societe extends CommonObject
$this->localtax1_assuj=trim($this->localtax1_assuj); $this->localtax1_assuj=trim($this->localtax1_assuj);
$this->localtax2_assuj=trim($this->localtax2_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'); $this->capital=price2num(trim($this->capital),'MT');
if (empty($this->capital)) $this->capital = 0; if (empty($this->capital)) $this->capital = 0;
@@ -753,6 +776,27 @@ class Societe extends CommonObject
// Local taxes // Local taxes
$sql .= ",localtax1_assuj = ".($this->localtax1_assuj!=''?"'".$this->localtax1_assuj."'":"null"); $sql .= ",localtax1_assuj = ".($this->localtax1_assuj!=''?"'".$this->localtax1_assuj."'":"null");
$sql .= ",localtax2_assuj = ".($this->localtax2_assuj!=''?"'".$this->localtax2_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; $sql .= ",capital = ".$this->capital;
@@ -933,7 +977,7 @@ class Societe extends CommonObject
$sql .= ', s.fk_forme_juridique as forme_juridique_code'; $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.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.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 .= ', s.outstanding_limit, s.import_key, s.canvas';
$sql .= ', fj.libelle as forme_juridique'; $sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif'; $sql .= ', e.libelle as effectif';
@@ -1035,6 +1079,8 @@ class Societe extends CommonObject
$this->localtax1_assuj = $obj->localtax1_assuj; $this->localtax1_assuj = $obj->localtax1_assuj;
$this->localtax2_assuj = $obj->localtax2_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_id = $obj->typent_id;
$this->typent_code = $obj->typent_code; $this->typent_code = $obj->typent_code;

View File

@@ -5,7 +5,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2011-2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.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/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.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@@ -101,6 +102,23 @@ if (empty($reshook))
$_POST["code_fournisseur"]="Acompleter"; $_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 // Add new third party
if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode'))
&& ($action == 'add' || $action == 'update') && $user->rights->societe->creer) && ($action == 'add' || $action == 'update') && $user->rights->societe->creer)
@@ -158,6 +176,9 @@ if (empty($reshook))
$object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax1_assuj = GETPOST('localtax1assuj_value');
$object->localtax2_assuj = GETPOST('localtax2assuj_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->forme_juridique_code = GETPOST('forme_juridique_code');
$object->effectif_id = GETPOST('effectif_id'); $object->effectif_id = GETPOST('effectif_id');
if (GETPOST("private") == 1) if (GETPOST("private") == 1)
@@ -660,6 +681,9 @@ else
$object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax1_assuj = GETPOST('localtax1assuj_value');
$object->localtax2_assuj = GETPOST('localtax2assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value');
$object->localtax1_value =GETPOST('lt1');
$object->localtax2_value =GETPOST('lt2');
$object->tva_intra = GETPOST('tva_intra'); $object->tva_intra = GETPOST('tva_intra');
$object->commercial_id = GETPOST('commercial_id'); $object->commercial_id = GETPOST('commercial_id');
@@ -1004,13 +1028,14 @@ else
print $form->selectyesno('localtax2assuj_value',0,1); print $form->selectyesno('localtax2assuj_value',0,1);
print '</td><tr>'; print '</td><tr>';
} }
/*
if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='') ) if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='') )
{ {
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">'; print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print $form->selectyesno('localtax2assuj_value',0,1); print $form->selectyesno('localtax2assuj_value',0,1);
print '</td><tr>'; print '</td><tr>';
} }
*/
if (! empty($conf->global->MAIN_MULTILANGS)) if (! empty($conf->global->MAIN_MULTILANGS))
{ {
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td colspan="3" class="maxwidthonsmartphone">'."\n"; print '<tr><td>'.$langs->trans("DefaultLang").'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
@@ -1151,6 +1176,9 @@ else
$object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax1_assuj = GETPOST('localtax1assuj_value');
$object->localtax2_assuj = GETPOST('localtax2assuj_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 // We set country_id, and country_code label of the chosen country
if ($object->country_id > 0) if ($object->country_id > 0)
{ {
@@ -1162,6 +1190,53 @@ else
dol_htmloutput_errors($error,$errors); 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".'<script type="text/javascript">';
print '$(document).ready(function () {
var val='.$sub.';
var val2='.$sub2.';
if("#localtax1assuj_value".value==undefined){
if(val==1){
$(".cblt1").show();
}else{
$(".cblt1").hide();
}
}
if("#localtax2assuj_value".value==undefined){
if(val2==1){
$(".cblt2").show();
}else{
$(".cblt2").hide();
}
}
$("#localtax1assuj_value").change(function() {
var value=document.getElementById("localtax1assuj_value").value;
if(value==1){
$(".cblt1").show();
}else{
$(".cblt1").hide();
}
});
$("#localtax2assuj_value").change(function() {
var value=document.getElementById("localtax2assuj_value").value;
if(value==1){
$(".cblt2").show();
}else{
$(".cblt2").hide();
}
});
});';
print '</script>'."\n";
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
@@ -1381,36 +1456,54 @@ else
// Local Taxes // Local Taxes
//TODO: Place into a function to control showing by country or study better option //TODO: Place into a function to control showing by country or study better option
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>'; print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>';
print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1);
if(! isOnlyOneLocalTax(1))
{
print '<span class="cblt1"> '.$langs->transcountry("Type",$mysoc->country_code).': ';
$formcompany->select_localtax(1,$object->localtax1_value, "lt1");
print '</span>';
}
print '</td><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td>'; print '</td><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
if (! isOnlyOneLocalTax(2))
{
print '<span class="cblt2"> '.$langs->transcountry("Type",$mysoc->country_code).': ';
$formcompany->select_localtax(2,$object->localtax2_value, "lt2");
print '</span>';
}
print '</td></tr>'; print '</td></tr>';
} }
elseif($mysoc->localtax1_assuj=="1") elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td colspan="3">'; print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1);
if(! isOnlyOneLocalTax(1))
{
print '<span class="cblt1"> '.$langs->transcountry("Type",$mysoc->country_code).': ';
$formcompany->select_localtax(1,$object->localtax1_value, "lt1");
print '</span>';
}
print '</td></tr>'; print '</td></tr>';
} }
elseif($mysoc->localtax2_assuj=="1") elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">'; print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
if(! isOnlyOneLocalTax(2))
{
print '<span class="cblt2"> '.$langs->transcountry("Type",$mysoc->country_code).': ';
$formcompany->select_localtax(2,$object->localtax2_value, "lt2");
print '</span>';
}
print '</td></tr>'; print '</td></tr>';
} }
if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && $object->fournisseur==1)
{
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print $form->selectyesno('localtax2assuj_value',0,1);
print '</td><tr>';
}
// Type - Size // Type - Size
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>'; print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
@@ -1715,27 +1808,93 @@ else
print yn($object->localtax2_assuj); print yn($object->localtax2_assuj);
print '</td></tr>'; print '</td></tr>';
if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1)))
{
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'">';
print '<input type="hidden" name="action" value="set_localtax1">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr><td>'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).' <a href="'.$_SERVER["PHP_SELF"].'?action=editRE&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</td>';
if($action == 'editRE')
{
print '<td align="left">';
$formcompany->select_localtax(1,$object->localtax1_value, "lt1");
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
}
else
{
print '<td>'.$object->localtax1_value.'</td>';
}
print '</tr></form>';
}
if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2)))
{
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'">';
print '<input type="hidden" name="action" value="set_localtax2">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr><td>'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).'<a href="'.$_SERVER["PHP_SELF"].'?action=editIRPF&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</td>';
if($action == 'editIRPF'){
print '<td align="left">';
$formcompany->select_localtax(2,$object->localtax2_value, "lt2");
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
}else{
print '<td>'.$object->localtax2_value.'</td>';
}
print '</tr></form>';
}
} }
elseif($mysoc->localtax1_assuj=="1") elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td colspan="3">'; print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print yn($object->localtax1_assuj); print yn($object->localtax1_assuj);
print '</td><tr>'; print '</td><tr>';
if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1)))
{
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'">';
print '<input type="hidden" name="action" value="set_localtax1">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr><td> '.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).'<a href="'.$_SERVER["PHP_SELF"].'?action=editRE&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</td>';
if($action == 'editRE'){
print '<td align="left">';
$formcompany->select_localtax(1,$object->localtax1_value, "lt1");
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
}else{
print '<td>'.$object->localtax1_value.'</td>';
}
print '</tr></form>';
}
} }
elseif($mysoc->localtax2_assuj=="1") elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">'; print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print yn($object->localtax2_assuj); print yn($object->localtax2_assuj);
print '</td><tr>'; print '</td><tr>';
} if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2)))
{
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'">';
print '<input type="hidden" name="action" value="set_localtax2">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr><td> '.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).' <a href="'.$_SERVER["PHP_SELF"].'?action=editIRPF&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</td>';
if($action == 'editIRPF'){
print '<td align="left">';
$formcompany->select_localtax(2,$object->localtax2_value, "lt2");
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
}else{
print '<td>'.$object->localtax2_value.'</td>';
}
print '</tr></form>';
}
}
/*
if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && $object->fournisseur==1) if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && $object->fournisseur==1)
{ {
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">'; print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print yn($object->localtax2_assuj); print yn($object->localtax2_assuj);
print '</td><tr>'; print '</td><tr>';
} }
*/
// Type + Staff // Type + Staff
$arr = $formcompany->typent_array(1); $arr = $formcompany->typent_array(1);
$object->typent= $arr[$object->typent_code]; $object->typent= $arr[$object->typent_code];