Merge branch '6.0' of https://github.com/Dolibarr/dolibarr into 6.0
This commit is contained in:
commit
4d72573484
0
.gitignore
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
50
ChangeLog
50
ChangeLog
@ -2,6 +2,56 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.7 compared to 6.0.6 *****
|
||||
FIX: #8023
|
||||
FIX: #8259 can't update contact birthday with REST API
|
||||
FIX: #8478 !empty instead of count to avoid warning
|
||||
FIX: #8488
|
||||
FIX: actioncomm export: type filtering not working
|
||||
FIX: addline on invoice supplier manage rank on its own if not provided
|
||||
FIX: issue #8037
|
||||
FIX: label in getnomurl projectlist
|
||||
FIX: payment term doc-specific label was not used
|
||||
FIX: payment term doc-specific label was not used (issue #8414)
|
||||
FIX: project category is type 6 not 5 !!
|
||||
FIX: some localtaxes errors
|
||||
FIX: weird password autocompletion in Google Chrome (issue #8479)
|
||||
|
||||
***** ChangeLog for 6.0.6 compared to 6.0.5 *****
|
||||
FIX: #7974 Contract - Invalid reference on the document
|
||||
FIX: #8139
|
||||
FIX: #8139 User search does not work if MAIN_USE_OLD_SEARCH_FORM, missing list.php
|
||||
FIX: #8151
|
||||
FIX: #8200
|
||||
FIX: add planned delivery to order exports
|
||||
FIX: a discount is a percent, not an amount, so we use vatrate not price
|
||||
FIX: Avoid empty value to fk_multicurrency attribute
|
||||
FIX: Bad localtaxes assignment in cashdesk
|
||||
FIX: check shipping on delete order
|
||||
FIX: check verif exped on delete order
|
||||
FIX: creer into lire
|
||||
FIX: Delete tasks on project delete will now trigger TASK_DELETE
|
||||
FIX: Global on $user parameter reset the variable
|
||||
FIX: if we make a mistake with situation_percent, now we can correct…
|
||||
FIX: if we make a mistake with situation_percent, now we can correct it. before situation_final was always set to 1 and no way to go back
|
||||
FIX: Import process must stop after ending line nb to import
|
||||
FIX: migration script for product photo
|
||||
FIX: natural search double quote
|
||||
FIX: reverse field to have object loaded in doaction
|
||||
FIX: Saving wrong localtax on order addline
|
||||
FIX: show status on societe banner
|
||||
FIX: solve column mismatch in user card's usergroup list + code cleanup
|
||||
FIX: solve column mismatch in user card with multicompany transverse mode + code cleanup
|
||||
FIX: unset categorie
|
||||
FIX: update_extras on fourn card
|
||||
FIX: warning when adding ECM files using old photo path
|
||||
FIX: Withdrawals lines not filter by company name and not respect dropdown limit lines by page
|
||||
NEW: Add sale representative einstein_pdf_modules
|
||||
NEW_einstein_pdf_modules
|
||||
NEW: field commerciaux and categ export CustomersInvoicesAndPayments
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.5 compared to 6.0.4 *****
|
||||
FIX: security vulnerability reported by ADLab of Venustech
|
||||
CVE-2017-17897, CVE-2017-17898, CVE-2017-17899, CVE-2017-17900
|
||||
|
||||
@ -466,10 +466,12 @@ if ($nboftargetok) {
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.xz`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.deb`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.xz`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
|
||||
@ -849,6 +851,8 @@ if ($nboftargetok) {
|
||||
unlink("$NEWDESTI/${FILENAMEDEB}.changes");
|
||||
print "Remove target ${FILENAMEDEB}.debian.tar.gz...\n";
|
||||
unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.gz");
|
||||
print "Remove target ${FILENAMEDEB}.debian.tar.xz...\n";
|
||||
unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.xz");
|
||||
print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n";
|
||||
unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz");
|
||||
|
||||
@ -1024,7 +1028,7 @@ if ($nboftargetok) {
|
||||
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
|
||||
next;
|
||||
}
|
||||
@ -1168,7 +1172,7 @@ if ($nboftargetok) {
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
||||
@ -1181,8 +1185,7 @@ if ($nboftargetok) {
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
||||
|
||||
@ -94,9 +94,9 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (! empty($cancel)) $action = '';
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
$search_account = "";
|
||||
@ -106,13 +106,13 @@ if (empty($reshook))
|
||||
$search_pcgsubtype = "";
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
|
||||
if (GETPOST('change_chart'))
|
||||
{
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
|
||||
if (! empty($chartofaccounts)) {
|
||||
|
||||
|
||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
@ -120,12 +120,12 @@ if (empty($reshook))
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'disable') {
|
||||
if ($accounting->fetch($id)) {
|
||||
$result = $accounting->account_desactivate($id);
|
||||
}
|
||||
|
||||
|
||||
$action = 'update';
|
||||
if ($result < 0) {
|
||||
setEventMessages($accounting->error, $accounting->errors, 'errors');
|
||||
@ -160,10 +160,10 @@ $pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = " . $conf->entity;
|
||||
// Dirty hack wainting that foreign key account_parent is an integer to be compared correctly with rowid
|
||||
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER)";
|
||||
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED)";
|
||||
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER) AND a2.entity = " . $conf->entity;
|
||||
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED) AND a2.entity = " . $conf->entity;
|
||||
$sql .= " WHERE asy.rowid = " . $pcgver;
|
||||
|
||||
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
|
||||
@ -179,7 +179,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
@ -209,11 +209,11 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
|
||||
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
|
||||
|
||||
|
||||
// Box to select active chart of account
|
||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
||||
@ -227,22 +227,22 @@ if ($resql)
|
||||
$i = 0;
|
||||
while ( $i < $numbis ) {
|
||||
$row = $db->fetch_row($resqlchart);
|
||||
|
||||
|
||||
print '<option value="' . $row[0] . '"';
|
||||
print $pcgver == $row[0] ? ' selected' : '';
|
||||
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
|
||||
|
||||
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
print "</select>";
|
||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
@ -259,7 +259,7 @@ if ($resql)
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
||||
@ -274,14 +274,14 @@ if ($resql)
|
||||
$accountparent = new AccountingAccount($db);
|
||||
|
||||
$i=0;
|
||||
while ($i < min($num, $limit))
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$accountstatic->id = $obj->rowid;
|
||||
$accountstatic->label = $obj->label;
|
||||
$accountstatic->account_number = $obj->account_number;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Account number
|
||||
@ -310,7 +310,7 @@ if ($resql)
|
||||
$accountparent->id = $obj->rowid2;
|
||||
$accountparent->label = $obj->label2;
|
||||
$accountparent->account_number = $obj->account_number2;
|
||||
|
||||
|
||||
print "<td>";
|
||||
print $accountparent->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
@ -371,11 +371,11 @@ if ($resql)
|
||||
}
|
||||
print '</td>' . "\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print '</form>';
|
||||
|
||||
@ -86,7 +86,7 @@ $tablib[35]= "DictionaryAccountancyJournal";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[35]= "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a";
|
||||
$tabsql[35]= "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a WHERE a.entity=".$conf->entity;
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -102,7 +102,7 @@ $tabfieldvalue[35]= "code,label,nature";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[35]= "code,label,nature";
|
||||
$tabfieldinsert[35]= "code,label,nature,entity";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
|
||||
@ -28,7 +28,9 @@ require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql = "SELECT f.rowid as factid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
||||
@ -302,7 +302,7 @@ if ($result) {
|
||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
||||
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->rowid;
|
||||
$facture_static->id = $objp->factid;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
|
||||
@ -135,9 +135,9 @@ if ($result) {
|
||||
$compta_fees = $obj->compte;
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
|
||||
@ -164,7 +164,7 @@ if ($result) {
|
||||
// Situation invoices handling
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid);
|
||||
$prev_progress = $line->get_prev_progress($obj->fdid);
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid);
|
||||
if ($obj->type == Facture::TYPE_SITUATION) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -150,7 +151,8 @@ switch($action)
|
||||
$obj_facturation->id($ret['rowid']);
|
||||
$obj_facturation->ref($ret['ref']);
|
||||
$obj_facturation->stock($ret['reel']);
|
||||
$obj_facturation->prix($ret['price']);
|
||||
//$obj_facturation->prix($ret['price']);
|
||||
$obj_facturation->prix($pu_ht);
|
||||
|
||||
|
||||
$vatrate = $tva_tx;
|
||||
|
||||
@ -3126,7 +3126,13 @@ class Commande extends CommonOrder
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
|
||||
if ($this->nb_expedition() != 0)
|
||||
{
|
||||
$this->errors[] = $langs->trans('SomeShipmentExists');
|
||||
$error++;
|
||||
}
|
||||
|
||||
//TODO: Check for error after each action. If one failed we rollback, don't waste time to do action if previous fail
|
||||
if (! $error)
|
||||
{
|
||||
@ -4034,7 +4040,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").',';
|
||||
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").',';
|
||||
$sql.= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
$sql.= ", ".$this->fk_multicurrency;
|
||||
$sql.= ", ".(! empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL');
|
||||
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||
$sql.= ", ".$this->multicurrency_subprice;
|
||||
$sql.= ", ".$this->multicurrency_total_ht;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
* Copyright (C) 2012 David Rodriguez Martinez <davidrm146@gmail.com>
|
||||
* Copyright (C) 2012-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -285,6 +285,13 @@ if (($action == 'create' || $action == 'add') && !$error)
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
||||
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
@ -309,7 +316,8 @@ if (($action == 'create' || $action == 'add') && !$error)
|
||||
$fk_parent_line,
|
||||
$lines[$i]->fk_fournprice,
|
||||
$lines[$i]->pa_ht,
|
||||
$lines[$i]->label
|
||||
$lines[$i]->label,
|
||||
$array_options
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -845,11 +845,11 @@ else
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?GETPOST("ref"):$object->ref).'"></td></tr>';
|
||||
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(isset($_POST["ref"])?GETPOST("ref"):$object->ref).'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
||||
print '<td><input type="text" class="flat minwidth300" name="label" value="'.(isset($_POST["label"])?GETPOST("label"):$object->label).'"></td></tr>';
|
||||
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(isset($_POST["label"])?GETPOST("label"):$object->label).'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
|
||||
@ -1362,11 +1362,26 @@ if (empty($reshook))
|
||||
$object->origin = $origin;
|
||||
$object->origin_id = $originid;
|
||||
|
||||
foreach ($object->lines as &$line)
|
||||
foreach ($object->lines as $i => &$line)
|
||||
{
|
||||
$line->origin = $object->origin;
|
||||
$line->origin_id = $line->id;
|
||||
$line->fetch_optionals($line->id);
|
||||
|
||||
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
|
||||
if ($line->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($line->db);
|
||||
$result=$discount->fetch($line->fk_remise_except);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Check if discount not already affected to another invoice
|
||||
if ($discount->fk_facture_line > 0)
|
||||
{
|
||||
$line->fk_remise_except = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2283,9 +2283,12 @@ class Facture extends CommonInvoice
|
||||
$final = ($this->lines[$i]->situation_percent == 100);
|
||||
$i++;
|
||||
}
|
||||
if ($final) {
|
||||
$this->setFinal($user);
|
||||
}
|
||||
|
||||
if (empty($final)) $this->situation_final = 0;
|
||||
else $this->situation_final = 1;
|
||||
|
||||
$this->setFinal($user);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4106,7 +4109,6 @@ class Facture extends CommonInvoice
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$this->situation_final = 1;
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture SET situation_final = ' . $this->situation_final . ' where rowid = ' . $this->id;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -311,6 +311,7 @@ class Contact extends CommonObject
|
||||
$sql .= ", email='".$this->db->escape($this->email)."'";
|
||||
$sql .= ", skype='".$this->db->escape($this->skype)."'";
|
||||
$sql .= ", photo='".$this->db->escape($this->photo)."'";
|
||||
$sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null");
|
||||
$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql .= ", note_public = ".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
|
||||
@ -500,8 +501,8 @@ class Contact extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Mis a jour alerte birthday
|
||||
@ -991,9 +992,10 @@ class Contact extends CommonObject
|
||||
* @param string $option Where the link point to
|
||||
* @param int $maxlen Max length of
|
||||
* @param string $moreparam Add more param into URL
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
|
||||
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='',$notooltip=0)
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
@ -1012,13 +1014,15 @@ class Contact extends CommonObject
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
||||
$linkclose="";
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowContact");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.= ' class="classfortooltip">';
|
||||
if (empty($notooltip)) {
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowContact");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.= ' class="classfortooltip"';
|
||||
}
|
||||
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
@ -1030,7 +1034,7 @@ class Contact extends CommonObject
|
||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||
|
||||
$link.=$linkclose;
|
||||
$link.=$linkclose.'>';
|
||||
|
||||
$linkend='</a>';
|
||||
|
||||
|
||||
@ -908,11 +908,27 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
$old_ref = $object->ref;
|
||||
|
||||
$result = $object->setValueFrom('ref', GETPOST('ref','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'editref';
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$old_filedir = $conf->contrat->dir_output . '/' . dol_sanitizeFileName($old_ref);
|
||||
$new_filedir = $conf->contrat->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||
|
||||
$files = dol_dir_list($old_filedir);
|
||||
if (!empty($files))
|
||||
{
|
||||
if (!is_dir($new_filedir)) dol_mkdir($new_filedir);
|
||||
foreach ($files as $file)
|
||||
{
|
||||
dol_move($file['fullname'], $new_filedir.'/'.$file['name']);
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_payment_mode_code'=>$object->mode_reglement_code,
|
||||
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
|
||||
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
|
||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):($object->cond_reglement_doc?$object->cond_reglement_doc:$object->cond_reglement)),
|
||||
|
||||
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
$array_key.'_total_vat_locale'=>(! empty($object->total_vat)?price($object->total_vat, 0, $outputlangs):price($object->total_tva, 0, $outputlangs)),
|
||||
|
||||
@ -343,6 +343,9 @@ class Conf
|
||||
$this->fournisseur->facture=new stdClass();
|
||||
$this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture";
|
||||
$this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp";
|
||||
$this->supplierproposal=new stdClass();
|
||||
$this->supplierproposal->dir_output=$rootfordata."/supplier_proposal";
|
||||
$this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp";
|
||||
$this->fournisseur->payment=new stdClass();
|
||||
$this->fournisseur->payment->dir_output =$rootfordata."/fournisseur/payment";
|
||||
$this->fournisseur->payment->dir_temp =$rootfordata."/fournisseur/payment/temp";
|
||||
@ -358,6 +361,9 @@ class Conf
|
||||
$this->supplier_invoice->enabled=1;
|
||||
$this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture";
|
||||
$this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp";
|
||||
$this->supplierproposal=new stdClass();
|
||||
$this->supplierproposal->dir_output=$rootfordata."/supplier_proposal";
|
||||
$this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -944,6 +944,10 @@ class ExtraFields
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4]))
|
||||
{
|
||||
// can use curent entity filter
|
||||
if (strpos($InfoFieldList[4], '$ENTITY$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$ENTITY$',$conf->entity,$InfoFieldList[4]);
|
||||
}
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
|
||||
|
||||
@ -175,7 +175,7 @@ class HookManager
|
||||
'formatEvent',
|
||||
'printObjectLine',
|
||||
'printObjectSubLine',
|
||||
'createDictionaryFieldList',
|
||||
'createDictionaryFieldlist',
|
||||
'editDictionaryFieldlist',
|
||||
'getFormMail',
|
||||
'showLinkToObjectBlock'
|
||||
|
||||
@ -273,6 +273,7 @@ class FormAccounting extends Form
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity=".$conf->entity;
|
||||
$sql .= " ORDER BY aa.account_number";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -187,10 +187,12 @@ class FormActions
|
||||
|
||||
$urlbacktopage=$_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage?'&'.$moreparambacktopage:'');
|
||||
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.'&socid='.$object->socid.'&projectid='.$object->fk_project.'&backtopage='.urlencode($urlbacktopage).'">';
|
||||
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
||||
$buttontoaddnewevent.= '</a>';
|
||||
print load_fiche_titre($title, $buttontoaddnewevent, '');
|
||||
if ($conf->agenda->enabled) {
|
||||
$buttontoaddnewevent = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&datep=' . dol_print_date(dol_now(), 'dayhourlog') . '&origin=' . $typeelement . '&originid=' . $object->id . '&socid=' . $object->socid . '&projectid=' . $object->fk_project . '&backtopage=' . urlencode($urlbacktopage) . '">';
|
||||
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
||||
$buttontoaddnewevent.= '</a>';
|
||||
}
|
||||
print load_fiche_titre($title, $buttontoaddnewevent, '');
|
||||
|
||||
$page=0; $param=''; $sortfield='a.datep';
|
||||
|
||||
|
||||
@ -517,7 +517,7 @@ class FormFile
|
||||
$modellist=ModelePDFCards::liste_modeles($this->db);
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'agenda')
|
||||
elseif ($modulepart == 'agenda' || $modulepart == 'actions')
|
||||
{
|
||||
if (is_array($genallowed)) $modellist=$genallowed;
|
||||
else
|
||||
@ -1018,7 +1018,17 @@ class FormFile
|
||||
// Get list of files stored into database for same relative directory
|
||||
if ($relativedir)
|
||||
{
|
||||
$filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC);
|
||||
$filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC);
|
||||
|
||||
if($modulepart == 'produit' && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && ! empty($object->id)) {
|
||||
if (! empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos";
|
||||
else $upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos";
|
||||
|
||||
$relativedirold = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dirold);
|
||||
$relativedirold = preg_replace('/^[\\/]/','',$relativedirold);
|
||||
|
||||
$filearrayindatabase = array_merge($filearrayindatabase, dol_dir_list_in_database($relativedirold, '', null, 'name', SORT_ASC));
|
||||
}
|
||||
|
||||
//var_dump($filearray);
|
||||
//var_dump($filearrayindatabase);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
|
||||
@ -1318,6 +1318,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE))
|
||||
{
|
||||
$morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
|
||||
} else {
|
||||
$morehtmlstatus.='<span class="statusrefactiv">'.$object->getLibStatut(5,0).'</span>';
|
||||
}
|
||||
}
|
||||
elseif ($object->element == 'product')
|
||||
@ -4058,10 +4060,14 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
|
||||
}
|
||||
else // i am the seller
|
||||
{
|
||||
if (!isOnlyOneLocalTax($local)) // This is for spain only, we don't return value found into datbase even if there is only one locatax vat.
|
||||
{
|
||||
return $conf->global->MAIN_INFO_VALUE_LOCALTAX2;
|
||||
}
|
||||
if (in_array($mysoc->country_code, array('ES')))
|
||||
{
|
||||
return $thirdparty_buyer->localtax2_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $conf->global->MAIN_INFO_VALUE_LOCALTAX2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4238,50 +4244,16 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($local == 1)
|
||||
{
|
||||
if (! isOnlyOneLocalTax(1))
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
elseif ($local == 2)
|
||||
{
|
||||
if (! isOnlyOneLocalTax(2))
|
||||
{
|
||||
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(! isOnlyOneLocalTax(1))
|
||||
{
|
||||
if(! isOnlyOneLocalTax(2))
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(! isOnlyOneLocalTax(2))
|
||||
{
|
||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
}
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -6276,6 +6248,8 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
$i3 = 0;
|
||||
foreach($tmpcrits as $tmpcrit)
|
||||
{
|
||||
if(empty($tmpcrit)) continue;
|
||||
|
||||
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
|
||||
|
||||
if (preg_match('/\.(id|rowid)$/', $field)) // Special cas for rowid that is sometimes a ref so used as a search field
|
||||
|
||||
@ -100,7 +100,7 @@ class mailing_advthirdparties extends MailingTargets
|
||||
'source_url' => $this->url($obj->id,'thirdparty'),
|
||||
'source_id' => $obj->id,
|
||||
'source_type' => 'thirdparty'
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,11 +289,11 @@ class mailing_advthirdparties extends MailingTargets
|
||||
if ($type=='thirdparty') {
|
||||
$companystatic=new Societe($this->db);
|
||||
$companystatic->fetch($id);
|
||||
return $companystatic->getNomUrl(0);
|
||||
return $companystatic->getNomUrl(0,'',0,1);
|
||||
} elseif ($type=='contact') {
|
||||
$contactstatic=new Contact($this->db);
|
||||
$contactstatic->fetch($id);
|
||||
return $contactstatic->getNomUrl(0);
|
||||
return $contactstatic->getNomUrl(0,'',0,'',1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ class modCommande extends DolibarrModules
|
||||
$this->depends = array("modSociete");
|
||||
$this->requiredby = array("modExpedition");
|
||||
$this->conflictwith = array();
|
||||
$this->langfiles = array('orders', 'bills', 'companies','products', 'deliveries');
|
||||
$this->langfiles = array('orders', 'bills', 'companies','products', 'deliveries', 'sendings');
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
@ -191,9 +191,9 @@ class modCommande extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("commande","commande","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.date_livraison'=>"DateDeliveryPlanned",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.date_livraison'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'pj.ref'=>'project','cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra';
|
||||
|
||||
@ -73,7 +73,7 @@ class modFournisseur extends DolibarrModules
|
||||
// Dependencies
|
||||
$this->depends = array("modSociete");
|
||||
$this->requiredby = array();
|
||||
$this->langfiles = array('bills', 'companies', 'suppliers', 'orders');
|
||||
$this->langfiles = array('bills', 'companies', 'suppliers', 'orders', 'sendings');
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("supplier_order.php");
|
||||
@ -454,14 +454,14 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_label[$r]='Commandes fournisseurs et lignes de commandes';
|
||||
$this->export_icon[$r]='order';
|
||||
$this->export_permission[$r]=array(array("fournisseur","commande","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.date_livraison'=>"DateDeliveryPlanned",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
|
||||
'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel');
|
||||
if (empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED))
|
||||
{
|
||||
unset($this->export_fields_array['f.date_approve2']);
|
||||
unset($this->export_fields_array['ua2.login']);
|
||||
}
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label',
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.date_livraison'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label',
|
||||
'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product',
|
||||
'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');
|
||||
|
||||
@ -231,7 +231,7 @@ class modResource extends DolibarrModules
|
||||
'langs'=> 'resource',
|
||||
'position'=> 101,
|
||||
'enabled'=> '1',
|
||||
'perms'=> '$user->rights->resource->read',
|
||||
'perms'=> '$user->rights->resource->write',
|
||||
'target'=> '',
|
||||
'user'=> 0
|
||||
);
|
||||
@ -255,7 +255,7 @@ class modResource extends DolibarrModules
|
||||
// Exports
|
||||
//--------
|
||||
$r=0;
|
||||
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ResourceSingular"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
@ -265,19 +265,19 @@ class modResource extends DolibarrModules
|
||||
$this->export_entities_array[$r]=array('r.rowid'=>'resource','r.ref'=>'resource','c.code'=>'resource','c.label'=>'resource','r.description'=>'resource','r.note_private'=>"resource",'r.resource'=>"resource",'r.asset_number'=>'resource','r.datec'=>"resource",'r.tms'=>"resource");
|
||||
$keyforselect='resource'; $keyforelement='resource'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
|
||||
|
||||
$this->export_dependencies_array[$r]=array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'resource as r ';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid';
|
||||
$this->export_sql_end[$r] .=' AND r.entity IN ('.getEntity('resource').')';
|
||||
|
||||
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
$r=0;
|
||||
|
||||
|
||||
// Import list of third parties and attributes
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
@ -307,7 +307,7 @@ class modResource extends DolibarrModules
|
||||
$this->import_regex_array[$r]=array('s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
|
||||
$this->import_examplevalues_array[$r]=array('r.ref'=>"REF1",'r.fk_code_type_resource'=>"Code from dictionary resource type",'r.datec'=>"2017-01-01 or 2017-01-01 12:30:00");
|
||||
$this->import_updatekeys_array[$r]=array('r.rf'=>'ResourceFormLabel_ref');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -398,15 +398,16 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
|
||||
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $object->lines[$i]->qty, 0, 'R');
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $object->lines[$i]->qty, 0, 'R');
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
|
||||
// Unit
|
||||
@ -421,7 +422,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$pdf->SetXY($this->posxdiscount, $curY);
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $object->lines[$i]->remise_percent."%", 0, 'R');
|
||||
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
@ -1084,7 +1086,16 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
$carac_emetteur='';
|
||||
// Add internal contact of proposal if defined
|
||||
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
|
||||
@ -405,15 +405,16 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
|
||||
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
// Enough for 6 chars
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $object->lines[$i]->qty, 0, 'R');
|
||||
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $object->lines[$i]->qty, 0, 'R');
|
||||
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
|
||||
}
|
||||
|
||||
// Unit
|
||||
@ -428,7 +429,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY($this->posxdiscount, $curY);
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $object->lines[$i]->remise_percent."%", 0, 'R');
|
||||
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
@ -1133,8 +1135,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
// Sender properties
|
||||
$carac_emetteur='';
|
||||
// Add internal contact of proposal if defined
|
||||
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
|
||||
@ -60,7 +60,7 @@ if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center"
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if (count($extrafields->attribute_type))
|
||||
if (is_array($extrafields->attribute_type) && count($extrafields->attribute_type))
|
||||
{
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
|
||||
@ -216,7 +216,7 @@ if (empty($reshook))
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
if ($object->periode_existe($fuser,$object->date_debut,$object->date_fin))
|
||||
if (empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser,$object->date_debut,$object->date_fin))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors');
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.6'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.8'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ $cancelbutton = GETPOST('cancel');
|
||||
// Security check
|
||||
$id = (GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
||||
if ($user->societe_id) $id=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe&fournisseur', $id, '&societe');
|
||||
$result = restrictedArea($user, 'societe&fournisseur', $id, '&societe', '', 'rowid');
|
||||
|
||||
$object = new Fournisseur($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -107,7 +107,7 @@ if (empty($reshook))
|
||||
// Fill array 'array_options' with data from update form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
|
||||
|
||||
if ($ret < 0) $error++;
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -1401,7 +1401,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
$desc=trim($desc);
|
||||
$ref_supplier=''; // Ref of supplier price when we add line
|
||||
$ref_supplier=$fourn_ref; // Ref of supplier price when we add line
|
||||
|
||||
// Check parameters
|
||||
if ($qty < 1 && ! $fk_product)
|
||||
@ -1535,7 +1535,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->line->product_type=$product_type;
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
$this->line->subprice=$pu_ht;
|
||||
$this->line->rang=$this->rang;
|
||||
$this->line->rang=$rang;
|
||||
$this->line->info_bits=$info_bits;
|
||||
|
||||
$this->line->vat_src_code=$vat_src_code;
|
||||
@ -2961,6 +2961,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
public $fk_facture;
|
||||
public $label;
|
||||
public $rang = 0;
|
||||
public $special_code = 0;
|
||||
|
||||
/**
|
||||
* Unit price without taxes
|
||||
@ -3000,7 +3001,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
*/
|
||||
public function fetch($rowid)
|
||||
{
|
||||
$sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx,';
|
||||
$sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx, cd.special_code,';
|
||||
$sql.= ' cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.ref,';
|
||||
$sql.= ' cd.remise, cd.remise_percent, cd.subprice,';
|
||||
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,';
|
||||
@ -3039,6 +3040,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$this->total_localtax2 = $objp->total_localtax2;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->product_type = $objp->product_type;
|
||||
$this->special_code = $objp->special_code;
|
||||
|
||||
$this->ref = $objp->product_ref;
|
||||
$this->product_ref = $objp->product_ref;
|
||||
@ -3145,7 +3147,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
// Insertion dans base de la ligne
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " (fk_commande, label, description, date_start, date_end,";
|
||||
$sql.= " fk_product, product_type,";
|
||||
$sql.= " fk_product, product_type, special_code, rang,";
|
||||
$sql.= " qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,";
|
||||
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,";
|
||||
$sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc";
|
||||
@ -3156,6 +3158,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
if ($this->fk_product) { $sql.= $this->fk_product.","; }
|
||||
else { $sql.= "null,"; }
|
||||
$sql.= "'".$this->product_type."',";
|
||||
$sql.= "'".$this->special_code."',";
|
||||
$sql.= "'".$this->rang."',";
|
||||
$sql.= "'".$this->qty."', ";
|
||||
|
||||
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
|
||||
@ -3259,6 +3263,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$sql.= ", total_localtax2='".price2num($this->total_localtax2)."'";
|
||||
$sql.= ", total_ttc='".price2num($this->total_ttc)."'";
|
||||
$sql.= ", product_type=".$this->product_type;
|
||||
$sql.= ", special_code=".(!empty($this->special_code) ? $this->special_code : 0);
|
||||
$sql.= ($this->fk_unit ? ", fk_unit='".$this->db->escape($this->fk_unit)."'":", fk_unit=null");
|
||||
|
||||
// Multicurrency
|
||||
|
||||
@ -1383,6 +1383,11 @@ class FactureFournisseur extends CommonInvoice
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
|
||||
if ($rang < 0) {
|
||||
$rangmax = $this->line_max();
|
||||
$rang = $rangmax + 1;
|
||||
}
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
|
||||
|
||||
// Clean vat code
|
||||
|
||||
@ -1044,8 +1044,6 @@ if (empty($reshook))
|
||||
$fk_parent_line = 0;
|
||||
$num = count($lines);
|
||||
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
|
||||
for($i = 0; $i < $num; $i ++)
|
||||
{
|
||||
|
||||
@ -1053,7 +1051,7 @@ if (empty($reshook))
|
||||
continue;
|
||||
|
||||
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
|
||||
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle);
|
||||
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->product_desc);
|
||||
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
|
||||
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
@ -1068,45 +1066,42 @@ if (empty($reshook))
|
||||
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
||||
$array_option = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$tva_tx = $lines[$i]->tva_tx;
|
||||
|
||||
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid);
|
||||
if ($result>=0)
|
||||
if ($origin=="commande")
|
||||
{
|
||||
$tva_tx = $lines[$i]->tva_tx;
|
||||
|
||||
if ($origin=="commande")
|
||||
{
|
||||
$soc=new societe($db);
|
||||
$soc->fetch($socid);
|
||||
$tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id);
|
||||
}
|
||||
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0,
|
||||
$productsupplier->product_fourn_price_id,
|
||||
$productsupplier->ref_supplier,
|
||||
$lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$lines[$i]->product_type,
|
||||
'',
|
||||
'',
|
||||
null,
|
||||
null,
|
||||
array(),
|
||||
$lines[$i]->fk_unit,
|
||||
0,
|
||||
$element,
|
||||
!empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid
|
||||
);
|
||||
$soc=new societe($db);
|
||||
$soc->fetch($socid);
|
||||
$tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id);
|
||||
}
|
||||
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0,
|
||||
0,
|
||||
$lines[$i]->ref_fourn,
|
||||
$lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$lines[$i]->product_type,
|
||||
'',
|
||||
'',
|
||||
null,
|
||||
null,
|
||||
array(),
|
||||
$lines[$i]->fk_unit,
|
||||
0,
|
||||
$element,
|
||||
!empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid,
|
||||
$label
|
||||
);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
break;
|
||||
|
||||
@ -990,6 +990,8 @@ if (empty($reshook))
|
||||
$type = $productsupplier->type;
|
||||
$price_base_type = 'HT';
|
||||
|
||||
$rang = $object->line_max() +1;
|
||||
|
||||
// TODO Save the product supplier ref into database (like done for supplier propal and order) into field ref_supplier (must rename field ref into ref_supplier first)
|
||||
$result=$object->addline(
|
||||
$desc,
|
||||
@ -1006,7 +1008,7 @@ if (empty($reshook))
|
||||
$tva_npr,
|
||||
$price_base_type,
|
||||
$type,
|
||||
-1,
|
||||
$rang,
|
||||
0,
|
||||
$array_options,
|
||||
$productsupplier->fk_unit
|
||||
|
||||
@ -225,7 +225,7 @@ if ($step == 3 && $datatoimport)
|
||||
$param='&datatoimport='.$datatoimport.'&format='.$format;
|
||||
if ($excludefirstline) $param.='&excludefirstline='.$excludefirstline;
|
||||
if ($endatlinenb) $param.='&endatlinenb='.$endatlinenb;
|
||||
|
||||
|
||||
$file = $conf->import->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
@ -429,9 +429,9 @@ if ($step == 2 && $datatoimport)
|
||||
print '</table>';
|
||||
|
||||
print '</div><br>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
print '<form name="userfile" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" METHOD="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -450,7 +450,7 @@ if ($step == 2 && $datatoimport)
|
||||
$liste=$objmodelimport->liste_modeles($db);
|
||||
foreach($liste as $key)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_picto_common($key,$objmodelimport->getPictoForKey($key)).'</td>';
|
||||
$text=$objmodelimport->getDriverDescForKey($key);
|
||||
@ -495,7 +495,7 @@ if ($step == 3 && $datatoimport)
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
// Module
|
||||
@ -516,11 +516,11 @@ if ($step == 3 && $datatoimport)
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<b>'.$langs->trans("InformationOnSourceFile").'</b>';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<table width="100%" class="border">';
|
||||
@ -537,15 +537,15 @@ if ($step == 3 && $datatoimport)
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form name="userfile" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" METHOD="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
|
||||
|
||||
|
||||
print '<input type="hidden" value="'.$step.'" name="step">';
|
||||
print '<input type="hidden" value="'.$format.'" name="format">';
|
||||
print '<input type="hidden" value="'.$excludefirstline.'" name="excludefirstline">';
|
||||
@ -553,7 +553,7 @@ if ($step == 3 && $datatoimport)
|
||||
print '<input type="hidden" value="'.$separator.'" name="separator">';
|
||||
print '<input type="hidden" value="'.$enclosure.'" name="enclosure">';
|
||||
print '<input type="hidden" value="'.$datatoimport.'" name="datatoimport">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
|
||||
$filetoimport='';
|
||||
@ -613,7 +613,7 @@ if ($step == 3 && $datatoimport)
|
||||
$modulepart='import';
|
||||
$urlsource=$_SERVER["PHP_SELF"].'?step='.$step.$param.'&filetoimport='.urlencode($filetoimport);
|
||||
$relativepath=$file;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_mime($file).'</td>';
|
||||
print '<td>';
|
||||
@ -665,9 +665,9 @@ if ($step == 4 && $datatoimport)
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?step=3'.$param.'&filetoimport='.urlencode($relativepath));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (GETPOST('update')) {
|
||||
$array_match_file_to_database=array();
|
||||
}
|
||||
@ -772,9 +772,9 @@ if ($step == 4 && $datatoimport)
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<b>'.$langs->trans("InformationOnSourceFile").'</b>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
@ -820,9 +820,9 @@ if ($step == 4 && $datatoimport)
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<br>'."\n";
|
||||
|
||||
|
||||
@ -873,7 +873,7 @@ if ($step == 4 && $datatoimport)
|
||||
$lefti=1;
|
||||
foreach ($array_match_file_to_database as $key => $val)
|
||||
{
|
||||
|
||||
|
||||
show_elem($fieldssource,$key,$val,$var); // key is field number in source file
|
||||
//print '> '.$lefti.'-'.$key.'-'.$val;
|
||||
$listofkeys[$key]=1;
|
||||
@ -890,7 +890,7 @@ if ($step == 4 && $datatoimport)
|
||||
$num=count($fieldssource);
|
||||
while ($lefti <= $num)
|
||||
{
|
||||
|
||||
|
||||
$newkey=getnewkey($fieldssource,$listofkeys);
|
||||
show_elem($fieldssource,$newkey,'',$var); // key start after field number in source file
|
||||
//print '> '.$lefti.'-'.$newkey;
|
||||
@ -913,7 +913,7 @@ if ($step == 4 && $datatoimport)
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
foreach($fieldstarget as $code=>$label)
|
||||
{
|
||||
|
||||
|
||||
print '<tr '.$bc[$var].' height="'.$height.'">';
|
||||
|
||||
$i++;
|
||||
@ -1148,7 +1148,7 @@ if ($step == 4 && $datatoimport)
|
||||
$var=false;
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $obj->label;
|
||||
@ -1213,16 +1213,16 @@ if ($step == 5 && $datatoimport)
|
||||
if ($excludefirstline) $param.='&excludefirstline='.$excludefirstline;
|
||||
if ($endatlinenb) $param.='&endatlinenb='.$endatlinenb;
|
||||
if (!empty($updatekeys)) $param.='&updatekeys[]='.implode('&updatekeys[]=', $updatekeys);
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones');
|
||||
|
||||
$head = import_prepare_head($param,5);
|
||||
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param2.'" method="POST">';
|
||||
print '<input type="hidden" name="step" value="5">'; // step 5
|
||||
print '<input type="hidden" name="action" value="launchsimu">'; // step 5
|
||||
|
||||
|
||||
dol_fiche_head($head, 'step5', $langs->trans("NewImport"), -1);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
@ -1248,9 +1248,9 @@ if ($step == 5 && $datatoimport)
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<b>'.$langs->trans("InformationOnSourceFile").'</b>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
@ -1274,7 +1274,7 @@ if ($step == 5 && $datatoimport)
|
||||
print htmlentities($enclosure);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// File to import
|
||||
print '<tr><td>'.$langs->trans("FileToImport").'</td>';
|
||||
print '<td>';
|
||||
@ -1351,16 +1351,16 @@ if ($step == 5 && $datatoimport)
|
||||
print_r($objimport->array_import_updatekeys);
|
||||
echo '</pre>';*/
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<b>'.$langs->trans("InformationOnTargetTables").'</b>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnTargetTables").'</b></td></tr>';
|
||||
|
||||
@ -1426,7 +1426,7 @@ if ($step == 5 && $datatoimport)
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -1475,10 +1475,11 @@ if ($step == 5 && $datatoimport)
|
||||
$sourcelinenb=0; $endoffile=0;
|
||||
|
||||
// Loop on each input file record
|
||||
while ($sourcelinenb < $nboflines && ! $endoffile)
|
||||
while (($sourcelinenb < $nboflines) && ! $endoffile)
|
||||
{
|
||||
$sourcelinenb++;
|
||||
// Read line and stor it into $arrayrecord
|
||||
//dol_syslog("line ".$sourcelinenb.' - '.$nboflines.' - '.$excludefirstline.' - '.$endatlinenb);
|
||||
$arrayrecord=$obj->import_read_record();
|
||||
if ($arrayrecord === false)
|
||||
{
|
||||
@ -1487,11 +1488,11 @@ if ($step == 5 && $datatoimport)
|
||||
continue;
|
||||
}
|
||||
if ($excludefirstline && ($sourcelinenb < $excludefirstline)) continue;
|
||||
if ($endatlinenb && ($sourcelinenb > $endatlinenb)) continue;
|
||||
|
||||
if ($endatlinenb && ($sourcelinenb > $endatlinenb)) break;
|
||||
|
||||
// Run import
|
||||
$result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid,$updatekeys);
|
||||
|
||||
|
||||
if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors;
|
||||
if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings;
|
||||
if (! count($obj->errors) && ! count($obj->warnings)) $nbok++;
|
||||
@ -1505,7 +1506,7 @@ if ($step == 5 && $datatoimport)
|
||||
}
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
// Run the sql after import if defined
|
||||
//var_dump($objimport->array_import_run_sql_after[0]);
|
||||
if (! empty($objimport->array_import_run_sql_after[0]) && is_array($objimport->array_import_run_sql_after[0]))
|
||||
@ -1515,14 +1516,14 @@ if ($step == 5 && $datatoimport)
|
||||
{
|
||||
$i++;
|
||||
$resqlafterimport=$db->query($sqlafterimport);
|
||||
if (! $resqlafterimport)
|
||||
if (! $resqlafterimport)
|
||||
{
|
||||
$arrayoferrors['none'][]=array('lib'=>$langs->trans("Error running final request: ".$sqlafterimport));
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$db->rollback(); // We force rollback because this was just a simulation.
|
||||
|
||||
// Show OK
|
||||
@ -1613,7 +1614,7 @@ if ($step == 5 && $datatoimport)
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("RunImportFile").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
@ -1690,9 +1691,9 @@ if ($step == 6 && $datatoimport)
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<b>'.$langs->trans("InformationOnSourceFile").'</b><hr>';
|
||||
print '<table width="100%" class="border">';
|
||||
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnSourceFile").'</b></td></tr>';
|
||||
@ -1714,7 +1715,7 @@ if ($step == 6 && $datatoimport)
|
||||
print htmlentities($enclosure);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// File to import
|
||||
print '<tr><td>'.$langs->trans("FileToImport").'</td>';
|
||||
print '<td>';
|
||||
@ -1745,7 +1746,7 @@ if ($step == 6 && $datatoimport)
|
||||
print '</td><td>';
|
||||
print '<input type="text" size="4" name="endatlinenb" disabled="disabled" value="'.$endatlinenb.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@ -1848,11 +1849,11 @@ if ($step == 6 && $datatoimport)
|
||||
continue;
|
||||
}
|
||||
if ($excludefirstline && ($sourcelinenb < $excludefirstline)) continue;
|
||||
if ($endatlinenb && ($sourcelinenb > $endatlinenb)) continue;
|
||||
if ($endatlinenb && ($sourcelinenb > $endatlinenb)) break;
|
||||
|
||||
// Run import
|
||||
$result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid,$updatekeys);
|
||||
|
||||
|
||||
if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors;
|
||||
if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings;
|
||||
if (! count($obj->errors) && ! count($obj->warnings)) $nbok++;
|
||||
@ -1866,10 +1867,10 @@ if ($step == 6 && $datatoimport)
|
||||
}
|
||||
|
||||
if (count($arrayoferrors) > 0) $db->rollback(); // We force rollback because this was errors.
|
||||
else
|
||||
else
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
// Run the sql after import if defined
|
||||
//var_dump($objimport->array_import_run_sql_after[0]);
|
||||
if (! empty($objimport->array_import_run_sql_after[0]) && is_array($objimport->array_import_run_sql_after[0]))
|
||||
@ -1879,18 +1880,18 @@ if ($step == 6 && $datatoimport)
|
||||
{
|
||||
$i++;
|
||||
$resqlafterimport=$db->query($sqlafterimport);
|
||||
if (! $resqlafterimport)
|
||||
if (! $resqlafterimport)
|
||||
{
|
||||
$arrayoferrors['none'][]=array('lib'=>$langs->trans("Error running final request: ".$sqlafterimport));
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error) $db->commit(); // We can commit if no errors.
|
||||
else $db->rollback();
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -1930,7 +1931,7 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='')
|
||||
global $langs,$bc;
|
||||
|
||||
$height='24';
|
||||
|
||||
|
||||
print "\n\n<!-- Box ".$pos." start -->\n";
|
||||
print '<div class="box" style="padding: 0px 0px 0px 0px;" id="boxto_'.$pos.'">'."\n";
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ create table llx_expensereport_extrafields
|
||||
ALTER TABLE llx_expensereport_extrafields ADD INDEX idx_expensereport_extrafields (fk_object);
|
||||
|
||||
ALTER TABLE llx_cotisation RENAME TO llx_subscription;
|
||||
-- VPGSQL8.2 ALTER SEQUENCE IF EXISTS llx_cotisation_rowid_seq RENAME TO llx_subscription_rowid_seq;
|
||||
-- VPGSQL8.2 ALTER SEQUENCE llx_cotisation_rowid_seq RENAME TO llx_subscription_rowid_seq;
|
||||
|
||||
ALTER TABLE llx_subscription ADD UNIQUE INDEX uk_subscription (fk_adherent,dateadh);
|
||||
ALTER TABLE llx_subscription CHANGE COLUMN cotisation subscription real;
|
||||
|
||||
@ -242,7 +242,7 @@ UPDATE llx_bank_account SET accountancy_journal = 'OD' WHERE accountancy_journal
|
||||
ALTER TABLE llx_bank_account ADD COLUMN fk_accountancy_journal integer;
|
||||
ALTER TABLE llx_bank_account ADD INDEX idx_fk_accountancy_journal (fk_accountancy_journal);
|
||||
|
||||
UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15');
|
||||
UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code AND aj.entity = ba.entity) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15');
|
||||
ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
|
||||
|
||||
--Update general ledger for FEC format & harmonization
|
||||
@ -304,10 +304,10 @@ CREATE TABLE llx_accounting_bookkeeping_tmp
|
||||
date_validated datetime -- FEC:ValidDate
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_doc_date (doc_date);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_fk_docdet (fk_docdet);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_doc_date (doc_date);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_fk_docdet (fk_docdet);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_numero_compte (numero_compte);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_code_journal (code_journal);
|
||||
|
||||
|
||||
ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN debit double(24,8);
|
||||
@ -489,7 +489,7 @@ DELETE FROM llx_categorie_product WHERE fk_categorie NOT IN (SELECT rowid FROM l
|
||||
DELETE FROM llx_categorie_societe WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type IN (1, 2));
|
||||
DELETE FROM llx_categorie_member WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 3);
|
||||
DELETE FROM llx_categorie_contact WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 4);
|
||||
DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 5);
|
||||
DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 6);
|
||||
|
||||
ALTER TABLE llx_inventory ADD COLUMN ref varchar(48);
|
||||
|
||||
@ -520,6 +520,8 @@ ALTER TABLE llx_user_rights ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER r
|
||||
ALTER TABLE llx_user_rights DROP FOREIGN KEY fk_user_rights_fk_user_user;
|
||||
ALTER TABLE llx_user_rights DROP INDEX uk_user_rights;
|
||||
ALTER TABLE llx_user_rights DROP INDEX fk_user;
|
||||
-- VPGSQL8.4 ALTER TABLE llx_usergroup_rights DROP CONSTRAINT llx_user_rights_fk_user_userp_fk_id_key;
|
||||
-- VPGSQL8.4 ALTER TABLE llx_usergroup_rights DROP INDEX llx_user_rights_fk_user_user_fk_id_key;
|
||||
ALTER TABLE llx_user_rights ADD UNIQUE INDEX uk_user_rights (entity, fk_user, fk_id);
|
||||
DELETE FROM llx_user_rights WHERE fk_user NOT IN (select rowid from llx_user);
|
||||
ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
|
||||
@ -527,6 +529,8 @@ ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN K
|
||||
ALTER TABLE llx_usergroup_rights ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
|
||||
ALTER TABLE llx_usergroup_rights DROP FOREIGN KEY fk_usergroup_rights_fk_usergroup;
|
||||
ALTER TABLE llx_usergroup_rights DROP INDEX fk_usergroup;
|
||||
-- VPGSQL8.4 ALTER TABLE llx_usergroup_rights DROP CONSTRAINT llx_usergroup_rights_fk_usergroup_fk_id_key;
|
||||
-- VPGSQL8.4 ALTER TABLE llx_usergroup_rights DROP INDEX llx_usergroup_rights_fk_usergroup_fk_id_key;
|
||||
ALTER TABLE llx_usergroup_rights ADD UNIQUE INDEX uk_usergroup_rights (entity, fk_usergroup, fk_id);
|
||||
ALTER TABLE llx_usergroup_rights ADD CONSTRAINT fk_usergroup_rights_fk_usergroup FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid);
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ delete from llx_categorie_fournisseur where fk_categorie not in (select rowid fr
|
||||
delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type = 2);
|
||||
delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
|
||||
delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4);
|
||||
delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5);
|
||||
delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 6);
|
||||
|
||||
|
||||
-- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links.
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_doc_date (doc_date);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_fk_docdet (fk_docdet);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_numero_compte (numero_compte);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_code_journal (code_journal);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_doc_date (doc_date);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_fk_docdet (fk_docdet);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_numero_compte (numero_compte);
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp ADD INDEX idx_accounting_bookkeeping_tmp_code_journal (code_journal);
|
||||
|
||||
@ -24,10 +24,10 @@ CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP(TIMESTAMP WITHOUT TIME ZONE) RETURNS B
|
||||
|
||||
CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP(TIMESTAMP WITH TIME ZONE) RETURNS BIGINT LANGUAGE SQL IMMUTABLE STRICT AS 'SELECT EXTRACT(EPOCH FROM $1)::bigint;';
|
||||
|
||||
DROP FUNCTION date_format(timestamp without time zone,text);
|
||||
DROP FUNCTION IF EXISTS date_format(timestamp without time zone,text);
|
||||
CREATE OR REPLACE FUNCTION date_format(timestamp without time zone, text) RETURNS text AS $$ DECLARE i int := 1; temp text := ''; c text; n text; res text; BEGIN WHILE i <= pg_catalog.length($2) LOOP c := SUBSTRING ($2 FROM i FOR 1); IF c = '%' AND i != pg_catalog.length($2) THEN n := SUBSTRING ($2 FROM (i + 1) FOR 1); SELECT INTO res CASE WHEN n = 'a' THEN pg_catalog.to_char($1, 'Dy') WHEN n = 'b' THEN pg_catalog.to_char($1, 'Mon') WHEN n = 'c' THEN pg_catalog.to_char($1, 'FMMM') WHEN n = 'D' THEN pg_catalog.to_char($1, 'FMDDth') WHEN n = 'd' THEN pg_catalog.to_char($1, 'DD') WHEN n = 'e' THEN pg_catalog.to_char($1, 'FMDD') WHEN n = 'f' THEN pg_catalog.to_char($1, 'US') WHEN n = 'H' THEN pg_catalog.to_char($1, 'HH24') WHEN n = 'h' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'I' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'i' THEN pg_catalog.to_char($1, 'MI') WHEN n = 'j' THEN pg_catalog.to_char($1, 'DDD') WHEN n = 'k' THEN pg_catalog.to_char($1, 'FMHH24') WHEN n = 'l' THEN pg_catalog.to_char($1, 'FMHH12') WHEN n = 'M' THEN pg_catalog.to_char($1, 'FMMonth') WHEN n = 'm' THEN pg_catalog.to_char($1, 'MM') WHEN n = 'p' THEN pg_catalog.to_char($1, 'AM') WHEN n = 'r' THEN pg_catalog.to_char($1, 'HH12:MI:SS AM') WHEN n = 'S' THEN pg_catalog.to_char($1, 'SS') WHEN n = 's' THEN pg_catalog.to_char($1, 'SS') WHEN n = 'T' THEN pg_catalog.to_char($1, 'HH24:MI:SS') WHEN n = 'U' THEN pg_catalog.to_char($1, '?') WHEN n = 'u' THEN pg_catalog.to_char($1, '?') WHEN n = 'V' THEN pg_catalog.to_char($1, '?') WHEN n = 'v' THEN pg_catalog.to_char($1, '?') WHEN n = 'W' THEN pg_catalog.to_char($1, 'FMDay') WHEN n = 'w' THEN EXTRACT(DOW FROM $1)::text WHEN n = 'X' THEN pg_catalog.to_char($1, '?') WHEN n = 'x' THEN pg_catalog.to_char($1, '?') WHEN n = 'Y' THEN pg_catalog.to_char($1, 'YYYY') WHEN n = 'y' THEN pg_catalog.to_char($1, 'YY') WHEN n = '%' THEN pg_catalog.to_char($1, '%') ELSE NULL END; temp := temp operator(pg_catalog.||) res; i := i + 2; ELSE temp = temp operator(pg_catalog.||) c; i := i + 1; END IF; END LOOP; RETURN temp; END $$ IMMUTABLE STRICT LANGUAGE plpgsql;
|
||||
|
||||
DROP FUNCTION date_format(timestamp with time zone,text);
|
||||
DROP FUNCTION IF EXISTS date_format(timestamp with time zone,text);
|
||||
CREATE OR REPLACE FUNCTION date_format(timestamp with time zone, text) RETURNS text AS $$ DECLARE i int := 1; temp text := ''; c text; n text; res text; BEGIN WHILE i <= pg_catalog.length($2) LOOP c := SUBSTRING ($2 FROM i FOR 1); IF c = '%' AND i != pg_catalog.length($2) THEN n := SUBSTRING ($2 FROM (i + 1) FOR 1); SELECT INTO res CASE WHEN n = 'a' THEN pg_catalog.to_char($1, 'Dy') WHEN n = 'b' THEN pg_catalog.to_char($1, 'Mon') WHEN n = 'c' THEN pg_catalog.to_char($1, 'FMMM') WHEN n = 'D' THEN pg_catalog.to_char($1, 'FMDDth') WHEN n = 'd' THEN pg_catalog.to_char($1, 'DD') WHEN n = 'e' THEN pg_catalog.to_char($1, 'FMDD') WHEN n = 'f' THEN pg_catalog.to_char($1, 'US') WHEN n = 'H' THEN pg_catalog.to_char($1, 'HH24') WHEN n = 'h' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'I' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'i' THEN pg_catalog.to_char($1, 'MI') WHEN n = 'j' THEN pg_catalog.to_char($1, 'DDD') WHEN n = 'k' THEN pg_catalog.to_char($1, 'FMHH24') WHEN n = 'l' THEN pg_catalog.to_char($1, 'FMHH12') WHEN n = 'M' THEN pg_catalog.to_char($1, 'FMMonth') WHEN n = 'm' THEN pg_catalog.to_char($1, 'MM') WHEN n = 'p' THEN pg_catalog.to_char($1, 'AM') WHEN n = 'r' THEN pg_catalog.to_char($1, 'HH12:MI:SS AM') WHEN n = 'S' THEN pg_catalog.to_char($1, 'SS') WHEN n = 's' THEN pg_catalog.to_char($1, 'SS') WHEN n = 'T' THEN pg_catalog.to_char($1, 'HH24:MI:SS') WHEN n = 'U' THEN pg_catalog.to_char($1, '?') WHEN n = 'u' THEN pg_catalog.to_char($1, '?') WHEN n = 'V' THEN pg_catalog.to_char($1, '?') WHEN n = 'v' THEN pg_catalog.to_char($1, '?') WHEN n = 'W' THEN pg_catalog.to_char($1, 'FMDay') WHEN n = 'w' THEN EXTRACT(DOW FROM $1)::text WHEN n = 'X' THEN pg_catalog.to_char($1, '?') WHEN n = 'x' THEN pg_catalog.to_char($1, '?') WHEN n = 'Y' THEN pg_catalog.to_char($1, 'YYYY') WHEN n = 'y' THEN pg_catalog.to_char($1, 'YY') WHEN n = '%' THEN pg_catalog.to_char($1, '%') ELSE NULL END; temp := temp operator(pg_catalog.||) res; i := i + 2; ELSE temp = temp operator(pg_catalog.||) c; i := i + 1; END IF; END LOOP; RETURN temp; END $$ IMMUTABLE STRICT LANGUAGE plpgsql;
|
||||
|
||||
|
||||
|
||||
@ -422,11 +422,11 @@ if ($id > 0)
|
||||
|
||||
print '<script type="text/javascript">' . "\n";
|
||||
print ' function popEcheancier() {' . "\n";
|
||||
print ' $div = $(\'<div id="popCalendar"><iframe width="100%" height="100%" frameborder="0" src="createschedule.php?loanid=' . $object->id . '"></iframe></div>\');' . "\n";
|
||||
print ' $div = $(\'<div id="popCalendar"><iframe width="100%" height="98%" frameborder="0" src="createschedule.php?loanid=' . $object->id . '"></iframe></div>\');' . "\n";
|
||||
print ' $div.dialog({' . "\n";
|
||||
print ' modal:true' . "\n";
|
||||
print ' ,width:"90%"' . "\n";
|
||||
print ' ,height:$(window).height() - 150' . "\n";
|
||||
print ' ,height:$(window).height() - 160' . "\n";
|
||||
print ' });' . "\n";
|
||||
print ' }' . "\n";
|
||||
print '</script>';
|
||||
|
||||
@ -22,14 +22,11 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||
|
||||
global $user;
|
||||
|
||||
$loanid = GETPOST('loanid', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
@ -107,6 +104,7 @@ $(document).ready(function() {
|
||||
var idcap=echeance-1;
|
||||
idcap = '#hi_capital'+idcap;
|
||||
var capital=$(idcap).val();
|
||||
console.log("Change montly amount echeance="+echeance+" idcap="+idcap+" capital="+capital);
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
url: 'calcmens.php',
|
||||
@ -135,50 +133,59 @@ $(document).ready(function() {
|
||||
print '<form name="createecheancier" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="loanid" value="' . $loanid . '">';
|
||||
if(count($echeance->lines)>0){
|
||||
if(count($echeance->lines)>0)
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updateecheancier">';
|
||||
}else{
|
||||
print '<input type="hidden" name="action" value="createecheancier">';
|
||||
}
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th align="center" colspan="5">' . "Création d'échéancier</th>";
|
||||
print '<th align="center" colspan="5">';
|
||||
print $langs->trans("FinancialCommitment");
|
||||
print '</th>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
Print '<th width="10%" align="center"> Echéance </th>';
|
||||
Print '<th width="10%" align="center"> Date </th>';
|
||||
Print '<th width="10%" align="center"> Montant </th>';
|
||||
Print '<th width="20%" align="center"> Intérêts </th>';
|
||||
Print '<th width="40%" align="center"> Capital restant du </th>';
|
||||
print '</tr>';
|
||||
Print '<th width="10%" align="center">'.$langs->trans("DueDate").'</th>';
|
||||
Print '<th width="10%" align="center">'.$langs->trans("Date").'</th>';
|
||||
Print '<th width="10%" align="center">'.$langs->trans("Amount").'</th>';
|
||||
Print '<th width="20%" align="center">'.$langs->trans("InterestAmount").'</th>';
|
||||
Print '<th width="40%" align="center">'.$langs->trans("Remain");
|
||||
print ' ('.price2num($object->capital).')';
|
||||
print '<input type="hidden" name="hi_capital0" id ="hi_capital0" value="'.$object->capital.'">';
|
||||
print '</th>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
if ($object->nbterm > 0 && count($echeance->lines)==0)
|
||||
{
|
||||
$i=1;
|
||||
$capital = $object->capital;
|
||||
while($i <$object->nbterm+1){
|
||||
$mens = round($echeance->calc_mens($capital, $object->rate/100, $object->nbterm-$i+1),2,PHP_ROUND_HALF_UP);
|
||||
while($i <$object->nbterm+1)
|
||||
{
|
||||
$mens = price2num($echeance->calc_mens($capital, $object->rate/100, $object->nbterm-$i+1), 'MT');
|
||||
$int = ($capital*($object->rate/12))/100;
|
||||
$int = round($int,2,PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens-$int),2,PHP_ROUND_HALF_UP);
|
||||
$int = price2num($int, 'MT');
|
||||
$cap_rest = price2num($capital - ($mens-$int), 'MT');
|
||||
print '<tr>';
|
||||
print '<td align="center" id="n'.$i.'">' . $i .'</td>';
|
||||
print '<td align="center" id ="date' .$i .'"><input type="hidden" name="hi_date' .$i .'" id ="hi_date' .$i .'" value="' . dol_time_plus_duree($object->datestart, $i-1, 'm') . '">' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'),'day') . '</td>';
|
||||
print '<td align="center"><input name="mens'.$i.'" id="mens'.$i.'" size="5" value="'.$mens.'" ech="'.$i.'"> €</td>';
|
||||
print '<td align="center" id="interets'.$i.'">'.price($int,0,'',1).' €</td><input type="hidden" name="hi_interets' .$i .'" id ="hi_interets' .$i .'" value="' . $int . '">';
|
||||
print '<td align="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital' .$i .'" id ="hi_capital' .$i .'" value="' . $cap_rest . '">';
|
||||
print '</tr>';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$capital = $cap_rest;
|
||||
}
|
||||
}elseif(count($echeance->lines)>0){
|
||||
}
|
||||
elseif(count($echeance->lines)>0)
|
||||
{
|
||||
$i=1;
|
||||
$capital = $object->capital;
|
||||
foreach ($echeance->lines as $line){
|
||||
$mens = $line->amount_capital+$line->amount_insurance+$line->amount_interest;
|
||||
$int = $line->amount_interest;
|
||||
$cap_rest = round($capital - ($mens-$int),2,PHP_ROUND_HALF_UP);
|
||||
$cap_rest = price2num($capital - ($mens-$int), 'MT');
|
||||
print '<tr>';
|
||||
print '<td align="center" id="n'.$i.'"><input type="hidden" name="hi_rowid' .$i .'" id ="hi_rowid' .$i .'" value="' . $line->id . '">' . $i .'</td>';
|
||||
print '<td align="center" id ="date' .$i .'"><input type="hidden" name="hi_date' .$i .'" id ="hi_date' .$i .'" value="' . $line->datep . '">' . dol_print_date($line->datep,'day') . '</td>';
|
||||
@ -189,7 +196,7 @@ if ($object->nbterm > 0 && count($echeance->lines)==0)
|
||||
}
|
||||
print '<td align="center" id="interets'.$i.'">'.price($int,0,'',1).' €</td><input type="hidden" name="hi_interets' .$i .'" id ="hi_interets' .$i .'" value="' . $int . '">';
|
||||
print '<td align="center" id="capital'.$i.'">'.price($cap_rest).' €</td><input type="hidden" name="hi_capital' .$i .'" id ="hi_capital' .$i .'" value="' . $cap_rest . '">';
|
||||
print '</tr>';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$capital = $cap_rest;
|
||||
}
|
||||
|
||||
@ -158,6 +158,8 @@ if ($action == 'order' && isset($_POST['valid']))
|
||||
$line->total_ttc = $line->total_ht + $line->total_tva;
|
||||
$line->remise_percent = $obj->remise_percent;
|
||||
$line->ref_fourn = $obj->ref_fourn;
|
||||
$line->type = $product->type;
|
||||
$line->fk_unit = $product->fk_unit;
|
||||
$suppliers[$obj->fk_soc]['lines'][] = $line;
|
||||
}
|
||||
}
|
||||
@ -202,7 +204,13 @@ if ($action == 'order' && isset($_POST['valid']))
|
||||
$line->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$line->info_bits
|
||||
$line->type,
|
||||
0,
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
$line->fk_unit
|
||||
);
|
||||
}
|
||||
if ($result < 0) {
|
||||
|
||||
@ -251,7 +251,7 @@ if ($action == 'edit')
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
|
||||
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
@ -49,7 +49,8 @@ $projectid=isset($_GET["id"])?$_GET["id"]:$_POST["projectid"];
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
// For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
//if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'projet', $projectid);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
@ -50,7 +50,8 @@ $projectid=isset($_GET["id"])?$_GET["id"]:$_POST["projectid"];
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
// For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
// if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'projet', $projectid);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
@ -629,45 +629,13 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Delete tasks
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_time";
|
||||
$sql.= " WHERE fk_task IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")";
|
||||
// Fetch tasks
|
||||
$this->getLinesArray($user);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields";
|
||||
$sql.= " WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task";
|
||||
$sql.= " WHERE fk_projet=" . $this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// Delete tasks
|
||||
foreach($this->lines as &$task) {
|
||||
$task->delete($user);
|
||||
}
|
||||
|
||||
// Delete project
|
||||
if (! $error)
|
||||
@ -1694,23 +1662,26 @@ class Project extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$mine=0; $socid=$user->societe_id;
|
||||
|
||||
$projectsListId = $this->getProjectsAuthorizedForUser($user,$mine?$mine:($user->rights->projet->all->lire?2:0),1,$socid);
|
||||
// For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
//$socid=$user->societe_id;
|
||||
|
||||
if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user,0,1,$socid);
|
||||
|
||||
$sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= ")";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
|
||||
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.fk_statut = 1";
|
||||
$sql.= " AND p.entity IN (".getEntity('project', 0).')';
|
||||
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
|
||||
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
|
||||
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
|
||||
//print $sql;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -1701,29 +1701,31 @@ class Task extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$mine=0; $socid=$user->societe_id;
|
||||
|
||||
// For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
//$socid=$user->societe_id;
|
||||
|
||||
$projectstatic = new Project($this->db);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
|
||||
|
||||
// List of tasks (does not care about permissions. Filtering will be done later)
|
||||
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
|
||||
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
|
||||
$sql.= " t.dateo as date_start, t.datee as datee";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
|
||||
$sql.= " AND p.fk_statut = 1";
|
||||
$sql.= " AND t.fk_projet = p.rowid";
|
||||
$sql.= " AND t.progress < 100"; // tasks to do
|
||||
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
//print $sql;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
|
||||
$sql.= " AND p.fk_statut = 1";
|
||||
$sql.= " AND t.fk_projet = p.rowid";
|
||||
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
// if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
|
||||
//print $sql;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -49,6 +49,7 @@ $socid=0;
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
$result = restrictedArea($user, 'projet', $id,'projet&project');
|
||||
|
||||
$hookmanager->initHooks(array('projectcontactcard','globalcard'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -150,26 +151,26 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
|
||||
// Project card
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Title
|
||||
$morehtmlref.=$object->title;
|
||||
// Thirdparty
|
||||
if ($object->thirdparty->id > 0)
|
||||
if ($object->thirdparty->id > 0)
|
||||
{
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
||||
}
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
@ -178,7 +179,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Visibility
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($object->public) print $langs->trans('SharedProject');
|
||||
@ -192,7 +193,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
|
||||
if ($code) print $langs->trans("OppStatus".$code);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Opportunity percent
|
||||
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
|
||||
if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %';
|
||||
@ -203,7 +204,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Date start - end
|
||||
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
|
||||
$start = dol_print_date($object->date_start,'dayhour');
|
||||
@ -222,40 +223,40 @@ if ($id > 0 || ! empty($ref))
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Description
|
||||
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print nl2br($object->description);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
||||
print $form->showCategories($object->id,'project',1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
|
||||
@ -145,7 +145,7 @@ $morehtmlref.='</div>';
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
||||
$object->next_prev_filter=" te.rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
@ -668,6 +668,7 @@ while ($i < min($num,$limit))
|
||||
$object->datee = $db->jdate($obj->date_end);
|
||||
$object->statut = $obj->fk_statut;
|
||||
$object->opp_status = $obj->fk_opp_status;
|
||||
$object->title = $obj->title;
|
||||
|
||||
$userAccess = $object->restrictedProjectArea($user); // why this ?
|
||||
if ($userAccess >= 0)
|
||||
|
||||
@ -77,7 +77,9 @@ $planned_workload=$planned_workloadhour*3600+$planned_workloadmin*60;
|
||||
$userAccess=0;
|
||||
|
||||
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
@ -756,7 +756,7 @@ while ($i < min($num,$limit))
|
||||
$showlineingray=0;$showproject=1;
|
||||
print '<td class="center">';
|
||||
if ($showlineingray) print '<i>';
|
||||
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">';
|
||||
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.($showproject?'':'&withproject=1').'">';
|
||||
if ($obj->duration_effective) print convertSecondToTime($obj->duration_effective,$timespentoutputformat);
|
||||
else print '--:--';
|
||||
if ($showlineingray) print '</i>';
|
||||
|
||||
@ -60,6 +60,9 @@ $projectstatic = new Project($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
@ -72,7 +73,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('thirdpartycard','globalcard'));
|
||||
|
||||
if ($action == 'view' && $object->fetch($socid)<=0)
|
||||
if ($object->fetch($socid)<=0 && $action == 'view')
|
||||
{
|
||||
$langs->load("errors");
|
||||
print($langs->trans('ErrorRecordNotFound'));
|
||||
@ -291,11 +292,15 @@ if (empty($reshook))
|
||||
// Fill array 'array_options' with data from update form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0) { $error++; }
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
$errors = $object->errors;
|
||||
}
|
||||
}
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
@ -2511,21 +2511,16 @@ class Societe extends CommonObject
|
||||
|
||||
if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON))
|
||||
{
|
||||
$file='';
|
||||
$res=false;
|
||||
$dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
|
||||
foreach ($dirsociete as $dirroot)
|
||||
{
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php"))
|
||||
{
|
||||
$file=$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php";
|
||||
break;
|
||||
}
|
||||
$res=dol_include_once($dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.'.php');
|
||||
if ($res) break;
|
||||
}
|
||||
|
||||
if (! empty($file))
|
||||
if ($res)
|
||||
{
|
||||
dol_include_once($file);
|
||||
|
||||
$classname = $conf->global->SOCIETE_CODECOMPTA_ADDON;
|
||||
$mod = new $classname;
|
||||
|
||||
|
||||
@ -465,15 +465,6 @@ if (empty($reshook))
|
||||
// Action for direct print
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfromsupplierproposal';
|
||||
$trackid='spr'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
|
||||
// Go back to draft
|
||||
if ($action == 'modif' && $user->rights->supplier_proposal->creer)
|
||||
{
|
||||
@ -876,46 +867,20 @@ if (empty($reshook))
|
||||
exit();
|
||||
}
|
||||
|
||||
// Generation doc (depuis lien ou depuis cartouche doc)
|
||||
else if ($action == 'builddoc' && $user->rights->supplier_proposal->creer) {
|
||||
if (GETPOST('model')) {
|
||||
$object->setDocModel($user, GETPOST('model'));
|
||||
}
|
||||
// Actions to send emails
|
||||
$trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfromsupplierproposal';
|
||||
$trackid='spr'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file' && $user->rights->supplier_proposal->creer) {
|
||||
if ($object->id > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->supplier_proposal->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
if ($ret)
|
||||
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||
else
|
||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||
}
|
||||
}
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->supplier_proposal->dir_output;
|
||||
$permissioncreate=$user->rights->supplier_proposal->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Set project
|
||||
else if ($action == 'classin' && $user->rights->supplier_proposal->creer) {
|
||||
if ($action == 'classin' && $user->rights->supplier_proposal->creer) {
|
||||
$object->setProject($_POST['projectid']);
|
||||
}
|
||||
|
||||
|
||||
@ -75,6 +75,9 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||
$canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read);
|
||||
$caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write);
|
||||
}
|
||||
if(! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$caneditgroup = $conf->entity == 1 && ! empty($user->admin) && empty($user->entity);
|
||||
}
|
||||
// Define value to know what current user can do on properties of edited user
|
||||
if ($id)
|
||||
{
|
||||
@ -1791,41 +1794,21 @@ else
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><th class="liste_titre" width="25%">'.$langs->trans("Groups").'</th>'."\n";
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Entity").'</td>';
|
||||
}
|
||||
print '<th align="right">';
|
||||
if ($caneditgroup)
|
||||
{
|
||||
// Users/Groups management only in master entity if transverse mode
|
||||
if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity);
|
||||
print ' ';
|
||||
// Multicompany
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
if ($conf->entity == 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)
|
||||
{
|
||||
print '</td><td>'.$langs->trans("Entity").'</td>';
|
||||
print "<td>".$mc->select_entities($conf->entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
||||
}
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" />';
|
||||
}
|
||||
if ($caneditgroup) {
|
||||
print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity);
|
||||
}
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
print '</th><th>' . $langs->trans("Entity");
|
||||
|
||||
if ($caneditgroup) {
|
||||
print '</th><th>' . $mc->select_entities($conf->entity, 'entity');
|
||||
}
|
||||
}
|
||||
|
||||
if ($caneditgroup) {
|
||||
print ' <input type="submit" class="button" value="' . $langs->trans("Add") . '" />';
|
||||
}
|
||||
print '</th></tr>'."\n";
|
||||
|
||||
@ -1849,40 +1832,46 @@ else
|
||||
print img_object($langs->trans("ShowGroup"),"group").' '.$group->name;
|
||||
}
|
||||
print '</td>';
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
print '<td class="valeur">';
|
||||
if (! empty($group->usergroup_entity))
|
||||
{
|
||||
$nb=0;
|
||||
foreach($group->usergroup_entity as $group_entity)
|
||||
{
|
||||
$mc->getInfo($group_entity);
|
||||
print ($nb > 0 ? ', ' : '').$mc->label;
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removegroup&group='.$group->id.'&entity='.$group_entity.'">';
|
||||
print img_delete($langs->trans("RemoveFromGroup"));
|
||||
print '</a>';
|
||||
$nb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<td align="right">';
|
||||
if ($caneditgroup && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removegroup&group='.$group->id.'">';
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
print '</td><td class="valeur">';
|
||||
|
||||
if (! empty($group->usergroup_entity)) {
|
||||
$nb = 0;
|
||||
foreach ($group->usergroup_entity as $group_entity) {
|
||||
$mc->getInfo($group_entity);
|
||||
print ($nb > 0 ? ', ' : '') . $mc->label;
|
||||
|
||||
if ($conf->entity == 1 && ! empty($user->admin) && empty($user->entity)) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=removegroup&group=' . $group->id . '&entity=' . $group_entity . '">';
|
||||
print img_delete($langs->trans("RemoveFromGroup"));
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
$nb ++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($caneditgroup) {
|
||||
print '</td><td>';
|
||||
}
|
||||
} elseif ($caneditgroup) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=removegroup&group=' . $group->id . '">';
|
||||
print img_delete($langs->trans("RemoveFromGroup"));
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
$colspan = 2;
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$colspan ++;
|
||||
if ($caneditgroup) $colspan ++;
|
||||
}
|
||||
|
||||
print '<tr ' . $bc[false] . '><td colspan="' . $colspan . '" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
@ -2001,7 +1990,7 @@ else
|
||||
}
|
||||
else if ($caneditpassword)
|
||||
{
|
||||
$text='<input size="12" maxlength="32" type="password" class="flat" name="password" value="'.$object->pass.'" autocomplete="off">';
|
||||
$text='<input size="12" maxlength="32" type="password" class="flat" name="password" value="'.$object->pass.'" autocomplete="new-password">';
|
||||
if ($dolibarr_main_authentication && $dolibarr_main_authentication == 'http')
|
||||
{
|
||||
$text=$form->textwithpicto($text,$langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless",$dolibarr_main_authentication),1,'warning');
|
||||
|
||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$id = GETPOST('id');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
if (!$id) {
|
||||
print json_encode(array(
|
||||
|
||||
@ -383,7 +383,7 @@ if (! empty($id) || ! empty($ref))
|
||||
|
||||
select.empty().append('<option value="">Loading...</option>');
|
||||
|
||||
jQuery.getJSON("<?php echo dol_buildpath('/variants/ajax/get_attribute_values.php', 2) ?>", {
|
||||
jQuery.getJSON("ajax/get_attribute_values.php", {
|
||||
id: jQuery(this).val()
|
||||
}, function(data) {
|
||||
if (data.error) {
|
||||
@ -699,8 +699,12 @@ if (! empty($id) || ! empty($ref))
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
llxHeader();
|
||||
// not found
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -104,6 +104,7 @@ function migrate_product_photospath($product)
|
||||
global $conf;
|
||||
|
||||
$dir = $conf->product->multidir_output[$product->entity];
|
||||
$conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO = 1;
|
||||
$origin = $dir .'/'. get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
|
||||
$destin = $dir.'/'.dol_sanitizeFileName($product->ref);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user