mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix setup of direct print with google docs driver
This commit is contained in:
parent
43c60ec224
commit
69725fe62f
|
|
@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha');
|
|||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$error = 0;
|
||||
|
|
@ -86,7 +86,7 @@ print '<input type="hidden" name="action" value="update">';
|
|||
|
||||
$head = oauthadmin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'services', '', 0, 'technic');
|
||||
dol_fiche_head($head, 'services', '', -1, 'technic');
|
||||
|
||||
|
||||
print $langs->trans("ListOfSupportedOauthProviders").'<br><br>';
|
||||
|
|
@ -102,10 +102,10 @@ foreach ($list as $key)
|
|||
if (! $supported) continue; // show only supported
|
||||
|
||||
$i++;
|
||||
|
||||
|
||||
print '<tr class="liste_titre'.($i > 1 ?' liste_titre_add':'').'">';
|
||||
// Api Name
|
||||
$label = $langs->trans($key[0]);
|
||||
$label = $langs->trans($key[0]);
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td>';
|
||||
if (! empty($key[3])) print $langs->trans($key[3]);
|
||||
|
|
@ -127,7 +127,7 @@ foreach ($list as $key)
|
|||
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Api Id
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td><label for="'.$key[1].'">'.$langs->trans($key[1]).'</label></td>';
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ print load_fiche_titre($langs->trans('ConfigOAuth'),$linkback,'title_setup');
|
|||
|
||||
$head=oauthadmin_prepare_head($mode);
|
||||
|
||||
dol_fiche_head($head, 'tokengeneration', '', 0, 'technic');
|
||||
dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
||||
|
||||
|
||||
if ($mode == 'setup' && $user->admin)
|
||||
|
|
@ -131,8 +131,8 @@ if ($mode == 'setup' && $user->admin)
|
|||
$supported=0;
|
||||
if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1;
|
||||
if (! $supported) continue; // show only supported
|
||||
|
||||
|
||||
|
||||
|
||||
$OAUTH_SERVICENAME='Unknown';
|
||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||
{
|
||||
|
|
@ -148,7 +148,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
$urltodelete=$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms='https://security.google.com/settings/security/permissions';
|
||||
}
|
||||
|
||||
|
||||
// Show value of token
|
||||
$tokenobj=null;
|
||||
// Token
|
||||
|
|
@ -164,21 +164,21 @@ if ($mode == 'setup' && $user->admin)
|
|||
{
|
||||
// Return an error if token not found
|
||||
}
|
||||
|
||||
|
||||
// Set other properties
|
||||
$refreshtoken=false;
|
||||
$expiredat='';
|
||||
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if (is_object($tokenobj)) {
|
||||
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
|
||||
if ($key[1] != '' && $key[2] != '') {
|
||||
if (is_object($tokenobj)) {
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
|
||||
|
||||
$endoflife = $tokenobj->getEndOfLife();
|
||||
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
|
||||
{
|
||||
|
|
@ -196,21 +196,21 @@ if ($mode == 'setup' && $user->admin)
|
|||
}
|
||||
|
||||
$submit_enabled=0;
|
||||
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
|
||||
|
||||
$var=false;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required']?' class="required"':'').'>';
|
||||
//var_dump($key);
|
||||
|
|
@ -221,7 +221,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
print '<td>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required']?' class="required"':'').'>';
|
||||
|
|
@ -248,7 +248,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required']?' class="required"':'').'>';
|
||||
|
|
@ -265,7 +265,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
|
||||
print ''.join(',',$tokenobj->getExtraParams());
|
||||
print '</textarea>';*/
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
print yn($refreshtoken);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Token expired
|
||||
$var = ! $var;
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -292,7 +292,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
print yn($expire);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Token expired at
|
||||
$var = ! $var;
|
||||
print '<tr class="oddeven">';
|
||||
|
|
@ -302,9 +302,9 @@ if ($mode == 'setup' && $user->admin)
|
|||
print '<td colspan="2">';
|
||||
print $expiredat;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
if (! empty($driver))
|
||||
|
|
@ -314,10 +314,10 @@ if ($mode == 'setup' && $user->admin)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($mode == 'test' && $user->admin)
|
||||
|
|
@ -344,7 +344,7 @@ if ($mode == 'test' && $user->admin)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
}
|
||||
|
|
@ -368,7 +368,7 @@ if ($mode == 'userconf' && $user->admin)
|
|||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row=$db->fetch_array($resql)) {
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
// Filename to print must be provided into 'file' parameter
|
||||
|
||||
// Print file
|
||||
if ($action == 'print_file' and $user->rights->printing->read)
|
||||
if ($action == 'print_file' and $user->rights->printing->read)
|
||||
{
|
||||
$langs->load("printing");
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';
|
||||
|
|
@ -44,10 +44,10 @@ if ($action == 'print_file' and $user->rights->printing->read)
|
|||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
|
||||
if (! empty($conf->global->{$printer->active}))
|
||||
if (! empty($conf->global->{$printer->active}))
|
||||
{
|
||||
$printerfound++;
|
||||
|
||||
|
||||
$subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':'');
|
||||
$module = GETPOST('printer', 'alpha');
|
||||
if ($module =='commande_fournisseur') {
|
||||
|
|
@ -60,7 +60,7 @@ if ($action == 'print_file' and $user->rights->printing->read)
|
|||
//print '<pre>'.print_r($printer->errors, true).'</pre>';
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
if ($ret==0)
|
||||
if ($ret==0)
|
||||
{
|
||||
//print '<pre>'.print_r($printer->errors, true).'</pre>';
|
||||
setEventMessages($printer->error, $printer->errors);
|
||||
|
|
@ -74,7 +74,7 @@ if ($action == 'print_file' and $user->rights->printing->read)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound"), null, 'warnings');
|
||||
if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoModuleFound"), null, 'warnings');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ PrintingDriverDesc=Configuration variables for printing driver.
|
|||
ListDrivers=List of drivers
|
||||
PrintTestDesc=List of Printers.
|
||||
FileWasSentToPrinter=File %s was sent to printer
|
||||
NoActivePrintingModuleFound=No active module to print document
|
||||
NoActivePrintingModuleFound=No active driver to print document. Check setup of module %s.
|
||||
PleaseSelectaDriverfromList=Please select a driver from list.
|
||||
PleaseConfigureDriverfromList=Please configure the selected driver from list.
|
||||
SetupDriver=Driver setup
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ PrintingDriverDesc=Paramètres de configuration pour le driver d'impression
|
|||
ListDrivers=Liste des drivers
|
||||
PrintTestDesc=Liste des imprimantes
|
||||
FileWasSentToPrinter=Le fichier %s a été envoyé à l'imprimante
|
||||
NoActivePrintingModuleFound=Pas de module actif pour imprimer le document
|
||||
NoActivePrintingModuleFound=Pas de module actif pour imprimer le document. Vérifiez la configuration du module %s.
|
||||
PleaseSelectaDriverfromList=Sélection un driver dans la liste
|
||||
PleaseConfigureDriverfromList=Configurez le driver sélectionné depuis la liste
|
||||
SetupDriver=Configuration du driver
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ if (! $user->admin) accessforbidden();
|
|||
|
||||
$action = GETPOST('action','alpha');
|
||||
$mode = GETPOST('mode','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$value = GETPOST('value','alpha',0,null,null,1); // The value may be __google__docs so we force disable of replace
|
||||
$varname = GETPOST('varname', 'alpha');
|
||||
$driver = GETPOST('driver', 'alpha');
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print $langs->trans("PrintingDriverDesc".$driver)."<br><br>\n";
|
||||
|
||||
|
|
@ -142,12 +142,12 @@ if ($mode == 'setup' && $user->admin)
|
|||
$classname = 'printing_'.$driver;
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
|
||||
|
||||
$i=0;
|
||||
$submit_enabled=0;
|
||||
foreach ($printer->conf as $key)
|
||||
{
|
||||
|
||||
|
||||
switch ($key['type']) {
|
||||
case "text":
|
||||
case "password":
|
||||
|
|
@ -191,7 +191,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
break;
|
||||
}
|
||||
$i++;
|
||||
|
||||
|
||||
if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS')
|
||||
{
|
||||
// Token
|
||||
|
|
@ -229,9 +229,9 @@ if ($mode == 'setup' && $user->admin)
|
|||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if (! empty($driver))
|
||||
{
|
||||
if ($submit_enabled) {
|
||||
|
|
@ -243,7 +243,7 @@ if ($mode == 'setup' && $user->admin)
|
|||
}
|
||||
if ($mode == 'config' && $user->admin)
|
||||
{
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print $langs->trans("PrintingDesc")."<br><br>\n";
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ if ($mode == 'config' && $user->admin)
|
|||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.img_picto('', $printer->picto).' '.$langs->trans($printer->desc).'</td>';
|
||||
print '<td class="center">';
|
||||
|
|
@ -296,7 +296,7 @@ if ($mode == 'config' && $user->admin)
|
|||
|
||||
if ($mode == 'test' && $user->admin)
|
||||
{
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ if ($mode == 'test' && $user->admin)
|
|||
|
||||
if ($mode == 'userconf' && $user->admin)
|
||||
{
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
|
||||
|
|
@ -348,7 +348,7 @@ if ($mode == 'userconf' && $user->admin)
|
|||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row=$db->fetch_array($resql)) {
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user