forked from Wavyzz/dolibarr
Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c0a6946a7 | ||
|
|
1ecc1afa9e | ||
|
|
ceb1e699b7 | ||
|
|
c028819cab | ||
|
|
d59b1bb0c6 | ||
|
|
9d582a53ca | ||
|
|
3d85407619 | ||
|
|
ca1e3b4d55 | ||
|
|
94bb1ac511 | ||
|
|
8893d8d59f | ||
|
|
9253fed754 | ||
|
|
8000777864 | ||
|
|
141df52dd6 | ||
|
|
01a3787664 | ||
|
|
8ac7dd8e9a | ||
|
|
3793ae323a | ||
|
|
e61bcd03ed | ||
|
|
3295498e9e | ||
|
|
d5d337c631 | ||
|
|
71818da6a5 | ||
|
|
c53aef9955 | ||
|
|
a18995d3dc | ||
|
|
d345b9503a | ||
|
|
f8d6eb0d40 | ||
|
|
7d9b9f96f0 | ||
|
|
3017e2b3a0 | ||
|
|
09c271b7c5 | ||
|
|
adbb41799c | ||
|
|
1fcc2c4918 | ||
|
|
e19167dffa | ||
|
|
ccbeb162cf | ||
|
|
f1c23f25f0 | ||
|
|
724392a557 | ||
|
|
4283b1ee30 | ||
|
|
f899408fc9 | ||
|
|
65b9b70ff8 | ||
|
|
a8d7764146 | ||
|
|
99c7867522 | ||
|
|
1f83bef1b5 | ||
|
|
1745d06bb7 | ||
|
|
12d7b92556 | ||
|
|
6fb0fc7b71 | ||
|
|
f694939fc7 | ||
|
|
c4546b6da6 | ||
|
|
03eadcebf1 | ||
|
|
ebc18cd2d4 | ||
|
|
d0d9de37f4 | ||
|
|
1bfdc7438a | ||
|
|
9352ecca1f | ||
|
|
39419bb411 | ||
|
|
774c624687 | ||
|
|
5439390461 | ||
|
|
6fc4dacd42 | ||
|
|
36a72de080 | ||
|
|
6787d717f9 | ||
|
|
0e175ba373 | ||
|
|
d55cc58b8b | ||
|
|
d70c14a411 | ||
|
|
510b1aedcf | ||
|
|
200f4010d8 | ||
|
|
d7b142beb7 | ||
|
|
61a4382bd8 | ||
|
|
d410a320d7 | ||
|
|
dbcb60433b | ||
|
|
0c9f268f99 | ||
|
|
4adfe6de70 | ||
|
|
56e749df9f | ||
|
|
a2287fd183 | ||
|
|
587f5a76e6 | ||
|
|
cd099bf3b1 | ||
|
|
9bbfeed1bc | ||
|
|
e23a44bcdf | ||
|
|
72ff353e9f | ||
|
|
2e759d5156 | ||
|
|
086fa4385f | ||
|
|
30d58f77db | ||
|
|
44302f1aea | ||
|
|
6b2d8a3c34 | ||
|
|
ef7a334414 | ||
|
|
ddbd6c371d |
@@ -10,7 +10,7 @@ php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '5.6.29'
|
||||
- '7.0'
|
||||
- nightly
|
||||
|
||||
@@ -126,10 +126,10 @@ before_script:
|
||||
echo "Set timezone"
|
||||
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
|
||||
echo
|
||||
echo "Enabling APC for PHP <= 5.4"
|
||||
#echo
|
||||
#echo "Enabling APC for PHP <= 5.4"
|
||||
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
|
||||
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||
#echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||
echo
|
||||
echo "Enabling Memcached for PHP <= 5.4"
|
||||
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly!
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@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
|
||||
@@ -134,6 +134,7 @@ class Commande extends CommonOrder
|
||||
var $linked_objects=array();
|
||||
|
||||
var $user_author_id;
|
||||
var $user_valid;
|
||||
|
||||
/**
|
||||
* @var OrderLine[]
|
||||
@@ -1460,7 +1461,7 @@ class Commande extends CommonOrder
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
|
||||
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql.= ', c.fk_account';
|
||||
$sql.= ', c.date_commande';
|
||||
@@ -1502,6 +1503,7 @@ class Commande extends CommonOrder
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_localtax1 = $obj->total_localtax1;
|
||||
@@ -2692,8 +2694,8 @@ class Commande extends CommonOrder
|
||||
$sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").",";
|
||||
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
|
||||
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
|
||||
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
|
||||
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
|
||||
$sql.= " fk_user_author=".(isset($this->user_author_id)?$this->user_author_id:"null").",";
|
||||
$sql.= " fk_user_valid=".(isset($this->user_valid)?$this->user_valid:"null").",";
|
||||
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
|
||||
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
|
||||
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
|
||||
|
||||
@@ -282,6 +282,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
$refcomp=$societestatic->getNomUrl(1,'',24);
|
||||
|
||||
$paiement = $facturestatic->getSommePaiement(); // Payment already done
|
||||
$paiement+= $facturestatic->getSumDepositsUsed();
|
||||
$paiement+= $facturestatic->getSumCreditNotesUsed();
|
||||
}
|
||||
if ($obj->family == 'social_contribution')
|
||||
{
|
||||
|
||||
@@ -771,7 +771,7 @@ if (empty($reshook))
|
||||
$line->fk_parent_line = $fk_parent_line;
|
||||
|
||||
$line->subprice =-$line->subprice; // invert price for object
|
||||
$line->pa_ht = -$line->pa_ht;
|
||||
$line->pa_ht = $line->pa_ht;
|
||||
$line->total_ht=-$line->total_ht;
|
||||
$line->total_tva=-$line->total_tva;
|
||||
$line->total_ttc=-$line->total_ttc;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -164,6 +165,6 @@ else
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@@ -551,7 +551,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
//print $sql;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@@ -591,7 +591,6 @@ if ($resql)
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png');
|
||||
|
||||
if ($massaction == 'presend')
|
||||
|
||||
@@ -1265,18 +1265,6 @@ class BonPrelevement extends CommonObject
|
||||
* section Debiteur (sepa Debiteurs bloc lines)
|
||||
*/
|
||||
|
||||
$tmp_invoices = array();
|
||||
|
||||
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($objfac = $this->db->fetch_object($resql)) {
|
||||
$tmp_invoices[] = $objfac->fac;
|
||||
}
|
||||
}
|
||||
|
||||
$ListOfFactures = implode($tmp_invoices);
|
||||
|
||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
||||
@@ -1303,7 +1291,7 @@ class BonPrelevement extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
|
||||
$this->total = $this->total + $obj->somme;
|
||||
$i++;
|
||||
}
|
||||
@@ -1574,11 +1562,11 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Nm>'.strtoupper(dolEscapeXML(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")))),70,'right','UTF-8',true).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_string_unaccent($row_zip.' '.$row_town)).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
||||
|
||||
@@ -39,7 +39,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $id, '','');
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
||||
@@ -1601,8 +1601,8 @@ class Contrat extends CommonObject
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options=$array_option;
|
||||
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
|
||||
$contractline->array_options=$array_options;
|
||||
$contractline->id= $rowid;
|
||||
$result=$contractline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@@ -439,7 +439,7 @@ class Translate
|
||||
if (! $found)
|
||||
{
|
||||
// Overwrite translation with database read
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$this->defaultlang."'";
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@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
|
||||
@@ -407,7 +408,7 @@ function dol_get_next_week($day, $week, $month, $year)
|
||||
{
|
||||
$tmparray = dol_get_first_day_week($day, $month, $year);
|
||||
|
||||
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
|
||||
$time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0);
|
||||
$time+=24*60*60*7;
|
||||
$tmparray=dol_getdate($time,true);
|
||||
|
||||
|
||||
@@ -1074,7 +1074,7 @@ function check_value($mask,$value)
|
||||
|
||||
// If an offset is asked
|
||||
if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]);
|
||||
if (! empty($reg[3]) && preg_match('^\+',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
|
||||
if (! empty($reg[3]) && preg_match('/^\+/',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
|
||||
|
||||
// Define $sqlwhere
|
||||
|
||||
|
||||
@@ -762,7 +762,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
|
||||
// Time spent by user
|
||||
print '<td align="right">';
|
||||
$tmptimespent=$taskstatic->getSummaryOfTimeSpent();
|
||||
$tmptimespent=$taskstatic->getSummaryOfTimeSpent('', $fuser->id);
|
||||
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
|
||||
else print '--:--';
|
||||
print "</td>\n";
|
||||
|
||||
@@ -1099,6 +1099,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$this->lines[$i]->product_type,
|
||||
$this->lines[$i]->info_bits
|
||||
);
|
||||
if ($result < 0)
|
||||
@@ -1372,10 +1373,13 @@ class CommandeFournisseur extends CommonOrder
|
||||
$localtax2_type=$localtaxes_type[2];
|
||||
|
||||
$subprice = price2num($pu,'MU');
|
||||
|
||||
$rangmax = $this->line_max();
|
||||
$rang = $rangmax + 1;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
|
||||
$sql.= " (fk_commande, label, description, date_start, date_end,";
|
||||
$sql.= " fk_product, product_type,";
|
||||
$sql.= " fk_product, product_type, rang,";
|
||||
$sql.= " qty, 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.= ")";
|
||||
@@ -1384,7 +1388,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql.= " ".($date_end?"'".$this->db->idate($date_end)."'":"null").",";
|
||||
if ($fk_product) { $sql.= $fk_product.","; }
|
||||
else { $sql.= "null,"; }
|
||||
$sql.= "'".$product_type."',";
|
||||
$sql.= "'".$product_type."', ".$rang.",";
|
||||
$sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2;
|
||||
|
||||
$sql.= ", '".$localtax1_type."',";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2017 Ferran Marcet <fmarcet@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
|
||||
@@ -39,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
$myparam = GETPOST("myparam");
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$id=GETPOST('id', 'int');
|
||||
$userid = GETPOST('userid')?GETPOST('userid'):$user->id;
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
@@ -57,7 +56,8 @@ if ($action == 'create')
|
||||
$cp = new Holiday($db);
|
||||
|
||||
// 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++;
|
||||
setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
|
||||
@@ -82,7 +82,6 @@ if ($action == 'create')
|
||||
|
||||
$valideur = GETPOST('valideur');
|
||||
$description = trim(GETPOST('description'));
|
||||
$userID = GETPOST('userID');
|
||||
|
||||
// If no type
|
||||
if ($type <= 0)
|
||||
@@ -112,7 +111,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Check if there is already holiday for this period
|
||||
$verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday);
|
||||
$verifCP = $cp->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
|
||||
if (! $verifCP)
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=alreadyCP');
|
||||
@@ -140,7 +139,7 @@ if ($action == 'create')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$cp->fk_user = $userid;
|
||||
$cp->fk_user = $fuserid;
|
||||
$cp->description = $description;
|
||||
$cp->date_debut = $date_debut;
|
||||
$cp->date_fin = $date_fin;
|
||||
@@ -682,7 +681,7 @@ llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
|
||||
{
|
||||
// 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');
|
||||
}
|
||||
@@ -762,7 +761,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
||||
// Formulaire de demande
|
||||
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="userID" value="'.$userid.'" />'."\n";
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
@@ -793,10 +791,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
||||
print '<td>';
|
||||
if (empty($user->rights->holiday->write_all))
|
||||
{
|
||||
print $form->select_dolusers($userid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '<input type="hidden" name="userid" value="'.$userid.'">';
|
||||
print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
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 '</tr>';
|
||||
|
||||
|
||||
@@ -62,6 +62,21 @@ ALTER TABLE llx_societe MODIFY COLUMN fk_currency varchar(3) NULL;
|
||||
ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
|
||||
ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL;
|
||||
|
||||
|
||||
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00';
|
||||
|
||||
-- Clean corrupted values for tms
|
||||
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
|
||||
-- VMYSQL4.1 update llx_opensurvey_sondage set tms = date_fin where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;
|
||||
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
|
||||
-- VMYSQL4.1 update llx_opensurvey_sondage set tms = date_fin where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;
|
||||
-- Remove default not null on date_fin
|
||||
-- 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;
|
||||
|
||||
-- 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 allow_comments tinyint NOT NULL DEFAULT 1;
|
||||
-- ALTER TABLE llx_opensurvey_sondage DROP COLUMN survey_link_visible;
|
||||
@@ -189,9 +204,14 @@ CREATE TABLE llx_payment_salary (
|
||||
fk_user_modif integer
|
||||
)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 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 CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);
|
||||
|
||||
|
||||
@@ -611,3 +611,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
|
||||
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
|
||||
|
||||
-- Negative buying prices
|
||||
|
||||
UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)
|
||||
|
||||
@@ -257,3 +257,14 @@ delete from llx_commande_fournisseur_dispatch where fk_commandefourndet = 0 or f
|
||||
delete from llx_menu where menu_handler = 'smartphone';
|
||||
|
||||
|
||||
-- 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';
|
||||
-- Set product prices into llx_product with last price into llx_product_prices
|
||||
--update llx_product as p set
|
||||
-- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.price_min_ttc = (select pp.price_min_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.tva_tx = 0
|
||||
-- where price = 17.5
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ print '<h3>'.$langs->trans("Repair").'</h3>';
|
||||
|
||||
print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_logos')?GETPOST('restore_thirdparties_logos'):'0').'<br>'."\n";
|
||||
print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements')?GETPOST('clean_linked_elements'):'0').'<br>'."\n";
|
||||
print 'Option clean_orphelin_dir (1 or confirmed) is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
|
||||
print 'Option clean_product_stock_batch (1 or confirmed) is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
|
||||
print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
|
||||
print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
|
||||
@@ -523,14 +523,17 @@ if ($ok && GETPOST('clean_orphelin_dir'))
|
||||
// clean_linked_elements: Check and clean linked elements
|
||||
if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
{
|
||||
print '<tr><td colspan="2"><br>Clean table product_batch</td></tr>';
|
||||
$methodtofix=GETPOST('methodtofix')?GETPOST('methodtofix'):'updatestock';
|
||||
|
||||
print '<tr><td colspan="2"><br>Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)</td></tr>';
|
||||
|
||||
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
|
||||
$sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb ON ps.rowid = pb.fk_product_stock";
|
||||
$sql.=" WHERE p.rowid = ps.fk_product";
|
||||
$sql.=" AND p.tobatch = 1";
|
||||
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
|
||||
$sql.=" HAVING reel != SUM(pb.qty)";
|
||||
$sql.=" HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL";
|
||||
print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -542,13 +545,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
print '<tr><td>'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
|
||||
print '<tr><td>Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.($obj->reelbatch?$obj->reelbatch:'0').' (sum product_batch)';
|
||||
|
||||
// Fix
|
||||
if ($obj->reel != $obj->reelbatch)
|
||||
{
|
||||
$methodtofix='updatestock';
|
||||
|
||||
if ($methodtofix == 'updatebatch')
|
||||
{
|
||||
// Method 1
|
||||
@@ -570,7 +571,7 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
if ($methodtofix == 'updatestock')
|
||||
{
|
||||
// Method 2
|
||||
print ' -> Update qty of stock with qty = '.$obj->reelbatch.' for ps.rowid = '.$obj->psrowid;
|
||||
print ' -> Update qty of product_stock with qty = '.($obj->reelbatch?$obj->reelbatch:'0').' for ps.rowid = '.$obj->psrowid;
|
||||
if (GETPOST('clean_product_stock_batch') == 'confirmed')
|
||||
{
|
||||
$error=0;
|
||||
@@ -578,11 +579,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
$db->begin();
|
||||
|
||||
$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_stock";
|
||||
$sql2.=" SET reel = ".$obj->reelbatch." WHERE rowid = ".$obj->psrowid;
|
||||
$sql2.=" SET reel = ".($obj->reelbatch?$obj->reelbatch:'0')." WHERE rowid = ".$obj->psrowid;
|
||||
$resql2=$db->query($sql2);
|
||||
if ($resql2)
|
||||
{
|
||||
// We update product stock, so we must update product.stock too.
|
||||
// We update product_stock, so we must field stock into product too.
|
||||
$sql3='UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)';
|
||||
$resql3=$db->query($sql3);
|
||||
if (! $resql3)
|
||||
@@ -608,6 +609,10 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="2">Nothing to do</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -618,6 +623,34 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
}
|
||||
|
||||
|
||||
// clean_linked_elements: Check and clean linked elements
|
||||
if ($ok && GETPOST('clean_product_stock_negative_if_batch'))
|
||||
{
|
||||
print '<tr><td colspan="2"><br>Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)</td></tr>';
|
||||
|
||||
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
|
||||
$sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
|
||||
$sql.=" AND p.tobatch = 1";
|
||||
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
|
||||
$sql.=" HAVING reel != SUM(pb.qty)";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
print '<tr><td>'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,8 +42,6 @@ $oldvatrate=GETPOST('oldvatrate');
|
||||
$newvatrate=GETPOST('newvatrate');
|
||||
//$price_base_type=GETPOST('price_base_type');
|
||||
|
||||
$objectstatic = new Product($db);
|
||||
$objectstatic2 = new ProductFournisseur($db);
|
||||
|
||||
|
||||
/*
|
||||
@@ -87,6 +85,7 @@ if ($action == 'convert')
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step
|
||||
$ret=$objectstatic->fetch($obj->rowid);
|
||||
if ($ret > 0)
|
||||
{
|
||||
@@ -150,7 +149,8 @@ if ($action == 'convert')
|
||||
if ($ret < 0 || $retm < 0) $error++;
|
||||
else $nbrecordsmodified++;
|
||||
}
|
||||
|
||||
unset($objectstatic);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,7 @@ if ($action == 'convert')
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
|
||||
$ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid);
|
||||
if ($ret > 0)
|
||||
{
|
||||
@@ -207,6 +208,8 @@ if ($action == 'convert')
|
||||
if ($ret < 0 || $retm < 0) $error++;
|
||||
else $nbrecordsmodified++;
|
||||
}
|
||||
unset($objectstatic2);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -911,9 +911,10 @@ class Task extends CommonObject
|
||||
* Calculate total of time spent for task
|
||||
*
|
||||
* @param int $id Id of object (here task)
|
||||
* @param int $user_id Filter on user time
|
||||
* @return array Array of info for task array('min_date', 'max_date', 'total_duration')
|
||||
*/
|
||||
function getSummaryOfTimeSpent($id='')
|
||||
function getSummaryOfTimeSpent($id='', $user_id='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@@ -927,6 +928,7 @@ class Task extends CommonObject
|
||||
$sql.= " SUM(t.task_duration) as total_duration";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||
$sql.= " WHERE t.fk_task = ".$id;
|
||||
if(!empty($user_id)) $sql.= " AND t.fk_user = ".$user_id;
|
||||
|
||||
dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
Reference in New Issue
Block a user