2
0
forked from Wavyzz/dolibarr

Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/class/html.form.class.php
	htdocs/projet/list.php
	htdocs/user/card.php
This commit is contained in:
Laurent Destailleur
2017-10-13 22:01:56 +02:00
16 changed files with 217 additions and 103 deletions

View File

@@ -187,6 +187,7 @@ export list="
--ignore-table=$base.llx_bt_webseedfiles
--ignore-table=$base.llx_c_civilite
--ignore-table=$base.llx_c_dolicloud_plans
--ignore-table=$base.llx_c_pays
--ignore-table=$base.llx_c_source
--ignore-table=$base.llx_cabinetmed_c_banques
--ignore-table=$base.llx_cabinetmed_c_ccam

View File

@@ -193,12 +193,11 @@ class Subscription extends CommonObject
*/
function delete($user)
{
$accountline=new AccountLine($this->db);
// It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank);
}

View File

@@ -31,10 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->load("companies");
$langs->load("bills");
@@ -815,7 +815,6 @@ if ($rowid > 0)
if ($result)
{
$subscriptionstatic=new Subscription($db);
$accountstatic=new Account($db);
$num = $db->num_rows($result);
$i = 0;
@@ -834,6 +833,8 @@ if ($rowid > 0)
}
print "</tr>\n";
$accountstatic=new Account($db);
while ($i < $num)
{
$objp = $db->fetch_object($result);
@@ -855,10 +856,13 @@ if ($rowid > 0)
$accountstatic->number=$objp->number;
$accountstatic->account_number=$objp->account_number;
if (! empty($conf->accounting->enabled))
{
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
}
$accountstatic->ref=$objp->ref;
print $accountstatic->getNomUrl(1);

View File

@@ -25,7 +25,9 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->banque->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
}
$langs->load("companies");
$langs->load("bills");
@@ -346,7 +348,6 @@ if ($rowid && $action != 'edit')
}
}
print "</table>\n";
print '</div>';

View File

@@ -307,7 +307,7 @@ if ($result)
// Banque
if (! empty($conf->banque->enabled))
{
if ($obj->fk_account)
if ($obj->fk_account > 0)
{
$accountstatic->id=$obj->fk_account;
$accountstatic->fetch($obj->fk_account);

View File

@@ -389,7 +389,7 @@ if ($socid > 0)
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1);
print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("ExcessReceived"),$obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
}
else

View File

@@ -135,7 +135,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql.= " pct.code as payment_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
@@ -256,7 +256,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.fk_bank,";
$sql.= " pct.code as payment_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
@@ -470,7 +470,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,";
$sql.= " pct.code as payment_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";

View File

@@ -2905,12 +2905,12 @@ else if ($id > 0 || ! empty($ref))
$resteapayer = 0;
$resteapayeraffiche = $resteapayer;
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%'))";
$filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%'";
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%'))";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
@@ -2933,9 +2933,9 @@ else if ($id > 0 || ! empty($ref))
// Confirmation de la conversion de l'avoir en reduc
if ($action == 'converttoreduc') {
if($object->type == 0) $type_fac = 'ExcessReceived';
elseif($object->type == 2) $type_fac = 'CreditNote';
elseif($object->type == 3) $type_fac = 'Deposit';
if($object->type == Facture::TYPE_STANDARD) $type_fac = 'ExcessReceived';
elseif($object->type == Facture::TYPE_CREDIT_NOTE) $type_fac = 'CreditNote';
elseif($object->type == Facture::TYPE_DEPOSIT) $type_fac = 'Deposit';
$text = $langs->trans('ConfirmConvertToReduc', strtolower($langs->transnoentities($type_fac)));
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2);
}

View File

@@ -445,14 +445,14 @@ class DiscountAbsolute
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
$sql.= ' AND f.type = 2';
$sql.= ' AND (f.type = 2 OR f.type = 0)'; // Find discount coming from credit note or excess received
}
else if ($invoice->element == 'invoice_supplier')
{
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
$sql.= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id;
$sql.= ' AND f.type = 2';
$sql.= ' AND (f.type = 2 OR f.type = 0)'; // Find discount coming from credit note or excess received
}
else
{

View File

@@ -1232,6 +1232,12 @@ class Form
$disabled=' disabled';
}
if (!empty($conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->fk_facture_source))
{
$tmpfac = new Facture($this->db);
if ($tmpfac->fetch($obj->fk_facture_source) > 0) $desc=$desc.' - '.$tmpfac->ref;
}
print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
$i++;
}

View File

@@ -43,9 +43,80 @@ top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache');
// Define tradMonths javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
$tradMonths=array(
dol_escape_js($langs->transnoentitiesnoconv("January")),
dol_escape_js($langs->transnoentitiesnoconv("February")),
dol_escape_js($langs->transnoentitiesnoconv("March")),
dol_escape_js($langs->transnoentitiesnoconv("April")),
dol_escape_js($langs->transnoentitiesnoconv("May")),
dol_escape_js($langs->transnoentitiesnoconv("June")),
dol_escape_js($langs->transnoentitiesnoconv("July")),
dol_escape_js($langs->transnoentitiesnoconv("August")),
dol_escape_js($langs->transnoentitiesnoconv("September")),
dol_escape_js($langs->transnoentitiesnoconv("October")),
dol_escape_js($langs->transnoentitiesnoconv("November")),
dol_escape_js($langs->transnoentitiesnoconv("December"))
);
$tradMonthsShort=array(
$langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin")
);
$tradDays=array(
$langs->trans("Sunday"),
$langs->trans("Monday"),
$langs->trans("Tuesday"),
$langs->trans("Wednesday"),
$langs->trans("Thursday"),
$langs->trans("Friday"),
$langs->trans("Saturday")
);
$tradDaysShort=array(
$langs->trans("ShortSunday"),
$langs->trans("ShortMonday"),
$langs->trans("ShortTuesday"),
$langs->trans("ShortWednesday"),
$langs->trans("ShortThursday"),
$langs->trans("ShortFriday"),
$langs->trans("ShortSaturday")
);
$tradDaysMin=array(
$langs->trans("SundayMin"),
$langs->trans("MondayMin"),
$langs->trans("TuesdayMin"),
$langs->trans("WednesdayMin"),
$langs->trans("ThursdayMin"),
$langs->trans("FridayMin"),
$langs->trans("SaturdayMin")
);
?>
// Javascript libraries for Dolibarr ERP CRM (https://www.dolibarr.org)
// For jQuery date picker
var tradMonths = <?php echo json_encode($tradMonths) ?>;
var tradMonthsShort = <?php echo json_encode($tradMonthsShort) ?>;
var tradDays = <?php echo json_encode($tradDays) ?>;
var tradDaysShort = <?php echo json_encode($tradDaysShort) ?>;
var tradDaysMin = <?php echo json_encode($tradDaysMin) ?>;
/**
* Set select2 translations (if module was loaded).

View File

@@ -54,16 +54,7 @@ if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
$langs->load('admin');
$langs->load('orders');
$langs->load('sendings');
$langs->load('companies');
$langs->load('bills');
$langs->load('propal');
$langs->load('supplier_proposal');
$langs->load('deliveries');
$langs->load('products');
$langs->load('stocks');
$langs->loadLangs(array('admin','orders','sendings','companies','bills','propal','supplier_proposal','deliveries','products','stocks','productbatch'));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
$id = GETPOST('id','int');

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
// Copyright (C) 2015 Francis Appels <francis.appels@z-application.com>
// Copyright (C) 2017 Francis Appels <francis.appels@z-application.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
@@ -24,7 +24,7 @@
* addDispatchLine
* Adds new table row for dispatching to multiple stock locations
*
* @param index int index of produt line. 0 = first product line
* @param index int index of product line. 0 = first product line
* @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch)
* @param mode string 'qtymissing' will create new line with qty missing, 'lessone' will keep 1 in old line and the rest in new one
*/
@@ -35,17 +35,17 @@ function addDispatchLine(index, type, mode)
console.log("Split line type="+type+" index="+index+" mode="+mode);
var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object
nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch
qtyOrdered = parseFloat($("#qty_ordered_"+(nbrTrs - 1)+"_"+index).val()),
qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows
qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()),
qtyDispatched;
if (mode === 'lessone')
{
qtyDispatched = parseFloat($("#qty_dispatched_"+(nbrTrs - 1)+"_"+index).val()) + 1;
qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + 1;
}
else
{
qtyDispatched = parseFloat($("#qty_dispatched_"+(nbrTrs - 1)+"_"+index).val()) + qty;
qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + qty;
}
if (qtyDispatched < qtyOrdered)
@@ -66,7 +66,7 @@ function addDispatchLine(index, type, mode)
$("#s2id_entrepot_"+nbrTrs+'_'+index).detach();
/* Suffix of lines are: _ trs.length _ index */
$("#qty_"+nbrTrs+"_"+index).focus();
$("#qty_dispatched_"+(nbrTrs)+"_"+index).val(qtyDispatched);
$("#qty_dispatched_0_"+index).val(qtyDispatched);
//hide all buttons then show only the last one
$("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide();
@@ -74,15 +74,51 @@ function addDispatchLine(index, type, mode)
if (mode === 'lessone')
{
$("#qty_"+(nbrTrs)+"_"+index).val(qty-1);
$("#qty_"+(nbrTrs-1)+"_"+index).val(1);
qty = 1; // keep 1 in old line
$("#qty_"+(nbrTrs-1)+"_"+index).val(qty);
}
else
{
$("#qty_"+nbrTrs+"_"+index).val(qtyOrdered - qtyDispatched);
}
// Store arbitrary data for dispatch qty input field change event
$("#qty_"+(nbrTrs-1)+"_"+index).data('qty', qty);
$("#qty_"+(nbrTrs-1)+"_"+index).data('type', type);
$("#qty_"+(nbrTrs-1)+"_"+index).data('index', index);
// Update dispatched qty when value dispatch qty input field changed
$("#qty_"+(nbrTrs-1)+"_"+index).change(this.onChangeDispatchLineQty);
//set focus on lot of new line (if it exists)
$("#lot_number_"+(nbrTrs)+"_"+index).focus();
}
}
/**
* onChangeDispatchLineQty
*
* Change event handler for dispatch qty input field,
* recalculate qty dispatched when qty input has changed.
* If qty is more then qty ordered reset input qty to max qty to dispatch.
*
* element requires arbitrary data qty (value before change), type (type of dispatch) and index (index of product line)
*/
function onChangeDispatchLineQty() {
var index = $(this).data('index'),
type = $(this).data('type'),
qty = parseFloat($(this).data('qty')),
changedQty, nbrTrs, dispatchingQty, qtyOrdered, qtyDispatched;
if (index >= 0 && type && qty >= 0) {
nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length;
qtyChanged = parseFloat($(this).val()) - qty; // qty changed
qtyDispatching = parseFloat($("#qty_"+(nbrTrs-1)+"_"+index).val()); // qty currently being dispatched
qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()); // qty ordered
qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()); // qty already dispatched
console.log("onChangeDispatchLineQty qtyChanged: " + qtyChanged + " qtyDispatching: " + qtyDispatching + " qtyOrdered: " + qtyOrdered + " qtyDispatched: "+ qtyDispatched);
if ((qtyChanged) <= (qtyOrdered - (qtyDispatched + qtyDispatching))) {
$("#qty_dispatched_0_"+index).val(qtyDispatched + qtyChanged);
} else {
$(this).val($(this).data('qty'));
}
$(this).data('qty', $(this).val());
}
}

View File

@@ -267,6 +267,7 @@ CustomerAbsoluteDiscountShort=Absolute discount
CompanyHasRelativeDiscount=This customer has a default discount of <b>%s%%</b>
CompanyHasNoRelativeDiscount=This customer has no relative discount by default
CompanyHasAbsoluteDiscount=This customer has discount available (credits notes or down payments) for <b>%s</b> %s
CompanyHasDownPaymentOrCommercialDiscount=This customer has discount available (commercial, down payments) for <b>%s</b> %s
CompanyHasCreditNote=This customer still has credit notes for <b>%s</b> %s
CompanyHasNoAbsoluteDiscount=This customer has no discount credit available
CustomerAbsoluteDiscountAllUsers=Absolute discounts (granted by all users)

View File

@@ -1329,10 +1329,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext?'&amp;'.$ext:'').'"></script>'."\n";
// Add datepicker default options (needed by jquery datepicker!)
if (! defined('DISABLE_DATE_PICKER'))
/*if (! defined('DISABLE_DATE_PICKER'))
{
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/datepicker.js.php?lang='.$langs->defaultlang.($ext?'&'.$ext:'').'"></script>'."\n";
}
}*/
// JS forced by modules (relative url starting with /)
if (! empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))

View File

@@ -1447,9 +1447,13 @@ else
print '</td>';
print "</tr>\n";
//$childids = $user->getAllChildIds(1);
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)))
{
// Even a superior can't see this info of its subordinates wihtout $user->rights->salaries->read and $user->rights->hrm->employee->read (setting/viewing is reserverd to HR people).
// However, he can see the valuation of timesheet of its subordinates even without these permissions.
$langs->load("salaries");
// THM