This commit is contained in:
Maxime Kohlhaas 2017-07-09 10:13:02 +02:00
commit ba283377b9
21 changed files with 701 additions and 617 deletions

View File

@ -1129,7 +1129,7 @@ class BookKeeping extends CommonObject
global $user; global $user;
$error = 0; $error = 0;
$object = new Accountingbookkeeping($this->db); $object = new BookKeeping($this->db);
$this->db->begin(); $this->db->begin();

View File

@ -1360,8 +1360,8 @@ class Commande extends CommonOrder
$this->line->vat_src_code=$vat_src_code; $this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva; $this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1; $this->line->localtax1_tx=$localtaxes_type[1];
$this->line->localtax2_tx=$txlocaltax2; $this->line->localtax2_tx=$localtaxes_type[3];
$this->line->localtax1_type=$localtaxes_type[0]; $this->line->localtax1_type=$localtaxes_type[0];
$this->line->localtax2_type=$localtaxes_type[2]; $this->line->localtax2_type=$localtaxes_type[2];
$this->line->fk_product=$fk_product; $this->line->fk_product=$fk_product;

View File

@ -479,6 +479,7 @@ if ($resql)
$i = 0; $i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';

View File

@ -279,7 +279,7 @@ class Cpaiement
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$line = new CpaiementLine(); $line = new Cpaiement();
$line->id = $obj->id; $line->id = $obj->id;

View File

@ -196,7 +196,6 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
{ {
$result=$object->fetch($id); $result=$object->fetch($id);
$object->lib=GETPOST('label');
$object->date_ech=$dateech; $object->date_ech=$dateech;
$object->periode=$dateperiod; $object->periode=$dateperiod;
$object->amount=price2num($amount); $object->amount=price2num($amount);

View File

@ -228,7 +228,7 @@ class Contrat extends CommonObject
*/ */
function active_line($user, $line_id, $date, $date_end='', $comment='') function active_line($user, $line_id, $date, $date_end='', $comment='')
{ {
$this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); return $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
} }
@ -243,7 +243,7 @@ class Contrat extends CommonObject
*/ */
function close_line($user, $line_id, $date_end, $comment='') function close_line($user, $line_id, $date_end, $comment='')
{ {
$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); return $this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment);
} }

View File

@ -600,6 +600,20 @@ abstract class CommonObject
$datecreate = dol_now(); $datecreate = dol_now();
// Socpeople must have already been added by some a trigger, then we have to check it to avoid DB_ERROR_RECORD_ALREADY_EXISTS error
$TListeContacts=$this->liste_contact(-1, $source);
$already_added=false;
if(!empty($TListeContacts)) {
foreach($TListeContacts as $array_contact) {
if($array_contact['status'] == 4 && $array_contact['id'] == $fk_socpeople && $array_contact['fk_c_type_contact'] == $id_type_contact) {
$already_added=true;
break;
}
}
}
if(!$already_added) {
$this->db->begin(); $this->db->begin();
// Insertion dans la base // Insertion dans la base
@ -632,6 +646,7 @@ abstract class CommonObject
{ {
$this->error=$this->db->errno(); $this->error=$this->db->errno();
$this->db->rollback(); $this->db->rollback();
echo 'err rollback';
return -2; return -2;
} }
else else
@ -641,6 +656,7 @@ abstract class CommonObject
return -1; return -1;
} }
} }
} else return 0;
} }
/** /**

View File

@ -3892,7 +3892,7 @@ function getTaxesFromId($vatrowid)
* @param Societe $buyer Company object * @param Societe $buyer Company object
* @param Societe $seller Company object * @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is id into table (use this if you can) * @param int $firstparamisid 1 if first param is id into table (use this if you can)
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp) * @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp)
*/ */
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0) function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
{ {

View File

@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier
/** /**
* Class to manage customer payment numbering rules Ant * Class to manage customer payment numbering rules Ant
*/ */
class mod_supplier_payment_brodator extends ModeleNumRefPayments class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
{ {
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
var $error = ''; var $error = '';

View File

@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_payment/modules_supplier
/** /**
* Class to manage customer payment numbering rules Cicada * Class to manage customer payment numbering rules Cicada
*/ */
class mod_supplier_payment_bronan extends ModeleNumRefPayments class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
{ {
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
var $prefix='SPAY'; var $prefix='SPAY';

View File

@ -17,11 +17,11 @@
*/ */
/** /**
* \class ModeleNumRefPayments * \class ModeleNumRefSupplierPayments
* \brief Payment numbering references mother class * \brief Payment numbering references mother class
*/ */
abstract class ModeleNumRefPayments abstract class ModeleNumRefSupplierPayments
{ {
var $error=''; var $error='';

View File

@ -935,7 +935,8 @@ if (empty($reshook))
$object_ligne = new ExpenseReportLine($db); $object_ligne = new ExpenseReportLine($db);
$vatrate = GETPOST('vatrate'); $vatrate = GETPOST('vatrate','alpha'); // May be 8.5* (8.5NPROM)
$object_ligne->comments = GETPOST('comments'); $object_ligne->comments = GETPOST('comments');
$qty = GETPOST('qty','int'); $qty = GETPOST('qty','int');
if (empty($qty)) $qty=1; if (empty($qty)) $qty=1;
@ -998,13 +999,34 @@ if (empty($reshook))
$object_ligne->fk_expensereport = $_POST['fk_expensereport']; $object_ligne->fk_expensereport = $_POST['fk_expensereport'];
$type = 0; // TODO What if service ? $type = 0; // TODO What if service ?
$seller = ''; // seller is unknown
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller);
// We don't know seller and buyer for expense reports
$seller = $mysoc;
$buyer = new Societe($db);
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$buyer,$seller);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $vatrate, $reg))
{
$vat_src_code = $reg[1];
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
}
$vatrate = preg_replace('/\*/','',$vatrate);
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
$object_ligne->vat_src_code = $vat_src_code;
$object_ligne->vatrate = price2num($vatrate); $object_ligne->vatrate = price2num($vatrate);
$object_ligne->total_ttc = $tmp[2]; $object_ligne->total_ttc = $tmp[2];
$object_ligne->total_ht = $tmp[0]; $object_ligne->total_ht = $tmp[0];
$object_ligne->total_tva = $tmp[1]; $object_ligne->total_tva = $tmp[1];
$object_ligne->localtax1_tx = $localtaxes_type[1];
$object_ligne->localtax2_tx = $localtaxes_type[3];
$object_ligne->localtax1_type = $localtaxes_type[0];
$object_ligne->localtax2_type = $localtaxes_type[2];
$result = $object_ligne->insert(); $result = $object_ligne->insert();
if ($result > 0) if ($result > 0)
@ -1942,7 +1964,9 @@ else
// VAT // VAT
print '<td style="text-align:right;">'; print '<td style="text-align:right;">';
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$objp->vatrate), $mysoc, ''); $seller=$mysoc;
$buyer=new Societe($db);
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$objp->vatrate), $seller, $buyer, 0, 0, '', false, 1);
print '</td>'; print '</td>';
// Unit price // Unit price
@ -2028,7 +2052,7 @@ else
print '<td align="right">'; print '<td align="right">';
$defaultvat=-1; $defaultvat=-1;
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false); print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1);
print '</td>'; print '</td>';
// Unit price // Unit price

View File

@ -1359,7 +1359,7 @@ class ExpenseReport extends CommonObject
* @param int $rowid Line to edit * @param int $rowid Line to edit
* @param int $type_fees_id Type payment * @param int $type_fees_id Type payment
* @param int $projet_id Project id * @param int $projet_id Project id
* @param double $vatrate Vat rate * @param double $vatrate Vat rate. Can be '8.5* (8.5NPROM...)'
* @param string $comments Description * @param string $comments Description
* @param real $qty Qty * @param real $qty Qty
* @param double $value_unit Value init * @param double $value_unit Value init
@ -1369,14 +1369,34 @@ class ExpenseReport extends CommonObject
*/ */
function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id) function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id)
{ {
global $user; global $user, $mysoc;
if ($this->fk_statut==0 || $this->fk_statut==99) if ($this->fk_statut==0 || $this->fk_statut==99)
{ {
$this->db->begin(); $this->db->begin();
$type = 0; // TODO What if type is service ?
// We don't know seller and buyer for expense reports
$seller = $mysoc;
$buyer = new Societe($this->db);
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$buyer,$seller);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $vatrate, $reg))
{
$vat_src_code = $reg[1];
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
}
$vatrate = preg_replace('/\*/','',$vatrate);
$tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
// calcul de tous les totaux de la ligne // calcul de tous les totaux de la ligne
$total_ttc = price2num($qty*$value_unit, 'MT'); //$total_ttc = price2num($qty*$value_unit, 'MT');
$tx_tva = $vatrate / 100; $tx_tva = $vatrate / 100;
$tx_tva = $tx_tva + 1; $tx_tva = $tx_tva + 1;
@ -1386,6 +1406,9 @@ class ExpenseReport extends CommonObject
// fin calculs // fin calculs
$ligne = new ExpenseReportLine($this->db); $ligne = new ExpenseReportLine($this->db);
$ligne->rowid = $rowid;
$ligne->comments = $comments; $ligne->comments = $comments;
$ligne->qty = $qty; $ligne->qty = $qty;
$ligne->value_unit = $value_unit; $ligne->value_unit = $value_unit;
@ -1395,11 +1418,21 @@ class ExpenseReport extends CommonObject
$ligne->fk_c_type_fees = $type_fees_id; $ligne->fk_c_type_fees = $type_fees_id;
$ligne->fk_projet = $projet_id; $ligne->fk_projet = $projet_id;
$ligne->total_ht = $total_ht; //$ligne->total_ht = $total_ht;
$ligne->total_tva = $total_tva; //$ligne->total_tva = $total_tva;
$ligne->total_ttc = $total_ttc; //$ligne->total_ttc = $total_ttc;
//$ligne->vatrate = price2num($vatrate);
$ligne->vat_src_code = $vat_src_code;
$ligne->vatrate = price2num($vatrate); $ligne->vatrate = price2num($vatrate);
$ligne->rowid = $rowid; $ligne->total_ttc = $tmp[2];
$ligne->total_ht = $tmp[0];
$ligne->total_tva = $tmp[1];
$ligne->localtax1_tx = $localtaxes_type[1];
$ligne->localtax2_tx = $localtaxes_type[3];
$ligne->localtax1_type = $localtaxes_type[0];
$ligne->localtax2_type = $localtaxes_type[2];
// Select des infos sur le type fees // Select des infos sur le type fees
$sql = "SELECT c.code as code_type_fees, c.label as libelle_type_fees"; $sql = "SELECT c.code as code_type_fees, c.label as libelle_type_fees";

View File

@ -520,18 +520,18 @@ class PaymentExpenseReport extends CommonObject
// Add link 'user' in bank_url between user and bank transaction // Add link 'user' in bank_url between user and bank transaction
if (! $error) if (! $error)
{ {
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of. foreach ($this->amounts as $key => $value) // We should have always same user but we loop in case of.
{ {
if ($mode == 'payment_expensereport') if ($mode == 'payment_expensereport')
{ {
$er = new ExpenseReport($this->db); $fuser = new User($this->db);
$er->fetch($key); $fuser->fetch($key);
$er->fetch_user($er->fk_user_author);
$result=$acc->add_url_line( $result=$acc->add_url_line(
$bank_line_id, $bank_line_id,
$er->user->id, $fuser->id,
DOL_URL_ROOT.'/user/card.php?id=', DOL_URL_ROOT.'/user/card.php?id=',
$er->user->getFullName($langs), $fuser->getFullName($langs),
'user' 'user'
); );
if ($result <= 0) if ($result <= 0)

View File

@ -878,7 +878,7 @@ if (empty($reshook))
} }
// Actions to build doc // Actions to build doc
$upload_dir = $conf->commande->dir_output; $upload_dir = $conf->fournisseur->commande->dir_output;
$permissioncreate = $user->rights->fournisseur->commande->creer; $permissioncreate = $user->rights->fournisseur->commande->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';

View File

@ -3,8 +3,8 @@
* Copyright (C) 2012-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2012-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014-2017 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -41,7 +41,6 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
$myparam = GETPOST("myparam"); $myparam = GETPOST("myparam");
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int'); $id=GETPOST('id', 'int');
$userid = GETPOST('userid')?GETPOST('userid'):$user->id;
// Protection if external user // Protection if external user
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
@ -61,7 +60,8 @@ if ($action == 'create')
$object = new Holiday($db); $object = new Holiday($db);
// If no right to create a request // If no right to create a request
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all))) $fuserid = GETPOST('fuserid');
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
{ {
$error++; $error++;
setEventMessages($langs->trans('CantCreateCP'), null, 'errors'); setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
@ -86,7 +86,6 @@ if ($action == 'create')
$valideur = GETPOST('valideur'); $valideur = GETPOST('valideur');
$description = trim(GETPOST('description')); $description = trim(GETPOST('description'));
$userID = GETPOST('userID');
// If no type // If no type
if ($type <= 0) if ($type <= 0)
@ -722,7 +721,7 @@ llxHeader('', $langs->trans('CPTitreMenu'));
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create') if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
{ {
// Si l'utilisateur n'a pas le droit de faire une demande // Si l'utilisateur n'a pas le droit de faire une demande
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all))) if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
{ {
$errors[]=$langs->trans('CantCreateCP'); $errors[]=$langs->trans('CantCreateCP');
} }
@ -802,7 +801,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
// Formulaire de demande // Formulaire de demande
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n"; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
print '<input type="hidden" name="action" value="create" />'."\n"; print '<input type="hidden" name="action" value="create" />'."\n";
print '<input type="hidden" name="userID" value="'.$userid.'" />'."\n";
dol_fiche_head(); dol_fiche_head();
@ -833,10 +831,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<td>'; print '<td>';
if (empty($user->rights->holiday->write_all)) if (empty($user->rights->holiday->write_all))
{ {
print $form->select_dolusers($userid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<input type="hidden" name="userid" value="'.$userid.'">'; print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
} }
else print $form->select_dolusers(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0); else print $form->select_dolusers(GETPOST('fuserid')?GETPOST('fuserid'):$user->id,'fuserid',0,'',0);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -70,7 +70,6 @@ $type = GETPOST('type','int');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
'cp.rowid'=>'Ref',
'cp.description'=>'Description', 'cp.description'=>'Description',
'uu.lastname'=>'EmployeeLastname', 'uu.lastname'=>'EmployeeLastname',
'uu.firstname'=>'EmployeeFirstname' 'uu.firstname'=>'EmployeeFirstname'
@ -124,7 +123,7 @@ $order = $db->order($sortfield,$sortorder).$db->plimit($limit + 1, $offset);
// WHERE // WHERE
if(!empty($search_ref)) if(!empty($search_ref))
{ {
$filter.= " AND cp.rowid LIKE '%".$db->escape($search_ref)."%'\n"; $filter.= " AND cp.rowid = ".$db->escape($search_ref);
} }
// DATE START // DATE START

View File

@ -63,7 +63,7 @@ ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL; ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL;
ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00'; -- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00';
-- Clean corrupted values for tms -- Clean corrupted values for tms
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
@ -74,7 +74,7 @@ ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-
-- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL; -- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL;
ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP; -- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL;
@ -204,9 +204,14 @@ CREATE TABLE llx_payment_salary (
fk_user_modif integer fk_user_modif integer
)ENGINE=innodb; )ENGINE=innodb;
DELETE FROM llx_product_batch where fk_product_stock NOT IN (SELECT rowid from llx_product_stock);
ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock); ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock);
ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid); ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid);
DELETE FROM llx_expeditiondet_batch where fk_expeditiondet NOT IN (SELECT rowid from llx_expeditiondet);
ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet); ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet);
ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid); ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);

View File

@ -306,6 +306,14 @@ DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_m
drop table tmp_c_shipment_mode; drop table tmp_c_shipment_mode;
-- Restore id of user on link for payment of expense report
drop table tmp_bank_url_expense_user;
create table tmp_bank_url_expense_user (select e.fk_user_author, bu2.fk_bank from llx_expensereport as e, llx_bank_url as bu2 where bu2.url_id = e.rowid and bu2.type = 'payment_expensereport');
update llx_bank_url as bu set url_id = (select e.fk_user_author from tmp_bank_url_expense_user as e where e.fk_bank = bu.fk_bank) where bu.url_id = 0 and bu.type ='user';
drop table tmp_bank_url_expense_user;
-- Clean product prices -- Clean product prices
--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05'; --delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05';
-- Set product prices into llx_product with last price into llx_product_prices -- Set product prices into llx_product with last price into llx_product_prices

View File

@ -144,7 +144,7 @@ if ($id > 0 || ! empty($ref))
elseif ($user->rights->facture->lire) elseif ($user->rights->facture->lire)
{ {
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
$sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,"; $sql.= " f.facnumber, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used $sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -237,22 +237,23 @@ if ($id > 0 || ! empty($ref))
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$conf->liste_limit))
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
$societestatic->fetch($objp->socid);
$paiement = $invoicestatic->getSommePaiement();
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
print $invoicestatic->getNomUrl(1); print $invoicestatic->getNomUrl(1);
print "</td>\n"; print "</td>\n";
$societestatic->fetch($objp->socid);
print '<td>'.$societestatic->getNomUrl(1).'</td>'; print '<td>'.$societestatic->getNomUrl(1).'</td>';
print "<td>".$objp->code_client."</td>\n"; print "<td>".$objp->code_client."</td>\n";
print '<td align="center">'; print '<td align="center">';
print dol_print_date($db->jdate($objp->datef),'day')."</td>"; print dol_print_date($db->jdate($objp->datef),'day')."</td>";
print '<td align="center">'.$objp->qty."</td>\n"; print '<td align="center">'.$objp->qty."</td>\n";
print '<td align="right">'.price($objp->total_ht)."</td>\n"; print '<td align="right">'.price($objp->total_ht)."</td>\n";
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>'; print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).'</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;