Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
6115093d8f
@ -104,9 +104,9 @@ if (! $sortfield) $sortfield='b.datev, b.dateo, b.rowid';
|
||||
|
||||
$mode_balance_ok=false;
|
||||
//if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected
|
||||
if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid'))
|
||||
if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid'))
|
||||
{
|
||||
$sortfield = 'b.datev, b.dateo, b.rowid';
|
||||
$sortfield = 'b.datev,b.dateo,b.rowid';
|
||||
if ($id > 0 || ! empty($ref) || $account > 0) $mode_balance_ok = true;
|
||||
}
|
||||
if (strtolower($sortorder) == 'desc') $mode_balance_ok = false;
|
||||
@ -887,7 +887,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev, b.dateo, b.rowid','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev,b.dateo,b.rowid','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'],$_SERVER['PHP_SELF'],'b.num_chq','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
|
||||
@ -1065,7 +1065,7 @@ if ($resql)
|
||||
$bankstatic->id=$banklinestatic->fk_account;
|
||||
$bankstatic->label=$banklinestatic->bank_account_ref;
|
||||
print ' ('.$langs->trans("TransferFrom").' ';
|
||||
print $bankstatic->getNomUrl(1,'transactions');
|
||||
print $bankstatic->getNomUrl(1);
|
||||
print ' '.$langs->trans("toward").' ';
|
||||
$bankstatic->id=$objp->bankid;
|
||||
$bankstatic->label=$objp->bankref;
|
||||
@ -1082,7 +1082,7 @@ if ($resql)
|
||||
$banklinestatic->fetch($links[$key]['url_id']);
|
||||
$bankstatic->id=$banklinestatic->fk_account;
|
||||
$bankstatic->label=$banklinestatic->bank_account_ref;
|
||||
print $bankstatic->getNomUrl(1,'transactions');
|
||||
print $bankstatic->getNomUrl(1);
|
||||
print ')';
|
||||
}
|
||||
//var_dump($links);
|
||||
|
||||
@ -925,7 +925,8 @@ class Account extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->lasterror;
|
||||
$this->errors[]=$this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,8 @@ $arrayfields=array(
|
||||
'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled),
|
||||
'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled),
|
||||
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
|
||||
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0),
|
||||
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
|
||||
@ -121,7 +122,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_label='';
|
||||
@ -142,7 +143,7 @@ $title=$langs->trans('BankAccounts');
|
||||
// Load array of financial accounts (opened by default)
|
||||
$accounts = array();
|
||||
|
||||
$sql = "SELECT rowid, label, courant, rappro, account_number, fk_accountancy_journal, datec as date_creation, tms as date_update";
|
||||
$sql = "SELECT rowid, label, courant, rappro, account_number, fk_accountancy_journal, currency_code, datec as date_creation, tms as date_update";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
@ -337,6 +338,12 @@ if (! empty($arrayfields['toreconcile']['checked']))
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Currency
|
||||
if (! empty($arrayfields['b.currency_code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -407,6 +414,7 @@ if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titr
|
||||
if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.fk_accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.fk_accountancy_journal','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.currency_code']['checked'])) print_liste_field_titre($arrayfields['b.currency_code']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
@ -442,19 +450,19 @@ foreach ($accounts as $key=>$type)
|
||||
|
||||
$found++;
|
||||
|
||||
$acc = new Account($db);
|
||||
$acc->fetch($key);
|
||||
$obj = new Account($db);
|
||||
$obj->fetch($key);
|
||||
|
||||
$var = !$var;
|
||||
$solde = $acc->solde(1);
|
||||
$solde = $obj->solde(1);
|
||||
|
||||
if (! empty($lastcurrencycode) && $lastcurrencycode != $acc->currency_code)
|
||||
if (! empty($lastcurrencycode) && $lastcurrencycode != $obj->currency_code)
|
||||
{
|
||||
$lastcurrencycode='various'; // We found several different currencies
|
||||
}
|
||||
if ($lastcurrencycode != 'various')
|
||||
{
|
||||
$lastcurrencycode=$acc->currency_code;
|
||||
$lastcurrencycode=$obj->currency_code;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -462,14 +470,14 @@ foreach ($accounts as $key=>$type)
|
||||
// Ref
|
||||
if (! empty($arrayfields['b.ref']['checked']))
|
||||
{
|
||||
print '<td>'.$acc->getNomUrl(1).'</td>';
|
||||
print '<td>'.$obj->getNomUrl(1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label
|
||||
if (! empty($arrayfields['b.label']['checked']))
|
||||
{
|
||||
print '<td>'.$acc->label.'</td>';
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -477,7 +485,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! empty($arrayfields['accountype']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $acc->type_lib[$acc->type];
|
||||
print $obj->type_lib[$obj->type];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -485,7 +493,7 @@ foreach ($accounts as $key=>$type)
|
||||
// Number
|
||||
if (! empty($arrayfields['b.number']['checked']))
|
||||
{
|
||||
print '<td>'.$acc->number.'</td>';
|
||||
print '<td>'.$obj->number.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -496,12 +504,12 @@ foreach ($accounts as $key=>$type)
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('',$acc->account_number);
|
||||
$accountingaccount->fetch('',$obj->account_number);
|
||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $acc->account_number;
|
||||
print $obj->account_number;
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
@ -514,7 +522,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($acc->fk_accountancy_journal);
|
||||
$accountingjournal->fetch($obj->fk_accountancy_journal);
|
||||
print $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
else
|
||||
@ -525,15 +533,24 @@ foreach ($accounts as $key=>$type)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Currency
|
||||
if (! empty($arrayfields['b.currency_code']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $obj->currency_code;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Transactions to reconcile
|
||||
if (! empty($arrayfields['toreconcile']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($acc->rappro)
|
||||
if ($obj->rappro)
|
||||
{
|
||||
$result=$acc->load_board($user,$acc->id);
|
||||
$result=$obj->load_board($user,$obj->id);
|
||||
if ($result<0) {
|
||||
setEventMessages($acc->error, $acc->errors, 'errors');
|
||||
setEventMessages($obj->error, $obj->errors, 'errors');
|
||||
} else {
|
||||
print $result->nbtodo;
|
||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||
@ -570,7 +587,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! empty($arrayfields['b.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($acc->date_creation, 'dayhour');
|
||||
print dol_print_date($obj->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -578,7 +595,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! empty($arrayfields['b.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($acc->date_update, 'dayhour');
|
||||
print dol_print_date($obj->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -586,7 +603,7 @@ foreach ($accounts as $key=>$type)
|
||||
// Status
|
||||
if (! empty($arrayfields['b.clos']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$acc->getLibStatut(5).'</td>';
|
||||
print '<td align="center">'.$obj->getLibStatut(5).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -594,7 +611,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$acc->id.'">'.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -1, $obj->currency_code).'</a>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
|
||||
@ -614,7 +631,7 @@ foreach ($accounts as $key=>$type)
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$total[$acc->currency_code] += $solde;
|
||||
$total[$obj->currency_code] += $solde;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -30,8 +30,7 @@ require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
$langs->loadLangs(array("banks", "categories", "multicurrency"));
|
||||
|
||||
if (! $user->rights->banque->transfer)
|
||||
accessforbidden();
|
||||
@ -44,14 +43,14 @@ $error = 0;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add_confirm')
|
||||
if ($action == 'add')
|
||||
{
|
||||
$langs->load("errors");
|
||||
|
||||
$dateo = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||
$label = GETPOST('label','alpha');
|
||||
$amount= GETPOST('amount');
|
||||
$amount_to= GETPOST('amount_to');
|
||||
$amountto= GETPOST('amountto');
|
||||
|
||||
if (! $label)
|
||||
{
|
||||
@ -83,7 +82,17 @@ if ($action == 'add_confirm')
|
||||
$accountto=new Account($db);
|
||||
$accountto->fetch(GETPOST('account_to','int'));
|
||||
|
||||
if ($accountto->id != $accountfrom->id)
|
||||
if ($accountto->currency_code == $accountfrom->currency_code) {
|
||||
$amountto=$amount;
|
||||
} else {
|
||||
if (! $amountto)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AmountTo")), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (($accountto->id != $accountfrom->id) && empty($error))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
@ -103,8 +112,7 @@ if ($action == 'add_confirm')
|
||||
|
||||
if (! $error) $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1*price2num($amount), '', '', $user);
|
||||
if (! ($bank_line_id_from > 0)) $error++;
|
||||
if ((! $error) && ($accountto->currency_code == $accountfrom->currency_code)) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amount), '', '', $user);
|
||||
if ((! $error) && ($accountto->currency_code != $accountfrom->currency_code)) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amount_to), '', '', $user);
|
||||
if (! $error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amountto), '', '', $user);
|
||||
if (! ($bank_line_id_to > 0)) $error++;
|
||||
|
||||
if (! $error) $result=$accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
@ -114,7 +122,7 @@ if ($action == 'add_confirm')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesgs = $langs->trans("TransferFromToDone","<a href=\"card.php?id=".$accountfrom->id."\">".$accountfrom->label."</a>","<a href=\"card.php?id=".$accountto->id."\">".$accountto->label."</a>",$amount,$langs->transnoentities("Currency".$conf->currency));
|
||||
$mesgs = $langs->trans("TransferFromToDone",'<a href="bankentries.php?id='.$accountfrom->id.'&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc">'.$accountfrom->label."</a>",'<a href="bankentries.php?id='.$accountto->id.'">'.$accountto->label."</a>",$amount,$langs->transnoentities("Currency".$conf->currency));
|
||||
setEventMessages($mesgs, null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
@ -139,6 +147,58 @@ if ($action == 'add_confirm')
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
print ' <script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(".selectbankaccount").change(function() {
|
||||
var account1 = $("#selectaccount_from").val();
|
||||
var account2 = $("#selectaccount_to").val();
|
||||
var currencycode1="";
|
||||
var currencycode2="";
|
||||
|
||||
$.get("'.DOL_URL_ROOT.'/core/ajax/getaccountcurrency.php", {id: account1})
|
||||
.done(function( data ) {
|
||||
if (data != null)
|
||||
{
|
||||
var item= $.parseJSON(data);
|
||||
if (item.num==-1) {
|
||||
console.error("Error: "+item.error);
|
||||
} else if (item.num!==0) {
|
||||
currencycode1 = item.value;
|
||||
}
|
||||
|
||||
$.get("'.DOL_URL_ROOT.'/core/ajax/getaccountcurrency.php", {id: account2})
|
||||
.done(function( data ) {
|
||||
if (data != null)
|
||||
{
|
||||
var item=$.parseJSON(data);
|
||||
if (item.num==-1) {
|
||||
console.error("Error: "+item.error);
|
||||
} else if (item.num!==0) {
|
||||
currencycode2 = item.value;
|
||||
}
|
||||
|
||||
if (currencycode2!==currencycode1 && currencycode2!=="" && currencycode1!=="") {
|
||||
$(".multicurrency").show();
|
||||
} else {
|
||||
$(".multicurrency").hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.error("Error: Ajax url has returned an empty page. Should be an empty json array.");
|
||||
}
|
||||
}).fail(function( data ) {
|
||||
console.error("Error: has returned an empty page. Should be an empty json array.");
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.error("Error: has returned an empty page. Should be an empty json array.");
|
||||
}
|
||||
}).fail(function( data ) {
|
||||
console.error("Error: has returned an empty page. Should be an empty json array.");
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
@ -146,9 +206,8 @@ $account_from='';
|
||||
$account_to='';
|
||||
$label='';
|
||||
$amount='';
|
||||
$amount_to='';
|
||||
|
||||
if ($error)
|
||||
if($error)
|
||||
{
|
||||
$account_from = GETPOST('account_from','int');
|
||||
$account_to = GETPOST('account_to','int');
|
||||
@ -164,21 +223,21 @@ print "<br><br>";
|
||||
print '<form name="add" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<input type="hidden" name="action" value="add_confirm">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo").'</td><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td><td>'.$langs->trans("Amount").'</td>';
|
||||
print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("Amount").'</td>';
|
||||
print '<td style="display:none" class="multicurrency">'.$langs->trans("AmountToOthercurrency").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=false;
|
||||
print '<tr class="oddeven"><td>';
|
||||
$form->select_comptes($account_from,'account_from',0,'',1);
|
||||
$form->select_comptes($account_from, 'account_from', 0, '', 1, '', empty($conf->multicurrency->enabled)?0:1);
|
||||
print "</td>";
|
||||
|
||||
print "<td>\n";
|
||||
$form->select_comptes($account_to,'account_to',0,'',1);
|
||||
$form->select_comptes($account_to, 'account_to', 0, '', 1, '', empty($conf->multicurrency->enabled)?0:1);
|
||||
print "</td>\n";
|
||||
|
||||
print "<td>";
|
||||
@ -186,6 +245,8 @@ $form->select_date((! empty($dateo)?$dateo:''),'','','','','add');
|
||||
print "</td>\n";
|
||||
print '<td><input name="label" class="flat quatrevingtpercent" type="text" value="'.$label.'"></td>';
|
||||
print '<td><input name="amount" class="flat" type="text" size="6" value="'.$amount.'"></td>';
|
||||
print '<td style="display:none" class="multicurrency"><input name="amountto" class="flat" type="text" size="6" value="'.$amountto.'"></td>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></div>';
|
||||
|
||||
60
htdocs/core/ajax/getaccountcurrency.php
Normal file
60
htdocs/core/ajax/getaccountcurrency.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/ajax/vatrates.php
|
||||
* \brief File to load vat rates combobox
|
||||
*/
|
||||
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
top_httphead();
|
||||
|
||||
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
||||
|
||||
// Load original field value
|
||||
if (! empty($id))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$account=new Account($db);
|
||||
$result = $account->fetch($id);
|
||||
if ($result<0) {
|
||||
$return['value'] = '';
|
||||
$return['num'] = $result;
|
||||
$return['error'] = $account->errors[0];
|
||||
} else {
|
||||
$return['value'] = $account->currency_code;
|
||||
$return['num'] = $result;
|
||||
$return['error'] = '';
|
||||
}
|
||||
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
@ -3306,21 +3306,22 @@ class Form
|
||||
/**
|
||||
* Return a HTML select list of bank accounts
|
||||
*
|
||||
* @param string $selected Id account pre-selected
|
||||
* @param string $htmlname Name of select zone
|
||||
* @param int $statut Status of searched accounts (0=open, 1=closed, 2=both)
|
||||
* @param string $filtre To filter list
|
||||
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||
* @param string $moreattrib To add more attribute on select
|
||||
* @param string $selected Id account pre-selected
|
||||
* @param string $htmlname Name of select zone
|
||||
* @param int $statut Status of searched accounts (0=open, 1=closed, 2=both)
|
||||
* @param string $filtre To filter list
|
||||
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||
* @param string $moreattrib To add more attribute on select
|
||||
* @param int $showcurrency Show currency in label
|
||||
* @return void
|
||||
*/
|
||||
function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0,$moreattrib='')
|
||||
function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0,$moreattrib='',$showcurrency=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
$sql = "SELECT rowid, label, bank, clos as status";
|
||||
$sql = "SELECT rowid, label, bank, clos as status, currency_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE entity IN (".getEntity('bank_account').")";
|
||||
if ($statut != 2) $sql.= " AND clos = '".$statut."'";
|
||||
@ -3353,6 +3354,7 @@ class Form
|
||||
print '<option value="'.$obj->rowid.'">';
|
||||
}
|
||||
print trim($obj->label);
|
||||
if ($showcurrency) print ' ('.$obj->currency_code.')';
|
||||
if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
|
||||
print '</option>';
|
||||
$i++;
|
||||
|
||||
@ -55,7 +55,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
// Proposals to order
|
||||
if ($action == 'PROPAL_CLOSE_SIGNED')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -74,7 +74,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
// Order to invoice
|
||||
if ($action == 'ORDER_CLOSE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
@ -90,12 +90,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Order classify billed proposal
|
||||
if ($action == 'ORDER_CLASSIFY_BILLED')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL))
|
||||
{
|
||||
$object->fetchObjectLinked('','propal',$object->id,$object->element);
|
||||
@ -106,8 +104,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
{
|
||||
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if ($totalonlinkedelements == $object->total_ht)
|
||||
dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
|
||||
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
|
||||
{
|
||||
foreach($object->linkedObjects['propal'] as $element)
|
||||
{
|
||||
@ -119,11 +117,35 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
// classify billed order
|
||||
// classify billed order & billed propososal
|
||||
if ($action == 'BILL_VALIDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
||||
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
|
||||
// First classify billed the order to allow the proposal classify process
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
|
||||
{
|
||||
$object->fetchObjectLinked('','commande',$object->id,$object->element);
|
||||
if (! empty($object->linkedObjects))
|
||||
{
|
||||
$totalonlinkedelements=0;
|
||||
foreach($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
|
||||
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
|
||||
{
|
||||
foreach($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
$ret=$element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// Second classify billed the proposal.
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL))
|
||||
{
|
||||
$object->fetchObjectLinked('','propal',$object->id,$object->element);
|
||||
@ -134,8 +156,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
{
|
||||
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if ($totalonlinkedelements == $object->total_ht)
|
||||
dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
|
||||
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
|
||||
{
|
||||
foreach($object->linkedObjects['propal'] as $element)
|
||||
{
|
||||
@ -145,34 +167,13 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
|
||||
{
|
||||
$object->fetchObjectLinked('','commande',$object->id,$object->element);
|
||||
if (! empty($object->linkedObjects))
|
||||
{
|
||||
$totalonlinkedelements=0;
|
||||
foreach($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if ($totalonlinkedelements == $object->total_ht)
|
||||
{
|
||||
foreach($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
$ret=$element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Invoice classify billed order
|
||||
if ($action == 'BILL_PAYED')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER))
|
||||
{
|
||||
@ -184,8 +185,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
{
|
||||
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
|
||||
}
|
||||
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||
if ($totalonlinkedelements == $object->total_ht)
|
||||
dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
|
||||
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
|
||||
{
|
||||
foreach($object->linkedObjects['commande'] as $element)
|
||||
{
|
||||
@ -199,8 +200,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
|
||||
if ($action=='SHIPPING_VALIDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
||||
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->expedition->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING))
|
||||
{
|
||||
@ -234,6 +234,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Build array of quantity ordered by product
|
||||
if (is_array($order->lines) && count($order->lines)>0) {
|
||||
foreach($order->lines as $orderline) {
|
||||
|
||||
@ -138,8 +138,14 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (11
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1173, 117, '1','0','VAT super-reduced rate',0);
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1174, 117, '0','0','VAT Rate 0', 0);
|
||||
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'CGST+SGST', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'IGST' , 18, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1178, 117, 'C+S-5', 0, 2.5, '1', 2.5, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1179, 117, 'I-5' , 5, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1180, 117, 'C+S-12', 0, 6, '1', 6, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1181, 117, 'I-12' , 12, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'C+S-18', 0, 9, '1', 9, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'I-18' , 18, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1182, 117, 'C+S-28', 0, 14, '1', 14, '1', 0, 'CGST+SGST - Same state sales', 1);
|
||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1183, 117, 'I-28' , 28, 0, '0', 0, '0', 0, 'IGST', 1);
|
||||
|
||||
-- IRELAND (id country=8)
|
||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (81, 8, '0','0','VAT Rate 0',1);
|
||||
|
||||
@ -17,3 +17,4 @@ rate=rate
|
||||
MulticurrencyReceived=Received, original currency
|
||||
MulticurrencyRemainderToTake=Remaining amout, original currency
|
||||
MulticurrencyPaymentAmount=Payment amount, original currency
|
||||
AmountToOthercurrency=Amount To (in currency of receiving account)
|
||||
@ -152,7 +152,7 @@ BuyingPrices=Buying prices
|
||||
CustomerPrices=Customer prices
|
||||
SuppliersPrices=Supplier prices
|
||||
SuppliersPricesOfProductsOrServices=Supplier prices (of products or services)
|
||||
CustomCode=Customs code
|
||||
CustomCode=Customs/Commodity/HS code
|
||||
CountryOrigin=Origin country
|
||||
Nature=Nature
|
||||
ShortLabel=Short label
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* 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
|
||||
@ -17,43 +16,14 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file product/inventory/card.php
|
||||
* \file htdocs/product/inventory/card.php
|
||||
* \ingroup inventory
|
||||
* \brief This file is an example of a php page
|
||||
* Put here some comments
|
||||
* \brief Inventory card
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res=0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php");
|
||||
// Try main.inc.php using relative path
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php");
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
dol_include_once('/inventory/class/inventory.class.php');
|
||||
require '../../main.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("inventory","other"));
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* 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
|
||||
@ -17,45 +16,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file product/inventory/list.php
|
||||
* \file htdocs/product/inventory/list.php
|
||||
* \ingroup inventory
|
||||
* \brief List page for monmodule
|
||||
* \brief List page for inventory
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res=0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
|
||||
// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME
|
||||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php");
|
||||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php");
|
||||
// Try main.inc.php using relative path
|
||||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php");
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
dol_include_once('/inventory/class/inventory.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("inventory","other"));
|
||||
@ -177,7 +147,7 @@ if (empty($reshook))
|
||||
$permtoread = $user->rights->inventory->read;
|
||||
$permtodelete = $user->rights->inventory->delete;
|
||||
$uploaddir = $conf->inventory->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // TODO to fix for product module
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -357,17 +357,17 @@ if ($usevirtualstock)
|
||||
|
||||
if ($salert == 'on') // Option to see when stock is lower than alert
|
||||
{
|
||||
$sql.= ' AND ('.$sqlalertstock.' > 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
|
||||
$sql.= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
|
||||
$sql.= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.')))';
|
||||
$alertchecked = 'checked';
|
||||
}
|
||||
} else {
|
||||
$sql.= ' HAVING (('.$sqldesiredtock.' > 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
|
||||
$sql.= ' OR ('.$sqlalertstock.' > 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))';
|
||||
$sql.= ' HAVING (('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
|
||||
$sql.= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))';
|
||||
|
||||
if ($salert == 'on') // Option to see when stock is lower than alert
|
||||
{
|
||||
$sql.= ' AND ('.$sqlalertstock.' > 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
|
||||
$sql.= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
|
||||
$alertchecked = 'checked';
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,12 @@ if ($_POST) {
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
}
|
||||
|
||||
if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
} else {
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$title = $langs->trans('ModuleSetup').' '.$langs->trans('ProductAttributes');
|
||||
@ -55,6 +61,13 @@ print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td width="80"> </td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans('HideProductCombinations').'</td><td>';
|
||||
print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD",$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD,1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('CombinationsSeparator').'</td><td>';
|
||||
if(isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
|
||||
$separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR;
|
||||
} else {
|
||||
$separator = "_";
|
||||
}
|
||||
print '<td align="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';
|
||||
print '</table>';
|
||||
print '<br><div style="text-align: center"><input type="submit" value="'.$langs->trans('Save').'" class="button"></div>';
|
||||
print '</form>';
|
||||
|
||||
@ -476,7 +476,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
||||
*/
|
||||
public function createProductCombination(Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false)
|
||||
{
|
||||
global $db, $user;
|
||||
global $db, $user, $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
|
||||
@ -542,7 +542,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
||||
$price_impact += (float) price2num($variations[$currcombattr][$currcombval]['price']);
|
||||
}
|
||||
|
||||
$newproduct->ref .= '_'.$prodattrval->ref;
|
||||
if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
|
||||
$newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref;
|
||||
} else {
|
||||
$newproduct->ref .= '_'.$prodattrval->ref;
|
||||
}
|
||||
|
||||
//The first one should not contain a linebreak
|
||||
if ($newproduct->description) {
|
||||
@ -660,4 +664,4 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user