forked from Wavyzz/dolibarr
Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/accountancy/admin/account.php htdocs/accountancy/admin/categories.php htdocs/expensereport/class/expensereport.class.php htdocs/install/mysql/migration/4.0.0-5.0.0.sql
This commit is contained in:
@@ -161,7 +161,9 @@ $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.acco
|
||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON aa.account_parent = a2.rowid";
|
||||
// Dirty hack wainting that foreign key account_parent is an integer to be compared correctly with rowid
|
||||
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER)";
|
||||
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED)";
|
||||
$sql .= " WHERE asy.rowid = " . $pcgver;
|
||||
|
||||
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
|
||||
@@ -196,12 +198,15 @@ if ($resql)
|
||||
if ($search_accountparent) $params.= '&search_accountparent='.urlencode($search_accountparent);
|
||||
if ($search_pcgtype) $params.= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype) $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss) $param.='&optioncss='.$optioncss;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy');
|
||||
|
||||
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
|
||||
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
|
||||
|
||||
// Box to select active chart of account
|
||||
$var = ! $var;
|
||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||
@@ -229,24 +234,7 @@ if ($resql)
|
||||
print "</select>";
|
||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
print '<br>';
|
||||
print "<br>\n";
|
||||
|
||||
print '</form>';
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
print '<a class="butAction" href="./categories.php">' . $langs->trans("ApplyMassCategories") . '</a>';
|
||||
// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
@@ -371,12 +359,12 @@ if ($resql)
|
||||
|
||||
// Action
|
||||
print '<td align="center">';
|
||||
if ($user->admin) {
|
||||
print '<a href="./card.php?action=update&id=' . $obj->rowid . '">';
|
||||
if ($user->rights->accounting->chartofaccount) {
|
||||
print '<a href="./card.php?action=update&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '">';
|
||||
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id). '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancysystem.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
@@ -159,13 +160,15 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
||||
$result = $object->update($user);
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
$urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id);
|
||||
header("Location: " . $urltogo);
|
||||
exit();
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
}
|
||||
} else {
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
$urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id);
|
||||
header("Location: " . $urltogo);
|
||||
exit();
|
||||
}
|
||||
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
|
||||
@@ -196,6 +199,9 @@ $form = new Form($db);
|
||||
$htmlacc = new FormVentilation($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
$accountsystem = new AccountancySystem($db);
|
||||
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
|
||||
// Create mode
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
||||
@@ -208,36 +214,45 @@ if ($action == 'create') {
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Chart of account
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Chartofaccounts") . '</span></td>';
|
||||
print '<td>';
|
||||
print $accountsystem->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Account number
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
||||
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
|
||||
print '<td><input name="label" size="70" value="' . $object->label . '"></td></tr>';
|
||||
|
||||
// Account parent
|
||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_account($object->account_parent, 'account_parent', 1);
|
||||
print $htmlacc->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of acounts subtype
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
||||
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -268,6 +283,7 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="edit">';
|
||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@@ -294,13 +310,15 @@ if ($action == 'create') {
|
||||
// Chart of accounts type
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
||||
//print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1);
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type'])?GETPOST('pcg_type','alpha'):$object->pcg_type).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts subtype
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
||||
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype'])?GETPOST('pcg_subtype','alpha'):$object->pcg_subtype).'">';
|
||||
//print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@@ -104,8 +104,9 @@ $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($cat_id)) {
|
||||
$return = $accountingcategory->getCptBK($cat_id);
|
||||
if (! empty($cat_id))
|
||||
{
|
||||
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||
}
|
||||
|
||||
@@ -129,6 +129,47 @@ class AccountancyCategory
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select accounting category of an accounting account present in chart of accounts
|
||||
*
|
||||
* @param int $id Id category
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function getAccountsWithNoCategory($id) {
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " GROUP BY aa.account_number, aa.label";
|
||||
$sql .= " ORDER BY aa.account_number, aa.label";
|
||||
|
||||
$this->lines_CptBk = array ();
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
$this->lines_cptbk[] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add an accounting account in an accounting category
|
||||
*
|
||||
|
||||
@@ -47,6 +47,55 @@ class AccountancySystem
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $ref ref
|
||||
* @return int <0 if KO, Id of record if OK and found
|
||||
*/
|
||||
function fetch($rowid = 0, $ref = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($rowid > 0 || $ref)
|
||||
{
|
||||
$sql = "SELECT a.pcg_version, a.label, a.active";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||
$sql .= " WHERE";
|
||||
if ($rowid) {
|
||||
$sql .= " a.rowid = '" . $rowid . "'";
|
||||
} elseif ($ref) {
|
||||
$sql .= " a.pcg_version = '" . $ref . "'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->pcg_version = $obj->pcg_version;
|
||||
$this->ref = $obj->pcg_version;
|
||||
$this->label = $obj->label;
|
||||
$this->active = $obj->active;
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
return - 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert accountancy system name into database
|
||||
*
|
||||
|
||||
@@ -150,12 +150,19 @@ class AccountingAccount extends CommonObject
|
||||
if (isset($this->active))
|
||||
$this->active = trim($this->active);
|
||||
|
||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||
{
|
||||
$this->pcg_type = 'XXXXXX';
|
||||
}
|
||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||
{
|
||||
$this->pcg_subtype = 'XXXXXX';
|
||||
}
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
|
||||
|
||||
$sql .= "datec";
|
||||
$sql .= ", entity";
|
||||
$sql .= ", fk_pcg_version";
|
||||
@@ -167,9 +174,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", fk_accounting_category";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", active";
|
||||
|
||||
$sql .= ") VALUES (";
|
||||
|
||||
$sql .= " '" . $this->db->idate($now) . "'";
|
||||
$sql .= ", " . $conf->entity;
|
||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||
@@ -228,7 +233,18 @@ class AccountingAccount extends CommonObject
|
||||
* @param User $user Use making update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user) {
|
||||
function update($user)
|
||||
{
|
||||
// Check parameters
|
||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||
{
|
||||
$this->pcg_type = 'XXXXXX';
|
||||
}
|
||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||
{
|
||||
$this->pcg_subtype = 'XXXXXX';
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
@@ -241,7 +257,6 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " , fk_accounting_category = '" . $this->account_category . "'";
|
||||
$sql .= " , fk_user_modif = " . $user->id;
|
||||
$sql .= " , active = '" . $this->active . "'";
|
||||
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||
|
||||
@@ -182,11 +182,15 @@ class FormVentilation extends Form
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if ($obj->pcg_type != '-1')
|
||||
{
|
||||
$options[$obj->pcg_type] = $obj->pcg_type;
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
@@ -202,7 +206,8 @@ class FormVentilation extends Form
|
||||
*
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
|
||||
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array())
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT DISTINCT pcg_subtype ";
|
||||
@@ -223,11 +228,15 @@ class FormVentilation extends Form
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if ($obj->pcg_type != '-1')
|
||||
{
|
||||
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200');
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
|
||||
@@ -375,7 +375,7 @@ if (! empty($moreforfilter))
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
|
||||
@@ -751,9 +751,11 @@ if (empty($reshook))
|
||||
|
||||
$db->begin();
|
||||
|
||||
// $tva_tx can be 'x.x (XXX)'
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $tva_tx par celui du produit
|
||||
// Replaces $fk_unit with the product unit
|
||||
if (! empty($idprod)) {
|
||||
$prod = new Product($db);
|
||||
@@ -761,7 +763,7 @@ if (empty($reshook))
|
||||
|
||||
$label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : '');
|
||||
|
||||
// If prices fields are update
|
||||
// Update if prices fields are defined
|
||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
@@ -803,19 +805,21 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price)
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
|
||||
if (! empty($price_ht)) {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tva_tx != $prod->tva_tx) {
|
||||
elseif ($tmpvat != $tmpprodvat) {
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ class Propal extends CommonObject
|
||||
$qty=price2num($qty);
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
$txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
|
||||
@@ -717,7 +717,7 @@ if (empty($reshook))
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $tva_tx par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
if (! empty($idprod)) {
|
||||
$prod = new Product($db);
|
||||
@@ -773,19 +773,21 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price)
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
|
||||
if (! empty($price_ht)) {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tva_tx != $prod->tva_tx) {
|
||||
elseif ($tmpvat != $tmpprodvat) {
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -622,6 +622,7 @@ if ($resql)
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($billed != '') $param.='&billed='.$billed;
|
||||
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
|
||||
@@ -147,7 +147,7 @@ $head=bank_prepare_head($object);
|
||||
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
$title=$langs->trans("FinancialAccount")." : ".$object->label;
|
||||
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
|
||||
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start+1)."'>".img_next('', 'class="valignbottom"')."</a>":"");
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
@@ -829,7 +829,7 @@ if ($mode == 'standard')
|
||||
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
|
||||
|
||||
// For month
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>";
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td align="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
@@ -843,7 +843,7 @@ if ($mode == 'standard')
|
||||
|
||||
// For year
|
||||
$prevyear=$year-1;$nextyear=$year+1;
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next()."</a>";
|
||||
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td align="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td align="center">';
|
||||
|
||||
@@ -1502,7 +1502,7 @@ if (empty($reshook))
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $tva_tx par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
// Replaces $fk_unit with the product's
|
||||
if (! empty($idprod))
|
||||
@@ -1555,23 +1555,26 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// if price ht was forced (ie: from gui when calculated by margin rate and cost price)
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
|
||||
if (! empty($price_ht))
|
||||
{
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tva_tx != $prod->tva_tx)
|
||||
elseif ($tmpvat != $tmpprodvat)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ if (empty($reshook))
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $tva_tx par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
// Replaces $fk_unit with the product's
|
||||
if (! empty($idprod))
|
||||
@@ -511,23 +511,26 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// if price ht was forced (ie: from gui when calculated by margin rate and cost price)
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
|
||||
if (! empty($price_ht))
|
||||
{
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tva_tx != $prod->tva_tx)
|
||||
elseif ($tmpvat != $tmpprodvat)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1594,7 +1594,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ustrd>'.$row_facnumber.'</Ustrd>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
|
||||
return $XML_DEBITOR;
|
||||
|
||||
@@ -407,16 +407,16 @@ if (empty($reshook))
|
||||
// Set if we used free entry or predefined product
|
||||
$predef='';
|
||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
if (GETPOST('prod_entry_mode') == 'free')
|
||||
{
|
||||
$idprod=0;
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$idprod=GETPOST('idprod', 'int');
|
||||
$price_ht = '';
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
@@ -455,13 +455,14 @@ if (empty($reshook))
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $tva_tx par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
if ($idprod > 0)
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idprod);
|
||||
|
||||
// Update if prices fields are defined
|
||||
$tva_tx = get_default_tva($mysoc,$object->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$object->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
@@ -498,17 +499,20 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($tva_tx != $prod->tva_tx)
|
||||
if ($tmpvat != $tmpprodvat)
|
||||
{
|
||||
if ($price_base_type != 'HT')
|
||||
{
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat/100)), 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat/100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +630,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST('cancel'))
|
||||
else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel'))
|
||||
{
|
||||
$objectline = new ContratLigne($db);
|
||||
if ($objectline->fetch(GETPOST('elrowid')))
|
||||
@@ -636,8 +640,26 @@ if (empty($reshook))
|
||||
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
|
||||
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
|
||||
|
||||
$localtax1_tx=get_localtax(GETPOST('eltva_tx'),1,$object->thirdparty);
|
||||
$localtax2_tx=get_localtax(GETPOST('eltva_tx'),2,$object->thirdparty);
|
||||
$vat_rate = GETPOST('eltva_tx');
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
|
||||
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
|
||||
|
||||
$txtva = $vat_rate;
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
// ajout prix d'achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
@@ -653,7 +675,8 @@ if (empty($reshook))
|
||||
$objectline->subprice=GETPOST('elprice');
|
||||
$objectline->qty=GETPOST('elqty');
|
||||
$objectline->remise_percent=GETPOST('elremise_percent');
|
||||
$objectline->tva_tx=GETPOST('eltva_tx')?GETPOST('eltva_tx'):0; // Field may be disabled, so we use vat rate 0
|
||||
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
|
||||
$objectline->vat_src_code=$vat_src_code;
|
||||
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
|
||||
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
|
||||
$objectline->date_ouverture_prevue=$date_start_update;
|
||||
@@ -1444,7 +1467,7 @@ else
|
||||
{
|
||||
print '<form name="update" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateligne">';
|
||||
print '<input type="hidden" name="action" value="updateline">';
|
||||
print '<input type="hidden" name="elrowid" value="'.$object->lines[$cursorline-1]->id.'">';
|
||||
print '<input type="hidden" name="idprod" value="'.(!empty($object->lines[$cursorline-1]->fk_product) ? $object->lines[$cursorline-1]->fk_product : 0).'">';
|
||||
print '<input type="hidden" name="fournprice" value="'.(!empty($object->lines[$cursorline-1]->fk_fournprice) ? $object->lines[$cursorline-1]->fk_fournprice : 0).'">';
|
||||
@@ -1452,8 +1475,8 @@ else
|
||||
// Area with common detail of line
|
||||
print '<table class="notopnoleftnoright allwidth tableforservicepart1" width="100%">';
|
||||
|
||||
$sql = "SELECT cd.rowid, cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty,";
|
||||
$sql.= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice, cd.multicurrency_subprice,";
|
||||
$sql = "SELECT cd.rowid, cd.statut, cd.label as label_det, cd.fk_product, cd.product_type, cd.description, cd.price_ht, cd.qty,";
|
||||
$sql.= " cd.tva_tx, cd.vat_src_code, cd.remise_percent, cd.info_bits, cd.subprice, cd.multicurrency_subprice,";
|
||||
$sql.= " cd.date_ouverture_prevue as date_debut, cd.date_ouverture as date_debut_reelle,";
|
||||
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
|
||||
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
|
||||
@@ -1522,7 +1545,9 @@ else
|
||||
print '<td>'.dol_htmlentitiesbr($objp->description)."</td>\n";
|
||||
}
|
||||
// TVA
|
||||
print '<td align="center">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
||||
print '<td align="center">';
|
||||
print vatrate($objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), '%', $objp->info_bits);
|
||||
print '</td>';
|
||||
// Price
|
||||
print '<td align="right">'.($objp->subprice != '' ? price($objp->subprice) : '')."</td>\n";
|
||||
// Price multicurrency
|
||||
@@ -1655,7 +1680,7 @@ else
|
||||
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->thirdparty);
|
||||
print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1);
|
||||
print '</td>';
|
||||
print '<td align="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||
print '<td align="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>';
|
||||
@@ -1950,7 +1975,7 @@ else
|
||||
print "\n";
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline')?'#add':'#line_'.GETPOST('lineid')).'" method="POST">
|
||||
<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">
|
||||
<input type="hidden" name="action" value="'.(($action != 'editline')?'addline':'updateligne').'">
|
||||
<input type="hidden" name="action" value="'.(($action != 'editline')?'addline':'updateline').'">
|
||||
<input type="hidden" name="mode" value="">
|
||||
<input type="hidden" name="id" value="'.$object->id.'">
|
||||
';
|
||||
|
||||
@@ -1357,7 +1357,14 @@ class Contrat extends CommonObject
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
@@ -1397,7 +1404,7 @@ class Contrat extends CommonObject
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
|
||||
$sql.= " (fk_contrat, label, description, fk_product, qty, tva_tx,";
|
||||
$sql.= " (fk_contrat, label, description, fk_product, qty, tva_tx, vat_src_code,";
|
||||
$sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice,";
|
||||
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc,";
|
||||
$sql.= " info_bits,";
|
||||
@@ -1410,6 +1417,7 @@ class Contrat extends CommonObject
|
||||
$sql.= ($fk_product>0 ? $fk_product : "null").",";
|
||||
$sql.= " ".$qty.",";
|
||||
$sql.= " ".$txtva.",";
|
||||
$sql.= " ".($vat_src_code?"'".$vat_src_code."'":"null").",";
|
||||
$sql.= " ".$txlocaltax1.",";
|
||||
$sql.= " ".$txlocaltax2.",";
|
||||
$sql.= " '".$localtax1_type."',";
|
||||
@@ -2596,6 +2604,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql.= " t.date_fin_validite as date_fin_validite,";
|
||||
$sql.= " t.date_cloture as date_cloture,";
|
||||
$sql.= " t.tva_tx,";
|
||||
$sql.= " t.vat_src_code,";
|
||||
$sql.= " t.localtax1_tx,";
|
||||
$sql.= " t.localtax2_tx,";
|
||||
$sql.= " t.qty,";
|
||||
@@ -2648,6 +2657,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$this->date_fin_validite = $this->db->jdate($obj->date_fin_validite);
|
||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->vat_src_code = $obj->vat_src_code;
|
||||
$this->localtax1_tx = $obj->localtax1_tx;
|
||||
$this->localtax2_tx = $obj->localtax2_tx;
|
||||
$this->qty = $obj->qty;
|
||||
|
||||
@@ -568,6 +568,10 @@ class Conf
|
||||
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
|
||||
}
|
||||
|
||||
if (! empty($this->global->PRODUIT_MULTIPRICES) && empty($this->global->PRODUIT_MULTIPRICES_LIMIT))
|
||||
{
|
||||
$this->global->PRODUIT_MULTIPRICES_LIMIT = 5;
|
||||
}
|
||||
|
||||
// For modules that want to disable top or left menu
|
||||
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;
|
||||
@@ -596,7 +600,7 @@ class Conf
|
||||
}
|
||||
foreach ($handlers as $handler) {
|
||||
$handler_files = array();
|
||||
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $conf->modules_parts['syslog']);
|
||||
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $this->modules_parts['syslog']);
|
||||
foreach ($dirsyslogs as $reldir) {
|
||||
$dir = dol_buildpath($reldir, 0);
|
||||
$newdir = dol_osencode($dir);
|
||||
|
||||
@@ -90,31 +90,35 @@ class FormAccounting
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
print '<select class="flat minwidth200" name="'.$htmlname.'">';
|
||||
$out = '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$i = 0;
|
||||
|
||||
if ($useempty) print '<option value="0"> </option>';
|
||||
if ($useempty) $out.= '<option value="0"> </option>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
if ($obj->rowid == $selected) print ' selected';
|
||||
print '>'.($maxlen ? dol_trunc($obj->type,$maxlen) : $obj->type);
|
||||
print ' ('.$obj->range_account.')';
|
||||
$out .= '<option value="'.$obj->rowid.'"';
|
||||
if ($obj->rowid == $selected) $out .= ' selected';
|
||||
$out .= '>'.($maxlen ? dol_trunc($obj->type,$maxlen) : $obj->type);
|
||||
$out .= ' ('.$obj->range_account.')';
|
||||
$i++;
|
||||
}
|
||||
print '</select>';
|
||||
if ($user->admin && $help) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
$out .= '</select>';
|
||||
//if ($user->admin && $help) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorNoAccountingCategoryForThisCountry",$mysoc->country_code);
|
||||
$out .= $langs->trans("ErrorNoAccountingCategoryForThisCountry",$mysoc->country_code);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$db->lasterror());
|
||||
}
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
print $out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ function dol_include_once($relpath, $classname='')
|
||||
|
||||
|
||||
/**
|
||||
* Return path of url or filesystem. Return alternate root if exists
|
||||
* Return path of url or filesystem. Return alternate root if exists.
|
||||
*
|
||||
* @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile
|
||||
* @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path using same host that current url), 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file)
|
||||
@@ -2234,7 +2234,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
|
||||
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
|
||||
* @param string $stringencoding Tell what is source string encoding
|
||||
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
|
||||
* @param int $display Trunc is use to display and can be changed for small screen
|
||||
* @param int $display Trunc is use to display and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
|
||||
* @return string Truncated string
|
||||
*/
|
||||
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
|
||||
@@ -3963,11 +3963,12 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
|
||||
/**
|
||||
* Return vat rate of a product in a particular selling country or default country vat if product is unknown
|
||||
* Function called by get_default_tva
|
||||
*
|
||||
* @param int $idprod Id of product or 0 if not a predefined product
|
||||
* @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...)
|
||||
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice)
|
||||
* @return float Vat rate
|
||||
* @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)'
|
||||
* @see get_product_localtax_for_country
|
||||
*/
|
||||
function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0)
|
||||
@@ -3995,14 +3996,14 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
|
||||
else
|
||||
{
|
||||
$ret=$product->tva_tx; // Default vat of product we defined
|
||||
if ($product->default_vat_code) $ret.=' ('.$product->default_vat_code.')';
|
||||
}
|
||||
$found=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO Read default product vat according to countrycode and product
|
||||
|
||||
|
||||
// TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet.
|
||||
// May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4010,11 +4011,11 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
|
||||
{
|
||||
if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS))
|
||||
{
|
||||
// If vat of product for the country not found or not defined, we return higher vat of country.
|
||||
// If vat of product for the country not found or not defined, we return the first higher vat of country.
|
||||
$sql = "SELECT taux as vat_rate";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'";
|
||||
$sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC";
|
||||
$sql.= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC";
|
||||
$sql.= $db->plimit(1);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
@@ -4117,7 +4118,7 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller)
|
||||
* @param Societe $thirdparty_buyer Objet societe acheteuse
|
||||
* @param int $idprod Id product
|
||||
* @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice)
|
||||
* @return float Vat rate to use, -1 if we can't guess it
|
||||
* @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)', -1 if we can't guess it
|
||||
* @see get_default_npr, get_default_localtax
|
||||
*/
|
||||
function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
|
||||
|
||||
@@ -719,7 +719,9 @@ function setforfree() {
|
||||
jQuery("#fournprice_predef").hide();
|
||||
jQuery("#title_vat").show();
|
||||
jQuery("#title_up_ht").show();
|
||||
jQuery("#title_up_ht_currency").show();
|
||||
jQuery("#title_up_ttc").show();
|
||||
jQuery("#title_up_ttc_currency").show();
|
||||
jQuery("#np_marginRate").show(); // May no exists
|
||||
jQuery("#np_markRate").show(); // May no exists
|
||||
jQuery(".np_marginRate").show(); // May no exists
|
||||
@@ -739,7 +741,9 @@ function setforpredef() {
|
||||
//jQuery("#fournprice_predef").show(); // management somewhere else
|
||||
jQuery("#title_vat").hide();
|
||||
jQuery("#title_up_ht").hide();
|
||||
jQuery("#title_up_ht_currency").hide();
|
||||
jQuery("#title_up_ttc").hide();
|
||||
jQuery("#title_up_ttc_currency").hide();
|
||||
jQuery("#np_marginRate").hide(); // May no exists
|
||||
jQuery("#np_markRate").hide(); // May no exists
|
||||
jQuery(".np_marginRate").hide(); // May no exists
|
||||
|
||||
@@ -1892,7 +1892,8 @@ class ExpenseReport extends CommonObject
|
||||
if ($option == 'toapprove') $sql.= " WHERE ex.fk_statut = 2";
|
||||
else $sql.= " WHERE ex.fk_statut = 5";
|
||||
$sql.= " AND ex.entity IN (".getEntity('expensereport', 1).")";
|
||||
$sql.= " AND ex.fk_user_author IN (".join(',',$userchildids).")";
|
||||
$sql.= " AND (ex.fk_user_author IN (".join(',',$userchildids).")";
|
||||
$sql.= " OR ex.fk_user_validator IN (".join(',',$userchildids)."))";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
|
||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||
|
||||
|
||||
-- after changing const name, please insure that old constant was rename
|
||||
UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE name = __ENCRYPT('MAIN_THIRPARTY_CREATION_INDIVIDUAL')__; -- under 3.9.0
|
||||
UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE name = __ENCRYPT('MAIN_THIRDPARTY_CREATION_INDIVIDUAL')__; -- under 4.0.1
|
||||
@@ -166,6 +167,7 @@ ALTER TABLE llx_commandedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER
|
||||
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_propaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_supplier_proposaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
|
||||
ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint;
|
||||
|
||||
@@ -251,39 +253,8 @@ ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity);
|
||||
ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer;
|
||||
|
||||
|
||||
-- Product attributes
|
||||
CREATE TABLE llx_product_attribute
|
||||
(
|
||||
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
ref VARCHAR(255) NOT NULL,
|
||||
label VARCHAR(255) NOT NULL,
|
||||
rang INT DEFAULT 0 NOT NULL,
|
||||
entity INT DEFAULT 1 NOT NULL
|
||||
);
|
||||
ALTER TABLE llx_product_attribute ADD CONSTRAINT unique_ref UNIQUE (ref);
|
||||
CREATE TABLE llx_product_attribute_combination
|
||||
(
|
||||
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
fk_product_parent INT NOT NULL,
|
||||
fk_product_child INT NOT NULL,
|
||||
variation_price FLOAT NOT NULL,
|
||||
variation_price_percentage INT NULL,
|
||||
variation_weight FLOAT NOT NULL,
|
||||
entity INT DEFAULT 1 NOT NULL
|
||||
);
|
||||
CREATE TABLE llx_product_attribute_combination2val
|
||||
(
|
||||
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
fk_prod_combination INT NOT NULL,
|
||||
fk_prod_attr INT NOT NULL,
|
||||
fk_prod_attr_val INT NOT NULL
|
||||
);
|
||||
CREATE TABLE llx_product_attribute_value
|
||||
(
|
||||
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||
fk_product_attribute INT NOT NULL,
|
||||
ref VARCHAR(255) DEFAULT NULL,
|
||||
value VARCHAR(255) DEFAULT NULL,
|
||||
entity INT DEFAULT 1 NOT NULL
|
||||
);
|
||||
ALTER TABLE llx_product_attribute_value ADD CONSTRAINT unique_ref UNIQUE (fk_product_attribute,ref);
|
||||
UPDATE llx_accounting_account set account_parent = 0 where account_parent = '';
|
||||
|
||||
ALTER TABLE llx_product_price ADD COLUMN default_vat_code varchar(10) after tva_tx;
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10) after tva_tx;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ create table llx_accounting_account
|
||||
pcg_type varchar(20) NOT NULL,
|
||||
pcg_subtype varchar(20) NOT NULL,
|
||||
account_number varchar(32) NOT NULL,
|
||||
account_parent varchar(32) DEFAULT '0', -- Hierarchic parent
|
||||
account_parent varchar(32) DEFAULT '0', -- Hierarchic parent TODO Move this as integer, it is a foreign key of llx_accounting_account.rowid
|
||||
label varchar(255) NOT NULL,
|
||||
fk_accounting_category integer DEFAULT 0,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
|
||||
@@ -37,6 +37,7 @@ create table llx_contratdet
|
||||
date_fin_validite datetime,
|
||||
date_cloture datetime,
|
||||
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- local tax 1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
|
||||
@@ -923,7 +923,7 @@ Host=Server
|
||||
DriverType=Driver type
|
||||
SummarySystem=System information summary
|
||||
SummaryConst=List of all Dolibarr setup parameters
|
||||
MenuCompanySetup=Company/Foundation
|
||||
MenuCompanySetup=Company/Organisation
|
||||
DefaultMenuManager= Standard menu manager
|
||||
DefaultMenuSmartphoneManager=Smartphone menu manager
|
||||
Skin=Skin theme
|
||||
@@ -937,8 +937,8 @@ PermanentLeftSearchForm=Permanent search form on left menu
|
||||
DefaultLanguage=Default language to use (language code)
|
||||
EnableMultilangInterface=Enable multilingual interface
|
||||
EnableShowLogo=Show logo on left menu
|
||||
CompanyInfo=Company/foundation information
|
||||
CompanyIds=Company/foundation identities
|
||||
CompanyInfo=Company/organisation information
|
||||
CompanyIds=Company/organisation identities
|
||||
CompanyName=Name
|
||||
CompanyAddress=Address
|
||||
CompanyZip=Zip
|
||||
@@ -971,8 +971,8 @@ Delays_MAIN_DELAY_MEMBERS=Tolerance delay (in days) before alert on delayed memb
|
||||
Delays_MAIN_DELAY_CHEQUES_TO_DEPOSIT=Tolerance delay (in days) before alert for cheques deposit to do
|
||||
Delays_MAIN_DELAY_EXPENSEREPORTS=Tolerance delay (in days) before alert for expense reports to approve
|
||||
SetupDescription1=The setup area is for initial setup parameters before starting to use Dolibarr.
|
||||
SetupDescription2=The two most important setup steps are the first two in the setup menu on the left: Company/foundation setup page and Modules setup page:
|
||||
SetupDescription3=Parameters in menu <a href="%s">Setup -> Company/foundation</a> are required because submitted data are used on Dolibarr displays and to customize the default behaviour of the software (for country-related features for example).
|
||||
SetupDescription2=The two most important setup steps are the first two in the setup menu on the left: Company/Organisation setup page and Modules setup page:
|
||||
SetupDescription3=Parameters in menu <a href="%s">Setup -> Company/Organisation</a> are required because submitted data are used on Dolibarr displays and to customize the default behaviour of the software (for country-related features for example).
|
||||
SetupDescription4=Parameters in menu <a href="%s">Setup -> Modules</a> are required because Dolibarr is not a monolithic ERP/CRM but a collection of several modules, all more or less independent. New features will be added to menus for every module you'll enable.
|
||||
SetupDescription5=Other menu entries manage optional parameters.
|
||||
LogEvents=Security audit events
|
||||
@@ -1466,7 +1466,7 @@ SupposedToBeInvoiceDate=Invoice date used
|
||||
Buy=Buy
|
||||
Sell=Sell
|
||||
InvoiceDateUsed=Invoice date used
|
||||
YourCompanyDoesNotUseVAT=Your company has been defined to not use VAT (Home - Setup - Company/Foundation), so there is no VAT options to setup.
|
||||
YourCompanyDoesNotUseVAT=Your company has been defined to not use VAT (Home - Setup - Company/Organisation), so there is no VAT options to setup.
|
||||
AccountancyCode=Accountancy Code
|
||||
AccountancyCodeSell=Sale account. code
|
||||
AccountancyCodeBuy=Purchase account. code
|
||||
@@ -1660,6 +1660,7 @@ SamePriceAlsoForSharedCompanies=If you use a multicompany module, with the choic
|
||||
ModuleEnabledAdminMustCheckRights=Module has been activated. Permissions for activated module(s) were given to admin users only. You may need to grant permissions to other users or groups manually if necessary.
|
||||
UserHasNoPermissions=This user has no permission defined
|
||||
TypeCdr=Use "None" if the date of payment term is date of invoice plus a delta in days (delta is field "Nb of days")<br>Use "At end of month", if, after delta, the date must be increased to reach the end of month (+ an optional "Offset" in days)<br>Use "Current/Next" to have payment term date being the first Nth of the month (N is stored into field "Nb of days")
|
||||
BaseCurrency=Reference currency of the company (go into setup of company to change this)
|
||||
##### Resource ####
|
||||
ResourceSetup=Configuration du module Resource
|
||||
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
||||
|
||||
@@ -38,7 +38,6 @@ ThirdPartyCustomersStats=Customers
|
||||
ThirdPartyCustomersWithIdProf12=Customers with %s or %s
|
||||
ThirdPartySuppliers=Suppliers
|
||||
ThirdPartyType=Third party type
|
||||
Company/Fundation=Company/Foundation
|
||||
Individual=Private individual
|
||||
ToCreateContactWithSameName=Will create automatically a contact/address with same information than third party under the third party. In most cases, even if your third party is a physical people, creating a third party alone is enough.
|
||||
ParentCompany=Parent company
|
||||
|
||||
@@ -13,8 +13,8 @@ LTReportBuildWithOptionDefinedInModule=Amounts shown here are calculated using r
|
||||
Param=Setup
|
||||
RemainingAmountPayment=Amount payment remaining :
|
||||
Account=Account
|
||||
Accountparent=Account parent
|
||||
Accountsparent=Accounts parent
|
||||
Accountparent=Parent account
|
||||
Accountsparent=Parent accounts
|
||||
Income=Income
|
||||
Outcome=Expense
|
||||
ReportInOut=Income / Expense
|
||||
|
||||
@@ -43,7 +43,7 @@ ErrorConstantNotDefined=Parameter %s not defined
|
||||
ErrorUnknown=Unknown error
|
||||
ErrorSQL=SQL Error
|
||||
ErrorLogoFileNotFound=Logo file '%s' was not found
|
||||
ErrorGoToGlobalSetup=Go to 'Company/Foundation' setup to fix this
|
||||
ErrorGoToGlobalSetup=Go to 'Company/Organisation' setup to fix this
|
||||
ErrorGoToModuleSetup=Go to Module setup to fix this
|
||||
ErrorFailedToSendMail=Failed to send mail (sender=%s, receiver=%s)
|
||||
ErrorFileNotUploaded=File was not uploaded. Check that size does not exceed maximum allowed, that free space is available on disk and that there is not already a file with same name in this directory.
|
||||
@@ -388,7 +388,7 @@ ActionRunningNotStarted=To start
|
||||
ActionRunningShort=In progress
|
||||
ActionDoneShort=Finished
|
||||
ActionUncomplete=Uncomplete
|
||||
CompanyFoundation=Company/Foundation
|
||||
CompanyFoundation=Company/Organisation
|
||||
ContactsForCompany=Contacts for this third party
|
||||
ContactsAddressesForCompany=Contacts/addresses for this third party
|
||||
AddressesForCompany=Addresses for this third party
|
||||
|
||||
@@ -12,7 +12,7 @@ ListOfFees=List of fees
|
||||
TypeFees=Types of fees
|
||||
ShowTrip=Show expense report
|
||||
NewTrip=New expense report
|
||||
CompanyVisited=Company/foundation visited
|
||||
CompanyVisited=Company/organisation visited
|
||||
FeesKilometersOrAmout=Amount or kilometers
|
||||
DeleteTrip=Delete expense report
|
||||
ConfirmDeleteTrip=Are you sure you want to delete this expense report?
|
||||
|
||||
@@ -66,8 +66,8 @@ InternalUser=Internal user
|
||||
ExportDataset_user_1=Dolibarr's users and properties
|
||||
DomainUser=Domain user %s
|
||||
Reactivate=Reactivate
|
||||
CreateInternalUserDesc=This form allows you to create an user internal to your company/foundation. To create an external user (customer, supplier, ...), use the button 'Create Dolibarr user' from third party's contact card.
|
||||
InternalExternalDesc=An <b>internal</b> user is a user that is part of your company/foundation.<br>An <b>external</b> user is a customer, supplier or other.<br><br>In both cases, permissions defines rights on Dolibarr, also external user can have a different menu manager than internal user (See Home - Setup - Display)
|
||||
CreateInternalUserDesc=This form allows you to create an user internal to your company/organisation. To create an external user (customer, supplier, ...), use the button 'Create Dolibarr user' from third party's contact card.
|
||||
InternalExternalDesc=An <b>internal</b> user is a user that is part of your company/organisation.<br>An <b>external</b> user is a customer, supplier or other.<br><br>In both cases, permissions defines rights on Dolibarr, also external user can have a different menu manager than internal user (See Home - Setup - Display)
|
||||
PermissionInheritedFromAGroup=Permission granted because inherited from one of a user's group.
|
||||
Inherited=Inherited
|
||||
UserWillBeInternalUser=Created user will be an internal user (because not linked to a particular third party)
|
||||
|
||||
@@ -646,13 +646,16 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($tva_tx != $object->tva_tx) {
|
||||
if ($tmpvat != $tmpprodvat) {
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1437,9 +1437,9 @@ class Product extends CommonObject
|
||||
if (empty($this->price_by_qty)) $this->price_by_qty=0;
|
||||
|
||||
// Add new price
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell, tva_tx, recuperableonly,";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,";
|
||||
$sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) ";
|
||||
$sql.= " VALUES(".($level?$level:1).", '".$this->db->idate($now)."',".$this->id.",".$user->id.",".$this->price.",".$this->price_ttc.",'".$this->price_base_type."',".$this->status.",".$this->tva_tx.",".$this->tva_npr.",";
|
||||
$sql.= " VALUES(".($level?$level:1).", '".$this->db->idate($now)."',".$this->id.",".$user->id.",".$this->price.",".$this->price_ttc.",'".$this->price_base_type."',".$this->status.",".$this->tva_tx.", ".($this->default_vat_code?("'".$this->default_vat_code."'"):"null").",".$this->tva_npr.",";
|
||||
$sql.= " ".$this->localtax1_tx.", ".$this->localtax2_tx.", '".$this->localtax1_type."', '".$this->localtax2_type."', ".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity.",".($this->fk_price_expression > 0?$this->fk_price_expression:'null');
|
||||
$sql.= ")";
|
||||
|
||||
@@ -1940,7 +1940,7 @@ class Product extends CommonObject
|
||||
for ($i=1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
|
||||
{
|
||||
$sql = "SELECT price, price_ttc, price_min, price_min_ttc,";
|
||||
$sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid, recuperableonly";
|
||||
$sql.= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price";
|
||||
$sql.= " WHERE entity IN (".getEntity('productprice', 1).")";
|
||||
$sql.= " AND price_level=".$i;
|
||||
@@ -1957,7 +1957,8 @@ class Product extends CommonObject
|
||||
$this->multiprices_min[$i]=$result["price_min"];
|
||||
$this->multiprices_min_ttc[$i]=$result["price_min_ttc"];
|
||||
$this->multiprices_base_type[$i]=$result["price_base_type"];
|
||||
$this->multiprices_tva_tx[$i]=$result["tva_tx"];
|
||||
// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
|
||||
$this->multiprices_tva_tx[$i]=$result["tva_tx"]; // TODO Add ' ('.$result['default_vat_code'].')'
|
||||
$this->multiprices_recuperableonly[$i]=$result["recuperableonly"];
|
||||
|
||||
// Price by quantity
|
||||
@@ -2003,7 +2004,7 @@ class Product extends CommonObject
|
||||
} else if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
$sql = "SELECT price, price_ttc, price_min, price_min_ttc,";
|
||||
$sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid";
|
||||
$sql.= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price";
|
||||
$sql.= " WHERE fk_product = '".$this->id."'";
|
||||
$sql.= " ORDER BY date_price DESC, rowid DESC";
|
||||
|
||||
@@ -88,7 +88,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_soc = '';
|
||||
}
|
||||
@@ -1089,15 +1089,15 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// VAT
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>';
|
||||
print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Price base
|
||||
print '<tr><td width="20%">';
|
||||
print '<tr><td>';
|
||||
print $langs->trans('PriceBase');
|
||||
print '</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
print $form->selectPriceBaseType($object->price_base_type, "price_base_type");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@@ -1105,7 +1105,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
// Only show price mode and expression selector if module is enabled
|
||||
if (! empty($conf->dynamicprices->enabled)) {
|
||||
// Price mode selector
|
||||
print '<tr><td>'.$langs->trans("PriceMode").'</td><td colspan="2">';
|
||||
print '<tr><td>'.$langs->trans("PriceMode").'</td><td>';
|
||||
$price_expression = new PriceExpression($db);
|
||||
$price_expression_list = array(0 => $langs->trans("PriceNumeric")); //Put the numeric mode as first option
|
||||
foreach ($price_expression->list_price_expression() as $entry) {
|
||||
@@ -1141,10 +1141,10 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
// Price
|
||||
$product = new Product($db);
|
||||
$product->fetch($id, $ref, '', 1); //Ignore the math expression when getting the price
|
||||
print '<tr id="price_numeric"><td width="20%">';
|
||||
print '<tr id="price_numeric"><td>';
|
||||
$text = $langs->trans('SellingPrice');
|
||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||
print '</td><td colspan="2">';
|
||||
print '</td><td>';
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
print '<input name="price" size="10" value="' . price($product->price_ttc) . '">';
|
||||
} else {
|
||||
@@ -1156,21 +1156,17 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans('MinPrice');
|
||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||
print '</td><td';
|
||||
if (empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) {
|
||||
print ' colspan="2"';
|
||||
}
|
||||
print '>';
|
||||
print '</td><td>';
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
print '<input name="price_min" size="10" value="' . price($object->price_min_ttc) . '">';
|
||||
} else {
|
||||
print '<input name="price_min" size="10" value="' . price($object->price_min) . '">';
|
||||
}
|
||||
print '</td>';
|
||||
if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
||||
{
|
||||
print '<td align="left">'.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
|
||||
print ' '.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'</td>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -1314,7 +1310,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
|
||||
if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_price') && ! in_array($action, array('edit_price','edit_vat')))
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.recuperableonly,";
|
||||
$sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.recuperableonly,";
|
||||
$sql .= " p.price_level, p.price_min, p.price_min_ttc,p.price_by_qty,";
|
||||
$sql .= " p.date_price as dp, p.fk_price_expression, u.rowid as user_id, u.login";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_price as p,";
|
||||
@@ -1349,8 +1345,10 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
// Log of previous customer prices
|
||||
$backbutton='<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Back") . '</a>';
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png');
|
||||
else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png');
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"), 0, $_SERVER["PHP_SELF"], '', '', '', $backbutton, $num, $num, 'title_accountancy.png');
|
||||
else print_barre_liste($langs->trans("PriceByCustomerLog"), 0, $_SERVER["PHP_SELF"], '', '', '', '', $num, $num, 'title_accountancy.png');
|
||||
//if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png');
|
||||
//else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png');
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@@ -1404,7 +1402,16 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
}
|
||||
|
||||
print '<td align="center">' . $langs->trans($objp->price_base_type) . "</td>";
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">' . vatrate($objp->tva_tx, true, $objp->recuperableonly) . "</td>";
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->default_vat_code)
|
||||
{
|
||||
print vatrate($objp->tva_tx, true) . ' ('.$objp->default_vat_code.')';
|
||||
}
|
||||
else print vatrate($objp->tva_tx, true, $objp->recuperableonly);
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Price
|
||||
if (! empty($objp->fk_price_expression) && ! empty($conf->dynamicprices->enabled))
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<br>
|
||||
<?php echo $langs->trans("ThirdPartyType") ?>:
|
||||
<input type="radio" id="radiocompany" class="flat" name="private" value="0" checked>
|
||||
<?php echo $langs->trans("Company/Fundation"); ?>
|
||||
<?php echo $langs->trans("CompanyFoundation"); ?>
|
||||
<input type="radio" id="radioprivate" class="flat" name="private" value="1"> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<br>
|
||||
<?php echo $langs->trans("ThirdPartyType") ?>:
|
||||
<input type="radio" id="radiocompany" class="flat" name="private" value="0">
|
||||
<?php echo $langs->trans("Company/Fundation"); ?>
|
||||
<?php echo $langs->trans("CompanyFoundation"); ?>
|
||||
<input type="radio" id="radioprivate" class="flat" name="private" value="1" checked> <?php echo $langs->trans("Individual"); ?> (<?php echo $langs->trans("ToCreateContactWithSameName") ?>)
|
||||
<br>
|
||||
<br>
|
||||
|
||||
Reference in New Issue
Block a user