mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW---FTP-function-mkdir
This commit is contained in:
@@ -378,33 +378,54 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$connectstringserver = $object->getConnectStringIMAP($usessl);
|
||||
|
||||
try {
|
||||
if ($sourcedir) {
|
||||
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
|
||||
}
|
||||
if ($targetdir) {
|
||||
//$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
|
||||
if ($action == 'scan') {
|
||||
try {
|
||||
if ($sourcedir) {
|
||||
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
|
||||
}
|
||||
if ($targetdir) {
|
||||
//$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
|
||||
}
|
||||
|
||||
$timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT;
|
||||
$timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT;
|
||||
|
||||
dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread);
|
||||
|
||||
$result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect
|
||||
$result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread);
|
||||
$result3 = imap_timeout(IMAP_WRITETIMEOUT, 5);
|
||||
$result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5);
|
||||
|
||||
dol_syslog("result1=".$result1." result2=".$result2." result3=".$result3." result4=".$result4);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
|
||||
//dol_syslog("end imap_open connection=".var_export($connection, true));
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
|
||||
$timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT;
|
||||
$timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT;
|
||||
if (!$connection) {
|
||||
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
|
||||
if (function_exists('imap_last_error')) {
|
||||
$morehtml .= '<br>'.imap_last_error();
|
||||
}
|
||||
dol_syslog("Error ".$morehtml, LOG_WARNING);
|
||||
//var_dump(imap_errors())
|
||||
} else {
|
||||
dol_syslog("Imap connected. Now we call imap_num_msg()");
|
||||
$morehtml .= imap_num_msg($connection);
|
||||
}
|
||||
|
||||
dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread);
|
||||
|
||||
$result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect
|
||||
$result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread);
|
||||
$result3 = imap_timeout(IMAP_WRITETIMEOUT, 5);
|
||||
$result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5);
|
||||
|
||||
dol_syslog("result1=".$result1." result2=".$result2." result3=".$result3." result4=".$result4);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
|
||||
//dol_syslog("end imap_open connection=".var_export($connection, true));
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
if ($connection) {
|
||||
dol_syslog("Imap close");
|
||||
imap_close($connection);
|
||||
}
|
||||
} else {
|
||||
$morehtml .= '<a class="flat" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
|
||||
}
|
||||
|
||||
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver);
|
||||
@@ -412,23 +433,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$morehtml .= 'IMAP functions not available on your PHP. ';
|
||||
}
|
||||
|
||||
if (!$connection) {
|
||||
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
|
||||
if (function_exists('imap_last_error')) {
|
||||
$morehtml .= '<br>'.imap_last_error();
|
||||
}
|
||||
dol_syslog("Error ".$morehtml, LOG_WARNING);
|
||||
//var_dump(imap_errors())
|
||||
} else {
|
||||
dol_syslog("Imap connected. Now we call imap_num_msg()");
|
||||
$morehtml .= imap_num_msg($connection);
|
||||
}
|
||||
|
||||
if ($connection) {
|
||||
dol_syslog("Imap close");
|
||||
imap_close($connection);
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
@@ -580,11 +584,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<td>';
|
||||
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1);
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="operationparam">';
|
||||
//print '<input type="text" name="operationparam">';
|
||||
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
|
||||
print $form->textwithpicto('<input type="text" name="operationparam">', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
|
||||
print '</td>';
|
||||
print '<td class="right"><input type="submit" name="addoperation" id="addoperation" class="flat button small" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -62,7 +62,7 @@ if ($action == 'add') { // $provider is OAUTH_XXX
|
||||
setEventMessages($langs->trans("AOAuthEntryForThisProviderAndLabelAlreadyHasAKey"), null, 'errors');
|
||||
$error++;
|
||||
} else {
|
||||
dolibarr_set_const($db, $constname, 'ToComplete', 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, $constname, $langs->trans('ToComplete'), 'chaine', 0, '', $conf->entity);
|
||||
setEventMessages($langs->trans("OAuthProviderAdded"), null);
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,16 @@ if ($action == 'update') {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SECRET', GETPOST($constvalue.'_ID') ? GETPOST($constvalue.'_SECRET') : '', 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
if (GETPOSTISSET($constvalue.'_URLAUTHORIZE')) {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_URLAUTHORIZE', GETPOST($constvalue.'_URLAUTHORIZE'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (GETPOSTISSET($constvalue.'_SCOPE')) {
|
||||
if (!dolibarr_set_const($db, $constvalue.'_SCOPE', GETPOST($constvalue.'_SCOPE'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,11 +157,17 @@ print '<table class="noborder centpercent">';
|
||||
|
||||
$i = 0;
|
||||
|
||||
//var_dump($list);
|
||||
// Define $listinsetup
|
||||
foreach ($conf->global as $key => $val) {
|
||||
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
|
||||
$provider = preg_replace('/_ID$/', '', $key);
|
||||
$listinsetup[] = array($provider.'_NAME', $provider.'_ID', $provider.'_SECRET', 'OAUTH Provider '.str_replace('OAUTH_', '', $provider));
|
||||
$listinsetup[] = array(
|
||||
$provider.'_NAME',
|
||||
$provider.'_ID',
|
||||
$provider.'_SECRET',
|
||||
$provider.'_URLAUTHORIZE', // For custom oauth links
|
||||
$provider.'_SCOPE' // For custom oauth links
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,12 +194,16 @@ foreach ($listinsetup as $key) {
|
||||
|
||||
$i++;
|
||||
|
||||
print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">';
|
||||
// Api Name
|
||||
$label = $langs->trans($keyforsupportedoauth2array);
|
||||
print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">';
|
||||
print '<td>';
|
||||
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
|
||||
print $label;
|
||||
if ($label == $keyforsupportedoauth2array) {
|
||||
print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
|
||||
} else {
|
||||
print $label;
|
||||
}
|
||||
if ($keyforprovider) {
|
||||
print ' (<b>'.$keyforprovider.'</b>)';
|
||||
} else {
|
||||
@@ -201,8 +221,15 @@ foreach ($listinsetup as $key) {
|
||||
$redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="uri'.$keyforsupportedoauth2array.'" value="'.$redirect_uri.'">';
|
||||
print '<td><input style="width: 80%" type"text" name="uri'.$keyforsupportedoauth2array.'" value="'.$redirect_uri.'" disabled>';
|
||||
print '</td></tr>';
|
||||
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("URLOfServiceForAuthorization").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
@@ -213,14 +240,32 @@ foreach ($listinsetup as $key) {
|
||||
// Api Id
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td><label for="'.$key[1].'">'.$langs->trans("OAUTH_ID").'</label></td>';
|
||||
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->{$key[1]}.'">';
|
||||
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.getDolGlobalString($key[1]).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Api Secret
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_SECRET").'</label></td>';
|
||||
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->{$key[2]}.'">';
|
||||
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.getDolGlobalString($key[2]).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO Move this into token generation
|
||||
if ($supported) {
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("Scopes").'</td>';
|
||||
print '<td>';
|
||||
print '<input style="width: 80%" type"text" name="'.$key[4].'" value="'.getDolGlobalString($key[4]).'" >';
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("Scopes").'</td>';
|
||||
print '<td>';
|
||||
//print '<input style="width: 80%" type"text" name="'.$key[4].'" value="'.getDolGlobalString($key[4]).'" >';
|
||||
print $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope'];
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
@@ -138,11 +138,17 @@ if (GETPOST('error')) {
|
||||
if ($mode == 'setup' && $user->admin) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
|
||||
|
||||
//var_dump($list);
|
||||
// Define $listinsetup
|
||||
foreach ($conf->global as $key => $val) {
|
||||
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
|
||||
$provider = preg_replace('/_ID$/', '', $key);
|
||||
$listinsetup[] = array($provider.'_NAME', $provider.'_ID', $provider.'_SECRET', 'OAUTH Provider '.str_replace('OAUTH_', '', $provider));
|
||||
$listinsetup[] = array(
|
||||
$provider.'_NAME',
|
||||
$provider.'_ID',
|
||||
$provider.'_SECRET',
|
||||
$provider.'_URLAUTHORIZE', // For custom oauth links
|
||||
$provider.'_SCOPE' // For custom oauth links
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,46 +171,39 @@ if ($mode == 'setup' && $user->admin) {
|
||||
|
||||
$OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
|
||||
|
||||
// Define $shortscope, $urltorenew, $urltodelete, $urltocheckperms
|
||||
$shortscope = $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope'];
|
||||
if (getDolGlobalString($key[4])) {
|
||||
$shortscope = getDolGlobalString($key[4]);
|
||||
}
|
||||
$state = $shortscope; // TODO USe a better state
|
||||
|
||||
// Define $urltorenew, $urltodelete, $urltocheckperms
|
||||
// TODO Use array $supportedoauth2array
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') {
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'user,public_repo';
|
||||
|
||||
// Note: github does not accept csrf key inside the state parameter (only know values)
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
// Note: github does not accept csrf key inside the state parameter (only known values)
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') {
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes
|
||||
// We pass this key list into the param 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile';
|
||||
$shortscope .= ',openid,email,profile'; // For openid connect
|
||||
if (!empty($conf->printing->enabled)) {
|
||||
$shortscope .= ',cloud_print';
|
||||
}
|
||||
if (!empty($conf->global->OAUTH_GOOGLE_GSUITE)) {
|
||||
$shortscope .= ',admin_directory_user';
|
||||
}
|
||||
if (!empty($conf->global->OAUTH_GOOGLE_GMAIL)) {
|
||||
$shortscope.=',gmail_full';
|
||||
}
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') {
|
||||
$shortscope = 'none';
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') {
|
||||
$shortscope = 'none';
|
||||
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($keyforsupportedoauth2array = 'OAUTH_OTHER_NAME') {
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/generic_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} else {
|
||||
@@ -212,7 +211,8 @@ if ($mode == 'setup' && $user->admin) {
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
}
|
||||
$urltorenew .= '&keyforprovider='.$keyforprovider;
|
||||
|
||||
$urltorenew .= '&keyforprovider='.urlencode($keyforprovider);
|
||||
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
@@ -246,7 +246,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
} elseif ($endoflife == $tokenobj::EOL_UNKNOWN) {
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
$expiredat = dol_print_date($endoflife, "dayhour", 'tzuserrel');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,10 +260,16 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
|
||||
// Api Name
|
||||
$label = $langs->trans($keyforsupportedoauth2array);
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="titlefieldcreate">';
|
||||
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
|
||||
print $langs->trans($keyforsupportedoauth2array);
|
||||
if ($label == $keyforsupportedoauth2array) {
|
||||
print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
|
||||
} else {
|
||||
print $label;
|
||||
}
|
||||
if ($keyforprovider) {
|
||||
print ' (<b>'.$keyforprovider.'</b>)';
|
||||
} else {
|
||||
@@ -292,7 +298,8 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (is_object($tokenobj)) {
|
||||
print $langs->trans("HasAccessToken");
|
||||
// TODO Read in database to get the date of creation of token
|
||||
print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : ');
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoAccessToken").'</span>';
|
||||
}
|
||||
@@ -305,7 +312,9 @@ if ($mode == 'setup' && $user->admin) {
|
||||
}
|
||||
// Request remote token
|
||||
if ($urltorenew) {
|
||||
print '<a class="button smallpaddingimp" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
print '<a class="button smallpaddingimp" href="'.$urltorenew.'">'.$langs->trans('GetAccess').'</a>';
|
||||
print $form->textwithpicto('', $langs->trans('RequestAccess'));
|
||||
print '<br>';
|
||||
}
|
||||
// Check remote access
|
||||
if ($urltocheckperms) {
|
||||
@@ -378,8 +387,8 @@ if ($mode == 'setup' && $user->admin) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,14 +61,17 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'updateform') {
|
||||
$res1 = 1; $res2 = 1;
|
||||
$res1 = 1; $res2 = 1; $res3 = 1;
|
||||
if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) {
|
||||
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_SESSION_TIMEOUT')) {
|
||||
$res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if ($res1 && $res2) {
|
||||
if (GETPOSTISSET('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT')) {
|
||||
$res3 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", GETPOST("MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", 'alphanohtml'), 'int', 0, '', $conf->entity);
|
||||
}
|
||||
if ($res1 && $res2 && $res3) {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
@@ -174,6 +177,14 @@ print '<input class="flat right width50" name="MAIN_SESSION_TIMEOUT" type="text"
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MaxNumberOfImagesInGetPost").'</td><td class="right">';
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT" type="text" value="'.dol_escape_htmltag($conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT).'"> '.strtolower($langs->trans("Images"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
/*
|
||||
if (empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$conf->global->MAIN_APPLICATION_TITLE = "";
|
||||
|
||||
@@ -643,7 +643,7 @@ print '</tr>'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MainDefaultWarehouse").'</td>';
|
||||
print '<td class="right">';
|
||||
print $formproduct->selectWarehouses($conf->global->MAIN_DEFAULT_WAREHOUSE, 'default_warehouse', '', 1, 0, 0, '', 0, 0, array(), 'left reposition');
|
||||
print $formproduct->selectWarehouses(!empty($conf->global->MAIN_DEFAULT_WAREHOUSE) ? $conf->global->MAIN_DEFAULT_WAREHOUSE : -1, 'default_warehouse', '', 1, 0, 0, '', 0, 0, array(), 'left reposition');
|
||||
print '<input type="submit" class="button button-edit small" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -168,9 +168,10 @@ print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven nohover"><td style="padding-left: 8px" class="nohover">';
|
||||
print '<tr class="oddeven nohover"><td style="class="nohover">';
|
||||
|
||||
print '<table class="centpercent noborderbottom">';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="tdtop nopaddingleftimp">';
|
||||
|
||||
@@ -195,27 +196,31 @@ print '</fieldset>';
|
||||
print '</div>';
|
||||
|
||||
print '</td>';
|
||||
print '<td class="tdtop nopaddingrightimp">';
|
||||
print '</tr>';
|
||||
|
||||
print '<button id="btn" type="button" onclick="hideoptions()">'.$langs->trans("ShowAdvancedOptions").'</button>';
|
||||
print '<tr>';
|
||||
print '<td class="tdtop nopaddingleftimp">';
|
||||
|
||||
print '<div class="centpercent center"><a id="lnk" href="javascript:hideoptions()"> '.$langs->trans("ShowAdvancedOptions").'...</a></div>';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
|
||||
function hideoptions(){
|
||||
const btn = document.getElementById("btn");
|
||||
const lnk = document.getElementById("lnk");
|
||||
const div = document.getElementById("div_container_sub_exportoptions");
|
||||
|
||||
if (div.style.display === "none") {
|
||||
div.style.display = "block";
|
||||
btn.innerText="'.$langs->trans("HideAdvancedoptions").'";
|
||||
lnk.innerText="'.$langs->trans("HideAdvancedoptions").'";
|
||||
} else {
|
||||
div.style.display = "none";
|
||||
btn.innerText="'.$langs->trans("ShowAdvancedOptions").'";
|
||||
lnk.innerText="'.$langs->trans("ShowAdvancedOptions").'...";
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
|
||||
print '<div id="div_container_sub_exportoptions" style="display: none;">';
|
||||
print '<br>';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print "<!-- Fieldset mysqldump -->\n";
|
||||
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
|
||||
@@ -203,25 +203,30 @@ if ($action == 'builddoc') {
|
||||
$forceimgscalewidth = (empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH);
|
||||
$forceimgscaleheight = (empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT);
|
||||
|
||||
for ($i = 0; $i < $numberofsticker; $i++) {
|
||||
$arrayofrecords[] = array(
|
||||
'textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
'code'=>$code,
|
||||
'encoding'=>$encoding,
|
||||
'is2d'=>$is2d,
|
||||
'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF
|
||||
);
|
||||
$MAXSTICKERS = 1000;
|
||||
if ($numberofsticker <= $MAXSTICKERS) {
|
||||
for ($i = 0; $i < $numberofsticker; $i++) {
|
||||
$arrayofrecords[] = array(
|
||||
'textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
'code'=>$code,
|
||||
'encoding'=>$encoding,
|
||||
'is2d'=>$is2d,
|
||||
'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$mesg = $langs->trans("ErrorQuantityIsLimitedTo", $MAXSTICKERS);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
$mesg = '';
|
||||
|
||||
// Build and output PDF
|
||||
if ($mode == 'label') {
|
||||
if (!$error && $mode == 'label') {
|
||||
if (!count($arrayofrecords)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
@@ -240,7 +245,7 @@ if ($action == 'builddoc') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($result <= 0 || $mesg) {
|
||||
if ($result <= 0 || $mesg || $error) {
|
||||
if (empty($mesg)) {
|
||||
$mesg = 'Error '.$result;
|
||||
}
|
||||
@@ -272,8 +277,6 @@ print '<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
|
||||
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
|
||||
//print '<br>';
|
||||
|
||||
|
||||
@@ -1093,6 +1093,7 @@ class FormSetupItem
|
||||
$out.= $this->langs->trans("NorProspectNorCustomer");
|
||||
}
|
||||
} elseif ($this->type == 'product') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$product = new Product($this->db);
|
||||
$resprod = $product->fetch($this->fieldValue);
|
||||
if ($resprod > 0) {
|
||||
|
||||
@@ -218,6 +218,36 @@ function dol_ftp_get($connect_id, $file, $newsection)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a FTP file
|
||||
*
|
||||
* @param resource $connect_id Connection handler
|
||||
* @param string $file File name
|
||||
* @param string $localfile The path to the local file
|
||||
* @param string $newsection $newsection
|
||||
* @return result
|
||||
*/
|
||||
function dol_ftp_put($connect_id, $file, $localfile, $newsection)
|
||||
{
|
||||
|
||||
global $conf;
|
||||
|
||||
if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) {
|
||||
$newsection = ssh2_sftp_realpath($connect_id, ".").'/./'; // workaround for bug https://bugs.php.net/bug.php?id=64169
|
||||
}
|
||||
|
||||
// Remote file
|
||||
$filename = $file;
|
||||
$remotefile = $newsection.(preg_match('@[\\\/]$@', $newsection) ? '' : '/').$file;
|
||||
$newremotefileiso = utf8_decode($remotefile);
|
||||
|
||||
if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) {
|
||||
return ssh2_scp_send($connect_id, $localfile, $newremotefileiso, 0644);
|
||||
} else {
|
||||
return ftp_put($connect_id, $newremotefileiso, $localfile, FTP_BINARY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove FTP directory
|
||||
*
|
||||
|
||||
@@ -954,6 +954,11 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
|
||||
|
||||
// Restore entity ' into ' (restricthtml is for html content so we can use html entity)
|
||||
$out = preg_replace('/'/i', "'", $out);
|
||||
|
||||
preg_match_all('/(<img)/i', $out, $reg);
|
||||
if (count($reg[0]) > getDolGlobalInt("MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", 1000)) {
|
||||
$out = '';
|
||||
}
|
||||
} while ($oldstringtoclean != $out);
|
||||
break;
|
||||
case 'custom':
|
||||
|
||||
@@ -23,16 +23,30 @@
|
||||
*/
|
||||
|
||||
|
||||
$shortscopegoogle = 'userinfo_email,userinfo_profile';
|
||||
$shortscopegoogle .= ',openid,email,profile'; // For openid connect
|
||||
if (!empty($conf->printing->enabled)) {
|
||||
$shortscopegoogle .= ',cloud_print';
|
||||
}
|
||||
if (!empty($conf->global->OAUTH_GOOGLE_GSUITE)) {
|
||||
$shortscopegoogle .= ',admin_directory_user';
|
||||
}
|
||||
if (!empty($conf->global->OAUTH_GOOGLE_GMAIL)) {
|
||||
$shortscopegoogle.=',gmail_full';
|
||||
}
|
||||
|
||||
// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
|
||||
$supportedoauth2array = array(
|
||||
'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/'),
|
||||
'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'defaultscope'=>$shortscopegoogle),
|
||||
);
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'');
|
||||
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'');
|
||||
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'defaultscope'=>'read_write');
|
||||
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'defaultscope'=>'read_write');
|
||||
}
|
||||
$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers', 'defaultscope'=>'user,public_repo');
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
$supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'defaultscope'=>'ToComplete');
|
||||
}
|
||||
$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers');
|
||||
|
||||
|
||||
|
||||
// API access parameters OAUTH
|
||||
@@ -259,6 +273,11 @@ $list = array(
|
||||
'OAUTH_YAMMER_ID',
|
||||
'OAUTH_YAMMER_SECRET',
|
||||
),
|
||||
array(
|
||||
'OAUTH_OTHER_NAME',
|
||||
'OAUTH_OTHER_ID',
|
||||
'OAUTH_OTHER_SECRET',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ function takepos_admin_prepare_head()
|
||||
$numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS);
|
||||
for ($i = 1; $i <= $numterminals; $i++) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i;
|
||||
$head[$h][1] = $langs->trans("Terminal")." ".$i;
|
||||
$head[$h][1] = getDolGlobalString('TAKEPOS_TERMINAL_NAME_'.$i, $langs->trans("TerminalName", $i));
|
||||
$head[$h][2] = 'terminal'.$i;
|
||||
$h++;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,32 @@ class pdf_sponge extends ModelePDFFactures
|
||||
*/
|
||||
public $marge_basse;
|
||||
|
||||
|
||||
/**
|
||||
* @var int heightforinfotot
|
||||
*/
|
||||
public $heightforinfotot;
|
||||
|
||||
/**
|
||||
* @var int heightforfreetext
|
||||
*/
|
||||
public $heightforfreetext;
|
||||
|
||||
/**
|
||||
* @var int heightforfooter
|
||||
*/
|
||||
public $heightforfooter;
|
||||
|
||||
/**
|
||||
* @var int tab_top
|
||||
*/
|
||||
public $tab_top;
|
||||
|
||||
/**
|
||||
* @var int tab_top_newpage
|
||||
*/
|
||||
public $tab_top_newpage;
|
||||
|
||||
/**
|
||||
* Issuer
|
||||
* @var Societe Object that emits
|
||||
@@ -345,9 +371,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||
$pdf->SetAutoPageBreak(1, 0);
|
||||
|
||||
$heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
|
||||
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
|
||||
$this->heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
|
||||
$this->heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
|
||||
$this->heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
|
||||
|
||||
if (class_exists('TCPDF')) {
|
||||
$pdf->setPrintHeader(false);
|
||||
@@ -429,9 +455,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
// $pdf->GetY() here can't be used. It is bottom of the second addresse box but first one may be higher
|
||||
|
||||
// $tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
|
||||
$tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
|
||||
// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
|
||||
$this->tab_top = 90 + $top_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
|
||||
$this->tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
|
||||
|
||||
// You can add more thing under header here, if you increase $extra_under_address_shift too.
|
||||
$extra_under_address_shift = 0;
|
||||
@@ -452,7 +478,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
'module_width' => 1, // width of a single module in points
|
||||
'module_height' => 1 // height of a single module in points
|
||||
);
|
||||
$pdf->write2DBarcode($qrcodestring, 'QRCODE,M', $this->marge_gauche, $tab_top - 5, 25, 25, $styleQr, 'N');
|
||||
$pdf->write2DBarcode($qrcodestring, 'QRCODE,M', $this->marge_gauche, $this->tab_top - 5, 25, 25, $styleQr, 'N');
|
||||
$extra_under_address_shift += 25;
|
||||
}
|
||||
|
||||
@@ -469,32 +495,32 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$extra_under_address_shift += $hookmanager->resArray['extra_under_header_shift'];
|
||||
}
|
||||
|
||||
$tab_top += $extra_under_address_shift;
|
||||
$tab_top_newpage += 0;
|
||||
$this->tab_top += $extra_under_address_shift;
|
||||
$this->tab_top_newpage += 0;
|
||||
|
||||
|
||||
// Define heigth of table for lines (for first page)
|
||||
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
|
||||
$tab_height = $this->page_hauteur - $this->tab_top - $this->heightforfooter - $this->heightforfreetext;
|
||||
|
||||
$nexY = $tab_top - 1;
|
||||
$nexY = $this->tab_top - 1;
|
||||
|
||||
// Incoterm
|
||||
$height_incoterms = 0;
|
||||
if (!empty($conf->incoterm->enabled)) {
|
||||
$desc_incoterms = $object->getIncotermsForPDF();
|
||||
if ($desc_incoterms) {
|
||||
$tab_top -= 2;
|
||||
$this->tab_top -= 2;
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $this->tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
$height_incoterms = $nexY - $tab_top;
|
||||
$height_incoterms = $nexY - $this->tab_top;
|
||||
|
||||
// Rect takes a length in 3rd parameter
|
||||
$pdf->SetDrawColor(192, 192, 192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
|
||||
$pdf->Rect($this->marge_gauche, $this->tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
|
||||
|
||||
$tab_top = $nexY + 6;
|
||||
$this->tab_top = $nexY + 6;
|
||||
$height_incoterms += 4;
|
||||
}
|
||||
}
|
||||
@@ -521,7 +547,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$pagenb = $pdf->getPage();
|
||||
if ($notetoshow) {
|
||||
$tab_top -= 2;
|
||||
$this->tab_top -= 2;
|
||||
|
||||
$tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
|
||||
$pageposbeforenote = $pagenb;
|
||||
@@ -534,7 +560,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->startTransaction();
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $this->tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
// Description
|
||||
$pageposafternote = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
@@ -553,29 +579,29 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
// $this->_pagefoot($pdf,$object,$outputlangs,1);
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setTopMargin($this->tab_top_newpage);
|
||||
// The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
|
||||
$pdf->setPageOrientation('', 1, $this->heightforfooter + $this->heightforfreetext);
|
||||
}
|
||||
|
||||
// back to start
|
||||
$pdf->setPage($pageposbeforenote);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
|
||||
$pdf->setPageOrientation('', 1, $this->heightforfooter + $this->heightforfreetext);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $this->tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
$pageposafternote = $pdf->getPage();
|
||||
|
||||
$posyafter = $pdf->GetY();
|
||||
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { // There is no space left for total+free text
|
||||
if ($posyafter > ($this->page_hauteur - ($this->heightforfooter + $this->heightforfreetext + 20))) { // There is no space left for total+free text
|
||||
$pdf->AddPage('', '', true);
|
||||
$pagenb++;
|
||||
$pageposafternote++;
|
||||
$pdf->setPage($pageposafternote);
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setTopMargin($this->tab_top_newpage);
|
||||
// The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
|
||||
//$posyafter = $tab_top_newpage;
|
||||
$pdf->setPageOrientation('', 1, $this->heightforfooter + $this->heightforfreetext);
|
||||
//$posyafter = $this->tab_top_newpage;
|
||||
}
|
||||
|
||||
|
||||
@@ -588,11 +614,11 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->SetDrawColor(128, 128, 128);
|
||||
// Draw note frame
|
||||
if ($i > $pageposbeforenote) {
|
||||
$height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
|
||||
$height_note = $this->page_hauteur - ($this->tab_top_newpage + $this->heightforfooter);
|
||||
$pdf->Rect($this->marge_gauche, $this->tab_top_newpage - 1, $tab_width, $height_note + 1);
|
||||
} else {
|
||||
$height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
|
||||
$height_note = $this->page_hauteur - ($this->tab_top + $this->heightforfooter);
|
||||
$pdf->Rect($this->marge_gauche, $this->tab_top - 1, $tab_width, $height_note + 1);
|
||||
}
|
||||
|
||||
// Add footer
|
||||
@@ -610,17 +636,17 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
$height_note = $posyafter - $tab_top_newpage;
|
||||
$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
|
||||
$height_note = $posyafter - $this->tab_top_newpage;
|
||||
$pdf->Rect($this->marge_gauche, $this->tab_top_newpage - 1, $tab_width, $height_note + 1);
|
||||
} else {
|
||||
// No pagebreak
|
||||
$pdf->commitTransaction();
|
||||
$posyafter = $pdf->GetY();
|
||||
$height_note = $posyafter - $tab_top;
|
||||
$pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
|
||||
$height_note = $posyafter - $this->tab_top;
|
||||
$pdf->Rect($this->marge_gauche, $this->tab_top - 1, $tab_width, $height_note + 1);
|
||||
|
||||
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
|
||||
if ($posyafter > ($this->page_hauteur - ($this->heightforfooter + $this->heightforfreetext + 20))) {
|
||||
// not enough space, need to add page
|
||||
$pdf->AddPage('', '', true);
|
||||
$pagenb++;
|
||||
@@ -633,12 +659,12 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
|
||||
$posyafter = $tab_top_newpage;
|
||||
$posyafter = $this->tab_top_newpage;
|
||||
}
|
||||
}
|
||||
|
||||
$tab_height = $tab_height - $height_note;
|
||||
$tab_top = $posyafter + 6;
|
||||
$this->tab_top = $posyafter + 6;
|
||||
} else {
|
||||
$height_note = 0;
|
||||
}
|
||||
@@ -648,10 +674,10 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
// Table simulation to know the height of the title line (this set this->tableTitleHeight)
|
||||
$pdf->startTransaction();
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$this->pdfTabTitles($pdf, $this->tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
$nexY = $this->tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines = $pdf->getPage();
|
||||
@@ -667,8 +693,8 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
|
||||
}
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setTopMargin($this->tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore = $pdf->getPage();
|
||||
|
||||
$showpricebeforepagebreak = 1;
|
||||
@@ -677,14 +703,14 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
if ($this->getColumnStatus('photo')) {
|
||||
// We start with Photo of product line
|
||||
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
|
||||
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot))) { // If photo too high, we moved completely on new page
|
||||
$pdf->AddPage('', '', true);
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
$pdf->setPage($pageposbefore + 1);
|
||||
|
||||
$curY = $tab_top_newpage;
|
||||
$curY = $this->tab_top_newpage;
|
||||
|
||||
// Allows data in the first page if description is long enough to break in multiples pages
|
||||
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
|
||||
@@ -711,14 +737,14 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if ($pageposafter > $pageposbefore) { // There is a pagebreak
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, $this->heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
|
||||
//var_dump($posyafter); var_dump(($this->page_hauteur - ($this->heightforfooter+$this->heightforfreetext+$this->heightforinfotot))); exit;
|
||||
if ($posyafter > ($this->page_hauteur - ($this->heightforfooter + $this->heightforfreetext + $this->heightforinfotot))) { // There is no space left for total+free text
|
||||
if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
|
||||
$pdf->AddPage('', '', true);
|
||||
if (!empty($tplidx)) {
|
||||
@@ -752,7 +778,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// We suppose that a too long description or photo were moved completely on next page
|
||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPage($pageposafter);
|
||||
$curY = $tab_top_newpage;
|
||||
$curY = $this->tab_top_newpage;
|
||||
}
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
|
||||
@@ -923,9 +949,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
while ($pagenb < $pageposafter) {
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == $pageposbeforeprintlines) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
$this->_tableau($pdf, $this->tab_top, $this->page_hauteur - $this->tab_top - $this->heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
$this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
$pagenb++;
|
||||
@@ -941,9 +967,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
|
||||
if ($pagenb == $pageposafter) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
$this->_tableau($pdf, $this->tab_top, $this->page_hauteur - $this->tab_top - $this->heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
$this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
// New page
|
||||
@@ -960,11 +986,11 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
// Show square
|
||||
if ($pagenb == $pageposbeforeprintlines) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
$this->_tableau($pdf, $this->tab_top, $this->page_hauteur - $this->tab_top - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
|
||||
$bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
$this->_tableau($pdf, $this->tab_top_newpage, $this->page_hauteur - $this->tab_top_newpage - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
|
||||
$bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
|
||||
}
|
||||
|
||||
// Display infos area
|
||||
@@ -1432,10 +1458,16 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$posy = $pdf->GetY();
|
||||
|
||||
foreach ($TPreviousIncoice as &$fac) {
|
||||
if ($posy > $this->page_hauteur - 4) {
|
||||
if ($posy > $this->page_hauteur - 4 - $this->heightforfooter) {
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
$pdf->addPage();
|
||||
$pdf->setY($this->marge_haute);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
$pdf->setY($this->tab_top_newpage);
|
||||
}
|
||||
else{
|
||||
$pdf->setY($this->marge_haute);
|
||||
}
|
||||
$posy = $pdf->GetY();
|
||||
}
|
||||
|
||||
@@ -1495,9 +1527,16 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$posy += $tab2_hl;
|
||||
|
||||
if ($posy > $this->page_hauteur - 4) {
|
||||
if ($posy > $this->page_hauteur - 4 - $this->heightforfooter) {
|
||||
$pdf->addPage();
|
||||
$pdf->setY($this->marge_haute);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
$pdf->setY($this->tab_top_newpage);
|
||||
}
|
||||
else {
|
||||
$pdf->setY($this->marge_haute);
|
||||
}
|
||||
|
||||
$posy = $pdf->GetY();
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 78;
|
||||
$this->rights[$r][1] = 'Read subscriptions';
|
||||
$this->rights[$r][1] = 'Read membership fees';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'cotisation';
|
||||
@@ -258,7 +258,7 @@ class modAdherent extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 79;
|
||||
$this->rights[$r][1] = 'Create/modify/remove subscriptions';
|
||||
$this->rights[$r][1] = 'Create/modify/remove membership fees';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'cotisation';
|
||||
|
||||
@@ -164,6 +164,8 @@ class modWebsite extends DolibarrModules
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$result = $this->_load_tables('/install/mysql/', 'website');
|
||||
if ($result < 0) {
|
||||
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
@@ -185,11 +187,16 @@ class modWebsite extends DolibarrModules
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorFailToCopyDir', $src, $dest);
|
||||
return 0;
|
||||
$this->errors[] = $langs->trans('ErrorFailToCopyDir', $src, $dest);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Website templates
|
||||
$srcroot = DOL_DOCUMENT_ROOT.'/install/doctemplates/websites';
|
||||
$destroot = DOL_DATA_ROOT.'/doctemplates/websites';
|
||||
@@ -205,9 +212,15 @@ class modWebsite extends DolibarrModules
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||
$this->errors[] = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
|
||||
193
htdocs/core/modules/oauth/generic_oauthcallback.php
Normal file
193
htdocs/core/modules/oauth/generic_oauthcallback.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/oauth/generic_oauthcallback.php
|
||||
* \ingroup oauth
|
||||
* \brief Page to get oauth callback
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
use OAuth\Common\Storage\DoliStorage;
|
||||
use OAuth\Common\Consumer\Credentials;
|
||||
use OAuth\OAuth2\Service\GitHub;
|
||||
|
||||
// Define $urlwithroot
|
||||
$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
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtourl = GETPOST('backtourl', 'alpha');
|
||||
$keyforprovider = GETPOST('keyforprovider', 'aZ09');
|
||||
if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) {
|
||||
$keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"];
|
||||
}
|
||||
$genericstring = 'OTHER';
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance of the URI class with the current URI, stripping the query string
|
||||
*/
|
||||
$uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
|
||||
//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
|
||||
//$currentUri->setQuery('');
|
||||
$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/generic_oauthcallback.php');
|
||||
|
||||
|
||||
/**
|
||||
* Load the credential for the service
|
||||
*/
|
||||
|
||||
/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$httpClient = new \OAuth\Common\Http\Client\CurlClient();
|
||||
// TODO Set options for proxy and timeout
|
||||
// $params=array('CURLXXX'=>value, ...)
|
||||
//$httpClient->setCurlParameters($params);
|
||||
$serviceFactory->setHttpClient($httpClient);
|
||||
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
|
||||
// Setup the credentials for the requests
|
||||
$keyforparamid = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_ID';
|
||||
$keyforparamsecret = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET';
|
||||
$credentials = new Credentials(
|
||||
getDolGlobalString($keyforparamid),
|
||||
getDolGlobalString($keyforparamsecret),
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
$requestedpermissionsarray = array();
|
||||
if (GETPOST('state')) {
|
||||
$requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back
|
||||
}
|
||||
if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
print 'Error, parameter state is not defined';
|
||||
exit;
|
||||
}
|
||||
//var_dump($requestedpermissionsarray);exit;
|
||||
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
$apiService = $serviceFactory->createService($genericstring, $credentials, $storage, $requestedpermissionsarray);
|
||||
|
||||
/*
|
||||
var_dump($genericstring.($keyforprovider ? '-'.$keyforprovider : ''));
|
||||
var_dump($credentials);
|
||||
var_dump($storage);
|
||||
var_dump($requestedpermissionsarray);
|
||||
*/
|
||||
|
||||
if (empty($apiService)) {
|
||||
print 'Error, failed to create serviceFactory';
|
||||
exit;
|
||||
}
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
//$apiService->setAccessType('offline');
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
if (!getDolGlobalString($keyforparamid)) {
|
||||
accessforbidden('Setup of service is not complete. Customer ID is missing');
|
||||
}
|
||||
if (!getDolGlobalString($keyforparamsecret)) {
|
||||
accessforbidden('Setup of service is not complete. Secret key is missing');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'delete') {
|
||||
$storage->clearToken($genericstring);
|
||||
|
||||
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (GETPOST('code')) { // We are coming from oauth provider page
|
||||
// We should have
|
||||
//$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16))
|
||||
|
||||
dol_syslog("We are coming from the oauth provider page");
|
||||
//llxHeader('',$langs->trans("OAuthSetup"));
|
||||
|
||||
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
//print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
|
||||
|
||||
//print dol_get_fiche_head();
|
||||
// retrieve the CSRF state parameter
|
||||
$state = GETPOSTISSET('state') ? GETPOST('state') : null;
|
||||
//print '<table>';
|
||||
|
||||
// This was a callback request from service, get the token
|
||||
try {
|
||||
//var_dump($_GET['code']);
|
||||
//var_dump($state);
|
||||
//var_dump($apiService); // OAuth\OAuth2\Service\GitHub
|
||||
|
||||
//$token = $apiService->requestAccessToken(GETPOST('code'), $state);
|
||||
$token = $apiService->requestAccessToken(GETPOST('code'));
|
||||
// Github is a service that does not need state to be stored.
|
||||
// Into constructor of GitHub, the call
|
||||
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
|
||||
// has not the ending parameter to true like the Google class constructor.
|
||||
|
||||
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
|
||||
|
||||
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
|
||||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
} else { // If entry on page with no parameter, we arrive here
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
// This may create record into oauth_state before the header redirect.
|
||||
// Creation of record with state in this tables depend on the Provider used (see its constructor).
|
||||
if (GETPOST('state')) {
|
||||
$url = $apiService->getAuthorizationUri(array('state' => GETPOST('state')));
|
||||
} else {
|
||||
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
header('Location: '.$url);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// No view at all, just actions
|
||||
|
||||
$db->close();
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/*
|
||||
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -86,7 +86,7 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) {
|
||||
//var_dump($requestedpermissionsarray);exit;
|
||||
|
||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
||||
$apiService = $serviceFactory->createService('GitHub'.($keyforprovider ? '-'.$keyforprovider : ''), $credentials, $storage, $requestedpermissionsarray);
|
||||
$apiService = $serviceFactory->createService('GitHub', $credentials, $storage, $requestedpermissionsarray);
|
||||
|
||||
// access type needed to have oauth provider refreshing token
|
||||
//$apiService->setAccessType('offline');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/*
|
||||
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/*
|
||||
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/*
|
||||
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -111,13 +111,13 @@ class EmailCollector extends CommonObject
|
||||
public $fields = array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax250'),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax200'),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'csslist'=>'small'),
|
||||
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflow125'),
|
||||
'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflow125', 'default'=>'993'),
|
||||
'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default'=>'UTF-8'),
|
||||
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'),
|
||||
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>-1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'),
|
||||
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'),
|
||||
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
|
||||
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
|
||||
|
||||
@@ -635,7 +635,7 @@ if (!$search_all) {
|
||||
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
|
||||
$sql .= " f.note_public, f.note_private,";
|
||||
$sql .= " f.fk_user_author,";
|
||||
$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
|
||||
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
|
||||
$sql .= " typent.code,";
|
||||
$sql .= " state.code_departement, state.nom,";
|
||||
$sql .= ' country.code,';
|
||||
|
||||
@@ -131,6 +131,39 @@ if (GETPOST("sendit") && !empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'uploadfile') {
|
||||
// set up a connection or die
|
||||
if (!$conn_id) {
|
||||
$newsectioniso = utf8_decode($section);
|
||||
$resultarray = dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $newsectioniso, $ftp_passive);
|
||||
$conn_id = $resultarray['conn_id'];
|
||||
$ok = $resultarray['ok'];
|
||||
$mesg = $resultarray['mesg'];
|
||||
}
|
||||
if ($conn_id && $ok && !$mesg) {
|
||||
// var_dump($_FILES['userfile']['name']);
|
||||
$nbfile = count($_FILES['userfile']['name']);
|
||||
$i = 0;
|
||||
for (; $i < $nbfile; $i++) {
|
||||
var_dump($i);
|
||||
$newsection = $newsectioniso;
|
||||
$fileupload = $_FILES['userfile']['name'][$i];
|
||||
$fileuploadpath = $_FILES['userfile']['tmp_name'][$i];
|
||||
$result = dol_ftp_put($conn_id, $fileupload, $fileuploadpath, $newsection);
|
||||
|
||||
if ($result) {
|
||||
setEventMessages($langs->trans("FileWasUpload", $fileupload), null, 'mesgs');
|
||||
} else {
|
||||
dol_syslog("ftp/index.php ftp_delete", LOG_ERR);
|
||||
setEventMessages($langs->trans("FTPFailedToUploadFile", $fileupload), null, 'errors');
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
} else {
|
||||
dol_print_error('', $mesg);
|
||||
}
|
||||
}
|
||||
|
||||
// Action ajout d'un rep
|
||||
if ($action == 'add' && $user->rights->ftp->setup) {
|
||||
$ecmdir->ref = GETPOST("ref");
|
||||
@@ -589,6 +622,18 @@ if (!function_exists('ftp_connect')) {
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
if ($user->hasRight('ftp', 'write')) {
|
||||
print load_fiche_titre($langs->trans("AttachANewFile"), null, null);
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="numero_ftp" value="'.$numero_ftp.'">';
|
||||
print '<input type="hidden" name="section" value="'.$section.'">';
|
||||
print '<input type="hidden" name="action" value="uploadfile">';
|
||||
print '<td><input type="file" class="flat" name="userfile[]" multiple></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="center"><button type="submit" class="butAction" name="uploadfile" value="'.$langs->trans("Save").'">'.$langs->trans("Upload").'</button></td>';
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
$foundsetup = false;
|
||||
$MAXFTP = 20;
|
||||
|
||||
@@ -1337,14 +1337,14 @@ class TCPDFBarcode {
|
||||
// calculate check digit
|
||||
$sum_a = 0;
|
||||
for ($i = 1; $i < $data_len; $i+=2) {
|
||||
$sum_a += $code[$i];
|
||||
$sum_a += (int) $code[$i];
|
||||
}
|
||||
if ($len > 12) {
|
||||
$sum_a *= 3;
|
||||
}
|
||||
$sum_b = 0;
|
||||
for ($i = 0; $i < $data_len; $i+=2) {
|
||||
$sum_b += ($code[$i]);
|
||||
$sum_b += (int) ($code[$i]);
|
||||
}
|
||||
if ($len < 13) {
|
||||
$sum_b *= 3;
|
||||
@@ -2171,7 +2171,7 @@ class TCPDFBarcode {
|
||||
|
||||
/**
|
||||
* IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
|
||||
*
|
||||
*
|
||||
* @param $code (string) pre-formatted IMB barcode (65 chars "FADT")
|
||||
* @return array barcode representation.
|
||||
* @protected
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
Binary file not shown.
@@ -141,13 +141,13 @@ ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;
|
||||
ALTER TABLE llx_element_contact DROP FOREIGN KEY fk_element_contact_fk_c_type_contact;
|
||||
ALTER TABLE llx_societe_contacts DROP FOREIGN KEY fk_societe_contacts_fk_c_type_contact;
|
||||
|
||||
--VMYSQL4.3 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY(rowid);
|
||||
--VMYSQL4.3 ALTER TABLE llx_c_type_contact CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
||||
-- VMYSQL4.3 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY(rowid);
|
||||
-- VMYSQL4.3 ALTER TABLE llx_c_type_contact CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--VPGSQL8.2 CREATE SEQUENCE llx_c_type_contact_rowid_seq OWNED BY llx_c_type_contact.rowid;
|
||||
--VPGSQL8.2 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY (rowid);
|
||||
--VPGSQL8.2 ALTER TABLE llx_c_type_contact ALTER COLUMN rowid SET DEFAULT nextval('llx_c_type_contact_rowid_seq');
|
||||
--VPGSQL8.2 SELECT setval('llx_c_type_contact_rowid_seq', MAX(rowid)) FROM llx_c_type_contact;
|
||||
-- VPGSQL8.2 CREATE SEQUENCE llx_c_type_contact_rowid_seq OWNED BY llx_c_type_contact.rowid;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY (rowid);
|
||||
-- VPGSQL8.2 ALTER TABLE llx_c_type_contact ALTER COLUMN rowid SET DEFAULT nextval('llx_c_type_contact_rowid_seq');
|
||||
-- VPGSQL8.2 SELECT setval('llx_c_type_contact_rowid_seq', MAX(rowid)) FROM llx_c_type_contact;
|
||||
|
||||
insert into llx_c_type_contact(element, source, code, libelle, active ) values ('conferenceorbooth', 'internal', 'MANAGER', 'Conference or Booth manager', 1);
|
||||
insert into llx_c_type_contact(element, source, code, libelle, active ) values ('conferenceorbooth', 'external', 'SPEAKER', 'Conference Speaker', 1);
|
||||
|
||||
@@ -47,6 +47,9 @@ ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32) NOT NULL;
|
||||
|
||||
ALTER TABLE llx_user DROP COLUMN idpers1;
|
||||
ALTER TABLE llx_user DROP COLUMN idpers2;
|
||||
ALTER TABLE llx_user DROP COLUMN idpers3;
|
||||
|
||||
|
||||
-- v17
|
||||
@@ -73,3 +76,4 @@ ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur
|
||||
ALTER TABLE llx_recruitment_recruitmentcandidature ADD email_date datetime after email_msgid;
|
||||
ALTER TABLE llx_ticket ADD email_date datetime after email_msgid;
|
||||
|
||||
INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT', 1, 1000, 'int', 0);
|
||||
|
||||
@@ -2108,7 +2108,7 @@ CreateCandidature=Create job application
|
||||
FormatZip=Zip
|
||||
MainMenuCode=Menu entry code (mainmenu)
|
||||
ECMAutoTree=Show automatic ECM tree
|
||||
OperationParamDesc=Define the rules to use to extract or set values.<br>Example for operations that need to extract a name from email subject:<br>name=EXTRACT:SUBJECT:Message from company ([^\n]*)<br>Example for operations that create objects:<br>objproperty1=SET:the value to set<br>objproperty2=SET:a value including value of __objproperty1__<br>objproperty3=SETIFEMPTY:value used if objproperty3 is not already defined<br>objproperty4=EXTRACT:HEADER:X-Myheaderkey:\s*([^\s]*)<br>options_myextrafield1=EXTRACT:SUBJECT:([^\n]*)<br>object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)<br><br>Use a ; char as separator to extract or set several properties.
|
||||
OperationParamDesc=Define the rules to use to extract some data or set values to use for operation.<br><br>Example to extract a company name from email subject into a temporary variable:<br>tmp_var=EXTRACT:SUBJECT:Message from company ([^\n]*)<br><br>Examples to set the properties of an object to create:<br>objproperty1=SET:a hard coded value<br>objproperty2=SET:__tmp_var__<br>objproperty3=SETIFEMPTY:a value (value is set only if property is not already defined)<br>objproperty4=EXTRACT:HEADER:X-Myheaderkey:\s*([^\s]*)<br>options_myextrafield1=EXTRACT:SUBJECT:([^\n]*)<br>object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)<br><br>Use a ; char as separator to extract or set several properties.
|
||||
OpeningHours=Opening hours
|
||||
OpeningHoursDesc=Enter here the regular opening hours of your company.
|
||||
ResourceSetup=Configuration of Resource module
|
||||
@@ -2287,4 +2287,6 @@ DoesNotWorkWithAllThemes=Will not work with all themes
|
||||
NoName=No name
|
||||
ShowAdvancedOptions= Show advanced options
|
||||
HideAdvancedoptions= Hide advanced options
|
||||
Images=Images
|
||||
MaxNumberOfImagesInGetPost=Max number of images allowed in GETPOST check
|
||||
CIDLookupURL=The module brings an URL that can be used by an external tool to get the name of a thirdparty or contact from its phone number. URL to use is:
|
||||
|
||||
@@ -59,7 +59,7 @@ BillsCoinsPad=Coins and banknotes Pad
|
||||
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
|
||||
TakeposNeedsCategories=TakePOS needs at least one product categorie to work
|
||||
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category <b>%s</b> to work
|
||||
OrderNotes=Can add some notes to each ordered items
|
||||
OrderNotes=Can add some notes to each ordered items
|
||||
CashDeskBankAccountFor=Default account to use for payments in
|
||||
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration
|
||||
TicketVatGrouped=Group VAT by rate in tickets|receipts
|
||||
@@ -118,7 +118,7 @@ ScanToOrder=Scan QR code to order
|
||||
Appearance=Appearance
|
||||
HideCategoryImages=Hide Category Images
|
||||
HideProductImages=Hide Product Images
|
||||
NumberOfLinesToShow=Number of lines of images to show
|
||||
NumberOfLinesToShow=Number of lines of images to show
|
||||
DefineTablePlan=Define tables plan
|
||||
GiftReceiptButton=Add a "Gift receipt" button
|
||||
GiftReceipt=Gift receipt
|
||||
@@ -138,8 +138,10 @@ TakeposBarcodeRuleToInsertProduct=Barcode rule to insert product
|
||||
TakeposBarcodeRuleToInsertProductDesc=Rule to extract the product reference + a quantity from a scanned barcode.<br>If empty (default value), application will use the full barcode scanned to find the product.<br><br>If defined, syntax must be:<br><b>ref:NB+qu:NB+qd:NB+other:NB</b><br>where NB is the number of characters to use to extract data from the scanned barcode with: <ul><li><b>ref</b> : product reference</li><li><b>qu</b> : quantity to set when inserting item (units)<l/i><li><b>qd</b> : quantity to set when inserting item (decimals)</li><li><b>other</b> : others characters</li></ul>
|
||||
AlreadyPrinted=Already printed
|
||||
HideCategories=Hide categories
|
||||
HideStockOnLine=Hide stock on line
|
||||
ShowOnlyProductInStock=Show the products in stock
|
||||
HideStockOnLine=Hide stock on line
|
||||
ShowOnlyProductInStock=Show the products in stock
|
||||
ShowCategoryDescription=Show category description
|
||||
ShowProductReference=Show reference of products
|
||||
UsePriceHT=Use price excl. taxes and not price incl. taxes
|
||||
UsePriceHT=Use price excl. taxes and not price incl. taxes
|
||||
TerminalName=Terminal %s
|
||||
TerminalNameDesc=Terminal name
|
||||
|
||||
@@ -290,6 +290,7 @@ ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by current ob
|
||||
ErrorAjaxRequestFailed=Request failed
|
||||
ErrorThirpdartyOrMemberidIsMandatory=Third party or Member of partnership is mandatory
|
||||
ErrorFailedToWriteInTempDirectory=Failed to write in temp directory
|
||||
ErrorQuantityIsLimitedTo=Quantity is limited to %s
|
||||
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
|
||||
@@ -9,8 +9,9 @@ HasAccessToken=A token was generated and saved into local database
|
||||
NewTokenStored=Token received and saved
|
||||
ToCheckDeleteTokenOnProvider=Click here to check/delete authorization saved by %s OAuth provider
|
||||
TokenDeleted=Token deleted
|
||||
GetAccess=Click here to get a token
|
||||
RequestAccess=Click here to request/renew access and receive a new token
|
||||
DeleteAccess=Click here to delete token
|
||||
DeleteAccess=Click here to delete the token
|
||||
UseTheFollowingUrlAsRedirectURI=Use the following URL as the Redirect URI when creating your credentials with your OAuth provider:
|
||||
ListOfSupportedOauthProviders=Add your OAuth2 token providers. Then, go on your OAuth provider admin page to create/get an OAuth ID and Secret and save them here. Once done, switch on the other tab to generate your token.
|
||||
OAuthSetupForLogin=Page to manage (generate/delete) OAuth tokens
|
||||
@@ -33,4 +34,6 @@ OAUTH_STRIPE_LIVE_NAME=OAuth Stripe Live
|
||||
OAUTH_ID=OAuth ID
|
||||
OAUTH_SECRET=OAuth secret
|
||||
OAuthProviderAdded=OAuth provider added
|
||||
AOAuthEntryForThisProviderAndLabelAlreadyHasAKey=An OAuth entry for this provider and label already exists
|
||||
AOAuthEntryForThisProviderAndLabelAlreadyHasAKey=An OAuth entry for this provider and label already exists
|
||||
URLOfServiceForAuthorization=URL provided by OAuth service for authentication
|
||||
Scopes=Scopes
|
||||
@@ -325,4 +325,6 @@ FTPFailedToRemoveDir=Failed to remove directory <b>%s</b>: check permissions and
|
||||
FTPPassiveMode=Passive mode
|
||||
ChooseAFTPEntryIntoMenu=Choose a FTP/SFTP site from the menu...
|
||||
FailedToGetFile=Failed to get files %s
|
||||
ErrorFTPNodisconnect=Error to disconnect FTP/SFTP server
|
||||
ErrorFTPNodisconnect=Error to disconnect FTP/SFTP server
|
||||
FileWasUpload=File <b>%s</b> was upload
|
||||
FTPFailedToUploadFile=Failed to upload file <b>%s</b>.
|
||||
|
||||
@@ -127,7 +127,7 @@ class CompanyBankAccount extends Account
|
||||
// End call triggers
|
||||
|
||||
if (!$error) {
|
||||
return 1;
|
||||
return $this->id;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class CompanyBankAccount extends Account
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print $this->db->error();
|
||||
$this->error = $this->db->lasterror();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ class CompanyBankAccount extends Account
|
||||
*/
|
||||
public function update(User $user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
$error = 0;
|
||||
|
||||
@@ -207,7 +207,11 @@ class CompanyBankAccount extends Account
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$this->error = $langs->trans('ErrorDuplicateField');
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ $terminaltouse = $terminal;
|
||||
if (GETPOST('action', 'alpha') == 'set') {
|
||||
$db->begin();
|
||||
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_TERMINAL_NAME_".$terminaltouse, (!empty(GETPOST('terminalname'.$terminaltouse, 'restricthtml')) ? GETPOST('terminalname'.$terminaltouse, 'restricthtml') : $langs->trans("TerminalName", $terminaltouse)), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY".$terminaltouse, (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
||||
@@ -148,6 +150,11 @@ print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("TerminalNameDesc").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="terminalname'.$terminal.'" value="'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$terminal, $langs->trans("TerminalName", $terminal)).'" >';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
|
||||
print '<td>';
|
||||
print $form->select_company($conf->global->{'CASHDESK_ID_THIRDPARTY'.$terminaltouse}, 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0);
|
||||
|
||||
@@ -955,14 +955,9 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
<a class="topnav-terminalhour" onclick="ModalBox('ModalTerminal');">
|
||||
<span class="fa fa-cash-register"></span>
|
||||
<span class="hideonsmartphone">
|
||||
<?php echo $langs->trans("Terminal"); ?>
|
||||
<?php echo getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"], $langs->trans("TerminalName", $_SESSION["takeposterminal"])); ?>
|
||||
</span>
|
||||
<?php echo " ";
|
||||
if ($_SESSION["takeposterminal"] == "") {
|
||||
echo "1";
|
||||
} else {
|
||||
echo $_SESSION["takeposterminal"];
|
||||
}
|
||||
<?php
|
||||
echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>';
|
||||
?>
|
||||
</a>
|
||||
@@ -1019,11 +1014,11 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
<h3><?php print $langs->trans("TerminalSelect"); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<button type="button" class="block" onclick="location.href='index.php?setterminal=1'"><?php print $langs->trans("Terminal"); ?> 1</button>
|
||||
<button type="button" class="block" onclick="location.href='index.php?setterminal=1'"><?php print getDolGlobalString("TAKEPOS_TERMINAL_NAME_1", $langs->trans("TerminalName", 1)); ?></button>
|
||||
<?php
|
||||
$nbloop = getDolGlobalInt('TAKEPOS_NUM_TERMINALS');
|
||||
for ($i = 2; $i <= $nbloop; $i++) {
|
||||
print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.'\'">'.$langs->trans("Terminal").' '.$i.'</button>';
|
||||
print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.'\'">'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$i, $langs->trans("TerminalName", $i)).'</button>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -562,13 +562,20 @@ if (empty($reshook)) {
|
||||
$invoice->fetch_thirdparty();
|
||||
$array_options = array();
|
||||
|
||||
$line = array('description' => $prod->description, 'price' => $price, 'tva_tx' => $tva_tx, 'locatax1_tx' => $localtax1_tx, 'locatax2_tx' => $localtax2_tx, 'remise_percent' => $customer->remise_percent, 'price_ttc' => $price_ttc, 'array_options' => $array_options);
|
||||
|
||||
// complete line by hook
|
||||
$parameters = array('prod' => $prod);
|
||||
$reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action);
|
||||
$parameters = array('prod' => $prod, 'line' => $line);
|
||||
$reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
if (empty($reshook)) {
|
||||
$idoflineadded = $invoice->addline($prod->description, $price, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', $array_options, 100, '', null, 0);
|
||||
if (!empty($hookmanager->resArray)) {
|
||||
$line = $hookmanager->resArray;
|
||||
}
|
||||
|
||||
$idoflineadded = $invoice->addline($line['description'], $line['price'], $qty, $line['tva_tx'], $line['localtax1_tx'], $line['localtax2_tx'], $idproduct, $line['remise_percent'], '', 0, 0, 0, '', $price_base_type, $line['price_ttc'], $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', $line['array_options'], 100, '', null, 0);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
|
||||
|
||||
@@ -543,6 +543,7 @@ fieldset {
|
||||
border: 1px solid #AAAAAA !important;
|
||||
padding-inline-start: 2em;
|
||||
padding-inline-end: 2em;
|
||||
min-inline-size: auto;
|
||||
}
|
||||
.legendforfieldsetstep { padding-bottom: 10px; }
|
||||
input#onlinepaymenturl, input#directdownloadlink {
|
||||
|
||||
@@ -725,6 +725,7 @@ fieldset {
|
||||
border: 1px solid #AAAAAA !important;
|
||||
padding-inline-start: 2em;
|
||||
padding-inline-end: 2em;
|
||||
min-inline-size: auto;
|
||||
}
|
||||
.legendforfieldsetstep { padding-bottom: 10px; }
|
||||
input#onlinepaymenturl, input#directdownloadlink {
|
||||
|
||||
@@ -97,7 +97,7 @@ llxHeader('', $title, $help_url);
|
||||
$head = user_prepare_head($object);
|
||||
|
||||
$title = $langs->trans("User");
|
||||
print dol_get_fiche_head($head, 'ldap', $title, 0, 'user');
|
||||
print dol_get_fiche_head($head, 'ldap', $title, -1, 'user');
|
||||
|
||||
$linkback = '';
|
||||
|
||||
@@ -110,7 +110,7 @@ dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $use
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Login
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
|
||||
|
||||
@@ -1059,29 +1059,35 @@ class Website extends CommonObject
|
||||
$line .= "'".$this->db->escape($objectpageold->grabbed_from)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->type_container)."', ";
|
||||
|
||||
// Make substitution with a generic path into htmlheader content
|
||||
$stringtoexport = $objectpageold->htmlheader;
|
||||
$stringtoexport = str_replace(array("\r\n", "\r", "\n"), "__N__", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=image/'.$website->ref.'/', "file=image/__WEBSITE_KEY__/", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
|
||||
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
|
||||
$stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport);
|
||||
|
||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
|
||||
$line .= "'".$this->db->escape(str_replace(array("\r\n", "\r", "\n"), "__N__", $stringtoexport))."', "; // Replace \r \n to have record on 1 line
|
||||
|
||||
// Make substitution with a generic path into page content
|
||||
$stringtoexport = $objectpageold->content;
|
||||
$stringtoexport = str_replace(array("\r\n", "\r", "\n"), "__N__", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=image/'.$website->ref.'/', "file=image/__WEBSITE_KEY__/", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
|
||||
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
|
||||
$stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport);
|
||||
$stringtoexport = str_replace('"image/'.$website->ref.'/', '"image/__WEBSITE_KEY__/', $stringtoexport); // When we have a link src="image/websiteref/file.png" into html content
|
||||
$stringtoexport = str_replace('"/image/'.$website->ref.'/', '"/image/__WEBSITE_KEY__/', $stringtoexport); // When we have a link src="/image/websiteref/file.png" into html content
|
||||
$stringtoexport = str_replace('"js/'.$website->ref.'/', '"js/__WEBSITE_KEY__/', $stringtoexport);
|
||||
$stringtoexport = str_replace('"/js/'.$website->ref.'/', '"/js/__WEBSITE_KEY__/', $stringtoexport);
|
||||
|
||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
|
||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
|
||||
|
||||
// When we have a link src="image/websiteref/file.png" into html content
|
||||
$stringtoexport = str_replace('="image/'.$website->ref.'/', '="image/__WEBSITE_KEY__/', $stringtoexport);
|
||||
|
||||
$line .= "'".$this->db->escape($stringtoexport)."', "; // Replace \r \n to have record on 1 line
|
||||
$line .= "'".$this->db->escape($objectpageold->author_alias)."', ";
|
||||
|
||||
Reference in New Issue
Block a user