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_bt_webseedfiles
--ignore-table=$base.llx_c_civilite --ignore-table=$base.llx_c_civilite
--ignore-table=$base.llx_c_dolicloud_plans --ignore-table=$base.llx_c_dolicloud_plans
--ignore-table=$base.llx_c_pays
--ignore-table=$base.llx_c_source --ignore-table=$base.llx_c_source
--ignore-table=$base.llx_cabinetmed_c_banques --ignore-table=$base.llx_cabinetmed_c_banques
--ignore-table=$base.llx_cabinetmed_c_ccam --ignore-table=$base.llx_cabinetmed_c_ccam

View File

@@ -33,7 +33,7 @@ class Subscription extends CommonObject
public $element='subscription'; public $element='subscription';
public $table_element='subscription'; public $table_element='subscription';
public $picto='payment'; public $picto='payment';
var $datec; // Date creation var $datec; // Date creation
var $datem; // Date modification var $datem; // Date modification
var $dateh; // Subscription start date (date subscription) var $dateh; // Subscription start date (date subscription)
@@ -193,12 +193,11 @@ class Subscription extends CommonObject
*/ */
function delete($user) function delete($user)
{ {
$accountline=new AccountLine($this->db);
// It subscription is linked to a bank transaction, we get it // It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0) if ($this->fk_bank > 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank); $result=$accountline->fetch($this->fk_bank);
} }
@@ -288,7 +287,7 @@ class Subscription extends CommonObject
{ {
return ''; return '';
} }
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@@ -301,7 +300,7 @@ class Subscription extends CommonObject
$langs->load("members"); $langs->load("members");
return ''; return '';
} }
/** /**
* Load information of the subscription object * Load information of the subscription object
* *

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.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.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.'/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'; 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("companies");
$langs->load("bills"); $langs->load("bills");
@@ -815,7 +815,6 @@ if ($rowid > 0)
if ($result) if ($result)
{ {
$subscriptionstatic=new Subscription($db); $subscriptionstatic=new Subscription($db);
$accountstatic=new Account($db);
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
@@ -834,6 +833,8 @@ if ($rowid > 0)
} }
print "</tr>\n"; print "</tr>\n";
$accountstatic=new Account($db);
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
@@ -845,20 +846,23 @@ if ($rowid > 0)
print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
print '<td align="right">'.price($objp->subscription).'</td>'; print '<td align="right">'.price($objp->subscription).'</td>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
print '<td align="right">'; print '<td align="right">';
if ($objp->bid) if ($objp->bid)
{ {
$accountstatic->label=$objp->label; $accountstatic->label=$objp->label;
$accountstatic->id=$objp->baid; $accountstatic->id=$objp->baid;
$accountstatic->number=$objp->number; $accountstatic->number=$objp->number;
$accountstatic->account_number=$objp->account_number; $accountstatic->account_number=$objp->account_number;
$accountingjournal = new AccountingJournal($db); if (! empty($conf->accounting->enabled))
$accountingjournal->fetch($objp->fk_accountancy_journal); {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
}
$accountstatic->ref=$objp->ref; $accountstatic->ref=$objp->ref;
print $accountstatic->getNomUrl(1); print $accountstatic->getNomUrl(1);
@@ -1092,12 +1096,12 @@ if ($rowid > 0)
print '</a>)'; print '</a>)';
} }
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0); if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0);
if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
{ {
$prodtmp=new Product($db); $prodtmp=new Product($db);
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
} }
print '<br>'; print '<br>';
} }
// Add invoice with payments // Add invoice with payments
@@ -1117,12 +1121,12 @@ if ($rowid > 0)
print '</a>)'; print '</a>)';
} }
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0); if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0);
if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
{ {
$prodtmp=new Product($db); $prodtmp=new Product($db);
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
} }
print '<br>'; print '<br>';
} }
print '</td></tr>'; print '</td></tr>';

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.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.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.'/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("companies");
$langs->load("bills"); $langs->load("bills");
@@ -231,20 +233,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
{ {
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">'; print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">';
if ($object->fk_bank) if ($object->fk_bank)
{ {
$bankline=new AccountLine($db); $bankline=new AccountLine($db);
$result=$bankline->fetch($object->fk_bank); $result=$bankline->fetch($object->fk_bank);
print $bankline->getNomUrl(1,0,'showall'); print $bankline->getNomUrl(1,0,'showall');
} }
else else
{ {
print $langs->trans("NoneF"); print $langs->trans("NoneF");
} }
print '</td></tr>'; print '</td></tr>';
} }
} }
print '</table>'; print '</table>';
@@ -326,27 +328,26 @@ if ($rowid && $action != 'edit')
// Amount // Amount
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
// Bank line // Bank line
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
{ {
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur">';
if ($object->fk_bank) if ($object->fk_bank)
{ {
$bankline=new AccountLine($db); $bankline=new AccountLine($db);
$result=$bankline->fetch($object->fk_bank); $result=$bankline->fetch($object->fk_bank);
print $bankline->getNomUrl(1,0,'showall'); print $bankline->getNomUrl(1,0,'showall');
} }
else else
{ {
print $langs->trans("NoneF"); print $langs->trans("NoneF");
} }
print '</td></tr>'; print '</td></tr>';
} }
} }
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';

View File

@@ -304,22 +304,22 @@ if ($result)
print dol_trunc($obj->note,32); print dol_trunc($obj->note,32);
print '</td>'; print '</td>';
// Banque // Banque
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($obj->fk_account) if ($obj->fk_account > 0)
{ {
$accountstatic->id=$obj->fk_account; $accountstatic->id=$obj->fk_account;
$accountstatic->fetch($obj->fk_account); $accountstatic->fetch($obj->fk_account);
//$accountstatic->label=$obj->label; //$accountstatic->label=$obj->label;
print '<td>'.$accountstatic->getNomUrl(1).'</td>'; print '<td>'.$accountstatic->getNomUrl(1).'</td>';
} }
else else
{ {
print "<td>"; print "<td>";
print "</td>\n"; print "</td>\n";
} }
} }
// Date start // Date start
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n";

View File

@@ -389,7 +389,7 @@ if ($socid > 0)
$facturestatic->id=$obj->fk_facture_source; $facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $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>'; print '</td>';
} }
else 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.= " 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.= " 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.= " 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.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $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 = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.fk_bank,";
$sql.= " pct.code as payment_code,"; $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.= " 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 as b ON pv.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.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 = "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.= " 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.= " 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 as b ON s.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.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; $resteapayer = 0;
$resteapayeraffiche = $resteapayer; $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 $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 $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 { } else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' OR description 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)%' 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); $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
@@ -2933,9 +2933,9 @@ else if ($id > 0 || ! empty($ref))
// Confirmation de la conversion de l'avoir en reduc // Confirmation de la conversion de l'avoir en reduc
if ($action == 'converttoreduc') { if ($action == 'converttoreduc') {
if($object->type == 0) $type_fac = 'ExcessReceived'; if($object->type == Facture::TYPE_STANDARD) $type_fac = 'ExcessReceived';
elseif($object->type == 2) $type_fac = 'CreditNote'; elseif($object->type == Facture::TYPE_CREDIT_NOTE) $type_fac = 'CreditNote';
elseif($object->type == 3) $type_fac = 'Deposit'; elseif($object->type == Facture::TYPE_DEPOSIT) $type_fac = 'Deposit';
$text = $langs->trans('ConfirmConvertToReduc', strtolower($langs->transnoentities($type_fac))); $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); $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 = '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.= ' 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.= ' 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') else if ($invoice->element == 'invoice_supplier')
{ {
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $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.= ' 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.= ' 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 else
{ {

View File

@@ -1232,6 +1232,12 @@ class Form
$disabled=' disabled'; $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>'; print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
$i++; $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. // 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'); if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache'); 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) // 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). * 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'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
} }
$langs->load('admin'); $langs->loadLangs(array('admin','orders','sendings','companies','bills','propal','supplier_proposal','deliveries','products','stocks','productbatch'));
$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');
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
$id = GETPOST('id','int'); $id = GETPOST('id','int');

View File

@@ -1,5 +1,5 @@
// Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> // 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 // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
* addDispatchLine * addDispatchLine
* Adds new table row for dispatching to multiple stock locations * 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 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 * @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); 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 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 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()), qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()),
qtyDispatched; qtyDispatched;
if (mode === 'lessone') if (mode === 'lessone')
{ {
qtyDispatched = parseFloat($("#qty_dispatched_"+(nbrTrs - 1)+"_"+index).val()) + 1; qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + 1;
} }
else else
{ {
qtyDispatched = parseFloat($("#qty_dispatched_"+(nbrTrs - 1)+"_"+index).val()) + qty; qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + qty;
} }
if (qtyDispatched < qtyOrdered) if (qtyDispatched < qtyOrdered)
@@ -63,10 +63,10 @@ function addDispatchLine(index, type, mode)
//insert new row before last row //insert new row before last row
$("tr[name^='"+type+"_'][name$='_"+index+"']:last").after($row); $("tr[name^='"+type+"_'][name$='_"+index+"']:last").after($row);
//remove cloned select2 with duplicate id. //remove cloned select2 with duplicate id.
$("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); $("#s2id_entrepot_"+nbrTrs+'_'+index).detach();
/* Suffix of lines are: _ trs.length _ index */ /* Suffix of lines are: _ trs.length _ index */
$("#qty_"+nbrTrs+"_"+index).focus(); $("#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 //hide all buttons then show only the last one
$("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide(); $("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide();
@@ -74,15 +74,51 @@ function addDispatchLine(index, type, mode)
if (mode === 'lessone') if (mode === 'lessone')
{ {
$("#qty_"+(nbrTrs)+"_"+index).val(qty-1); qty = 1; // keep 1 in old line
$("#qty_"+(nbrTrs-1)+"_"+index).val(1); $("#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+"_"+index).val(qtyOrdered - qtyDispatched); $("#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) //set focus on lot of new line (if it exists)
$("#lot_number_"+(nbrTrs)+"_"+index).focus(); $("#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> CompanyHasRelativeDiscount=This customer has a default discount of <b>%s%%</b>
CompanyHasNoRelativeDiscount=This customer has no relative discount by default 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 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 CompanyHasCreditNote=This customer still has credit notes for <b>%s</b> %s
CompanyHasNoAbsoluteDiscount=This customer has no discount credit available CompanyHasNoAbsoluteDiscount=This customer has no discount credit available
CustomerAbsoluteDiscountAllUsers=Absolute discounts (granted by all users) 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"; 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!) // 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"; 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 /) // JS forced by modules (relative url starting with /)
if (! empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) 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 '</td>';
print "</tr>\n"; print "</tr>\n";
//$childids = $user->getAllChildIds(1);
if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
|| (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->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"); $langs->load("salaries");
// THM // THM