Merge remote-tracking branch 'origin/3.9' into develop
Conflicts: ChangeLog htdocs/commande/class/commande.class.php htdocs/filefunc.inc.php htdocs/theme/eldy/style.css.php
This commit is contained in:
commit
5bfc65676c
80
ChangeLog
80
ChangeLog
@ -34,6 +34,70 @@ So if you included it into your module, change your code like this to be compati
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
||||
FIX: #3815 Call to undefined function local_by_date()
|
||||
FIX: #4424 Missing email of user popup in supplier orders area
|
||||
FIX: #4442 Missing translation in Banks menu
|
||||
FIX: #4737 Bank transacion type selector translation is cropped
|
||||
FIX: #4742 Able to delete a supplier invoice with a registered payment
|
||||
FIX: #4743 UI glitch in project summary page
|
||||
FIX: #4747 Missing UI background when registering a supplier invoice payment
|
||||
FIX: #4748 Supplier invoice payment confirmation amount is not translated
|
||||
FIX: #4766 VAT not shown in supplier invoice popup
|
||||
FIX: #4784
|
||||
FIX: #4809 Duplicate functions with different content
|
||||
FIX: #4812
|
||||
FIX: #4839
|
||||
FIX: #4851 Project selector in supplier invoices shows the project label twice
|
||||
FIX: #4870
|
||||
FIX: #4874 SQL error when listing users
|
||||
FIX: #4880
|
||||
FIX: #4961
|
||||
FIX: #4989
|
||||
FIX: If oauth has never been activated two tables are missing and printing is not working
|
||||
FIX: A not enabled field for list must not into fields to add
|
||||
FIX: Bad color of message password changed
|
||||
FIX: Bad error and style message when changing its own login
|
||||
FIX: Bad function name call on delete
|
||||
FIX: Bad include and param for project numbering module call
|
||||
FIX: bad translation language loaded FIX: When changing thirdparty on event card, the showempty option of contact was lost. FIX: Bad placeholder shown on combo to select a thirdparty.
|
||||
FIX: Bad vat definition when using POS module
|
||||
FIX: Box disabled because bugged
|
||||
FIX: Can not select a commercial on the creation of a third
|
||||
FIX: Check of EAN13 barcode when mask was set to use 13 digits instead of 12
|
||||
FIX: correct display of minimum buying price
|
||||
FIX: Creation of thumb image for size "small" was not done.
|
||||
FIX: Damn, where was the project ref ?
|
||||
FIX: Default vat is not set correctly when an error occured and we use VAT identified by a code.
|
||||
FIX: dont retrieve new buying price on margin display
|
||||
FIX: Duplicate records into export
|
||||
FIX: Each time we edit a line, we loose the unit price.
|
||||
FIX: Email templates not compatible with Multicompany
|
||||
FIX: Export must use a left join to not loose lines
|
||||
FIX: fetchAllEMailTemplate
|
||||
FIX: Filter/search on extrafields on lists
|
||||
FIX: finished parameters not used
|
||||
FIX: Generated thumbs must always use the png format so using thumbs can work.
|
||||
FIX: Hook resprint be printed
|
||||
FIX: image extension must be in lower case
|
||||
FIX: Missing clean of criteria
|
||||
FIX: Missing database escaping on supplier price insert/update
|
||||
FIX: Missing function
|
||||
FIX: Multiprice generator didn't recalculate prices if only the price_base_type property changes
|
||||
FIX: Not removing code into vatrate.
|
||||
FIX: Not showing sellprice properly on product list
|
||||
FIX: Parsing of amount to pay vat
|
||||
FIX: PHPCS
|
||||
FIX: PMP is deprecated at warehouse level
|
||||
FIX: real min buying price
|
||||
FIX: Same term to create than other objects
|
||||
FIX: Some records were lost into margin per product report
|
||||
FIX: systematic rounding causes prices to be updated without reason
|
||||
FIX: Template email must take care of positino column
|
||||
FIX: VAT rate can be negative. Example spain selling to morroco.
|
||||
FIX: When cloning an order the order result from clone must be now
|
||||
FIX: When using option Price per level, when adding a predefined product, the vat for customer was not correctly set.
|
||||
|
||||
***** ChangeLog for 3.9.0 compared to 3.8.* *****
|
||||
For users:
|
||||
NEW: A new and more modern look for "eldy" theme.
|
||||
@ -1067,6 +1131,11 @@ Dolibarr better:
|
||||
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.6.7 compared to 3.6.6 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: CVE CVE-2015-8685
|
||||
|
||||
***** ChangeLog for 3.6.6 compared to 3.6.5 *****
|
||||
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
|
||||
FIX: #4081 Added missing translation
|
||||
@ -1319,6 +1388,17 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
- Remove add_photo_web() that is not used anymore by core code.
|
||||
|
||||
|
||||
***** ChangeLog for 3.5.8 compared to 3.5.7 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: bad calculation for stock value
|
||||
FIX: bad stock valo
|
||||
FIX: change order date on clone (as everywhere else)
|
||||
FIX: CVE CVE-2015-8685
|
||||
FIX: The hours of date filter aren't correct
|
||||
FIX: #3442 Remove useless syslog
|
||||
FIX: #3448 Pass expected date format
|
||||
FIX: #3471 3.5 Rounding issue when dispatching non-integer
|
||||
|
||||
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
|
||||
Fix: Paypal link were broken due to SSL v3 closed.
|
||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||
|
||||
@ -62,7 +62,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||
{
|
||||
$producttmp->fetch(GETPOST('productid'));
|
||||
$forbarcode=$producttmp->barcode;
|
||||
$fk_barcode_type=$thirdpartytmp->barcode_type_code;
|
||||
$fk_barcode_type=$producttmp->barcode_type;
|
||||
|
||||
if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
|
||||
|
||||
@ -1010,6 +1010,7 @@ class Commande extends CommonOrder
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->date = dol_now();
|
||||
$this->date_commande = dol_now();
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
@ -1281,6 +1282,7 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -1423,9 +1425,10 @@ class Commande extends CommonOrder
|
||||
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr);
|
||||
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level)
|
||||
$price = $prod->multiprices[$this->thirdparty->price_level];
|
||||
@ -2549,6 +2552,7 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -3002,7 +3006,7 @@ class Commande extends CommonOrder
|
||||
function LibStatut($statut,$billed,$mode,$donotshowbilled=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
|
||||
$billedtext = '';
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
|
||||
|
||||
|
||||
@ -2564,7 +2564,7 @@ class Facture extends CommonInvoice
|
||||
$this->line->date_start = $date_start;
|
||||
$this->line->date_end = $date_end;
|
||||
$this->line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva = $total_tva;
|
||||
$this->line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
|
||||
$this->line->total_localtax1 = $total_localtax1;
|
||||
$this->line->total_localtax2 = $total_localtax2;
|
||||
$this->line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 Rosana Romero <rromero@2byte.es>
|
||||
* Copyright (C) 2014-2016 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
|
||||
@ -116,16 +116,11 @@ $product_static=new Product($db);
|
||||
$payment_static=new Paiement($db);
|
||||
$paymentfourn_static=new PaiementFourn($db);
|
||||
|
||||
//print load_fiche_titre($langs->trans("VAT"),"");
|
||||
|
||||
//$fsearch.='<br>';
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
||||
|
||||
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
|
||||
// Affiche en-tete du rapport
|
||||
|
||||
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
|
||||
{
|
||||
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode");
|
||||
@ -138,14 +133,11 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
@ -170,14 +162,10 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
@ -203,8 +191,6 @@ if($local==1){
|
||||
|
||||
// VAT Received and paid
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
$total = 0;
|
||||
$i=0;
|
||||
@ -229,10 +215,10 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
else
|
||||
{
|
||||
$x_both = array();
|
||||
|
||||
//now, from these two arrays, get another array with one rate per line
|
||||
foreach(array_keys($x_coll) as $my_coll_rate)
|
||||
{
|
||||
//foreach($x_coll[$my_coll_rate][localtax1_list]){
|
||||
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
|
||||
$x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local];
|
||||
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
|
||||
@ -302,9 +288,6 @@ else
|
||||
}
|
||||
//now we have an array (x_both) indexed by rates for coll and paye
|
||||
|
||||
|
||||
//print table headers for this quadri - incomes first
|
||||
|
||||
$x_coll_sum = 0;
|
||||
$x_coll_ht = 0;
|
||||
$x_paye_sum = 0;
|
||||
@ -313,8 +296,6 @@ else
|
||||
$span=3;
|
||||
if ($modetax == 0) $span+=2;
|
||||
|
||||
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
|
||||
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 2){
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
@ -344,8 +325,6 @@ else
|
||||
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
//print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
/**/
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
@ -399,9 +378,7 @@ else
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -412,7 +389,6 @@ else
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap" align="right">';
|
||||
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
@ -423,7 +399,7 @@ else
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else {
|
||||
print $fields['payment_amount'];
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
@ -490,7 +466,6 @@ else
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 1){
|
||||
echo '<table class="noborder" width="100%">';
|
||||
//print table headers for this quadri - expenses now
|
||||
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
@ -584,7 +559,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print $fields['payment_amount'];
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 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
|
||||
@ -298,7 +298,7 @@ if ($id > 0)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$urladd = "&id=".$prev_id;
|
||||
$urladd = "&id=".$id;
|
||||
|
||||
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
|
||||
print"\n<!-- debut table -->\n";
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
@ -180,7 +180,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets VAT to collect for the given year (and given quarter or month)
|
||||
* The function gets the VAT in split results, as the VAT declaration asks
|
||||
|
||||
@ -63,53 +63,53 @@ class printing_printgcp extends PrintingDriver
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$this->db = $db;
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken('Google');
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
$token_ok=true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken('Google');
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken('Google', $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if (!$conf->oauth->enabled) {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'ModuleAuthNotActive', 'type'=>'info');
|
||||
} else {
|
||||
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken('Google');
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
$token_ok=true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken('Google');
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken('Google', $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if ($this->google_id != '' && $this->google_secret != '') {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken('Google')?$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):''));
|
||||
|
||||
@ -105,7 +105,7 @@ $useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEM
|
||||
if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody;
|
||||
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1;
|
||||
if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1;
|
||||
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER==$colorbacklinepairhover;
|
||||
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover;
|
||||
if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab;
|
||||
if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink;
|
||||
|
||||
|
||||
@ -207,7 +207,10 @@ class User extends CommonObject
|
||||
}
|
||||
else // The fetch was forced on an entity
|
||||
{
|
||||
$sql.= " WHERE u.entity IN (0, ".$conf->entity.")";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode))
|
||||
$sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||
else
|
||||
$sql.= " WHERE u.entity IN (0, ".$conf->entity.")";
|
||||
}
|
||||
|
||||
if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba
|
||||
|
||||
Loading…
Reference in New Issue
Block a user