chores: miriad of getDolGlobal and hesRight uses along side this feature

This commit is contained in:
Florian HENRY 2023-05-03 21:13:39 +02:00
parent 31b6076f1c
commit a4bd368f1d
13 changed files with 52 additions and 21 deletions

View File

@ -243,7 +243,7 @@ while ($i < $nbofbank) {
}
print "</td>\n";
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
if (getDolGlobalInt('BANK_SHOW_ORDER_OPTION') == $i) {
print '<td class="center">';
print img_picto($langs->trans("Activated"), 'on');
print '</td>';
@ -415,7 +415,7 @@ print '<tr class="oddeven"><td colspan="4" width="100">';
print $langs->trans('BankColorizeMovementDesc');
print "</td>";
// Active
if ($conf->global->BANK_COLORIZE_MOVEMENT) {
if (!empty(getDolGlobalInt('BANK_COLORIZE_MOVEMENT'))) {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetbankcolorizemovement&token='.newToken().'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
@ -429,7 +429,7 @@ if ($conf->global->BANK_COLORIZE_MOVEMENT) {
print "</tr>\n";
if (!empty($conf->global->BANK_COLORIZE_MOVEMENT)) {
if (!empty(getDolGlobalInt('BANK_COLORIZE_MOVEMENT'))) {
$i = 1;
while ($i <= 2) {
$key = $i;
@ -471,7 +471,7 @@ print "</td><td>\n";
print $langs->trans('AutoReportLastAccountStatement');
print '</td>';
// Active
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
if (!empty(getDolGlobalString('BANK_REPORT_LAST_NUM_RELEVE'))) {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetreportlastnumreleve&token='.newToken().'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
@ -482,8 +482,18 @@ if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
print "</tr>\n";
// Allow SEPA Mandate OnLine Sign
if (empty(getDolGlobalInt('SOCIETE_DISABLE_BANKACCOUNT'))) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowOnLineSign").'</td><td>'.$langs->trans("BankAccountModelModule").'</td>';
print '<td class="center" colspan="2">';
print ajax_constantonoff('SOCIETE_RIB_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';
}
print '</table>';
print dol_get_fiche_end();

View File

@ -632,7 +632,12 @@ print '<td class="center" colspan="2">';
print ajax_constantonoff('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';
// Allow external download
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowOnLineSign").'</td>';
print '<td class="center" colspan="2">';
print ajax_constantonoff('PROPOSAL_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1);
print '</td></tr>';
// default update prices on cloning a proposal
/*

View File

@ -3035,7 +3035,7 @@ if ($action == 'create') {
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
// Show online signature link
$useonlinesignature = 1;
$useonlinesignature = getDolGlobalInt('PROPOSAL_ALLOW_ONLINESIGN');
if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
print '<br><!-- Link to sign -->';

View File

@ -5536,32 +5536,35 @@ abstract class CommonObject
// Set the public "share" key
$setsharekey = false;
if ($this->element == 'propal' || $this->element == 'proposal') {
if (!isset($conf->global->PROPOSAL_ALLOW_ONLINESIGN) || !empty($conf->global->PROPOSAL_ALLOW_ONLINESIGN)) {
if (!emptygetDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
$setsharekey = true; // feature to make online signature is not set or set to on (default)
}
if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) {
if (!empty(getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
}
if ($this->element == 'commande' && !empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'commande' && !empty(getDolGlobalInt("ORDER_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
if ($this->element == 'facture' && !empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'facture' && !empty(getDolGlobalInt("INVOICE_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'bank_account' && !empty(getDolGlobalInt("BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
if ($this->element == 'product' && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'product' && !empty(getDolGlobalInt("PRODUCT_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'contrat' && !empty(getDolGlobalInt("CONTRACT_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
if ($this->element == 'fichinter' && !empty($conf->global->FICHINTER_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'fichinter' && !empty(getDolGlobalInt("FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
if ($this->element == 'supplier_proposal' && !empty($conf->global->SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) {
if ($this->element == 'supplier_proposal' && !empty(getDolGlobalInt("SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD"))) {
$setsharekey = true;
}
if ($this->element == 'societe_rib' && !empty(getDolGlobalInt("SOCIETE_RIB_ALLOW_ONLINESIGN"))) {
$setsharekey = true;
}

View File

@ -188,7 +188,7 @@ function societe_prepare_head(Societe $object)
}
// Bank accounts
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) {
if (empty(getDolGlobalInt('SOCIETE_DISABLE_BANKACCOUNT'))) {
$nbBankAccount = 0;
$foundonexternalonlinesystem = 0;
$langs->load("bills");

View File

@ -2882,7 +2882,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (empty($entity) || empty($conf->societe->multidir_output[$entity])) {
return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
}
if ($fuser->rights->societe->{$lire} || preg_match('/^specimen/i', $original_file)) {
if ($fuser->hasRight('societe', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->societe->multidir_output[$entity].'/'.$original_file;

View File

@ -104,6 +104,13 @@ class modPropale extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "PROPOSAL_ALLOW_ONLINESIGN";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "1";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
/*$this->const[$r][0] = "PROPALE_DRAFT_WATERMARK";
$this->const[$r][2] = "__(Draft)__";
$this->const[$r][3] = 'Watermark to show on draft proposals';

View File

@ -412,3 +412,5 @@ CREATE TABLE llx_c_invoice_subtype (
ALTER TABLE llx_c_invoice_subtype ADD UNIQUE INDEX uk_c_invoice_subtype (entity, code);
ALTER TABLE llx_societe_rib ADD COLUMN last_main_doc varchar(255) AFTER currency_code;
INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('PROPOSAL_ALLOW_ONLINESIGN', 1, '1', 'string', 0);

View File

@ -2387,3 +2387,4 @@ Defaultfortype=Default
DefaultForTypeDesc=Template used by default when creating a new email for the template type
OptionXShouldBeEnabledInModuleY=Option "<b>%s</b>" should be enabled into module <b>%s</b>
OptionXIsCorrectlyEnabledInModuleY=Option "<b>%s</b>" is enabled into module <b>%s</b>
AllowOnLineSign=Allow On Line signature

View File

@ -2377,5 +2377,5 @@ WarningModuleHasChangedSecurityCsrfParameter=Attention : le module %sa désactiv
EMailsInGoingDesc=La réception des e-mails est gérée par le module %s. Vous devez l'activer et le configurer si vous avez besoin de prendre en charge messages entrants.
MAIN_IMAP_USE_PHPIMAP=Utiliser la librairie PHP-IMAP pour la prise en charge IMAP, à la place du support IMAP natif de PHP. Ceci permet également l'utilisation d'une connexion OAuth2 pour IMAP (le module OAuth doit aussi être activé).
MAIN_CHECKBOX_LEFT_COLUMN=Afficher la colonne de sélection de champ et de ligne à gauche (à droite par défaut)
CSSPage=Style CSS
AllowOnLineSign=Activer la signature en ligne

View File

@ -565,10 +565,11 @@ if ($source == 'proposal') {
'force_dir_output'=>$diroutput
);
$result = $object->thirdparty->generateDocument($defaulttemplate, $langs, 0, 0, 0, $moreparams);
$object->last_main_doc=$object->thirdparty->last_main_doc;
}
var_dump($object->last_main_doc);
$directdownloadlink = $object->getLastMainDocLink('company');
var_dump($directdownloadlink);
var_dump('toto', $directdownloadlink);
if ($directdownloadlink) {
print '<br><a href="'.$directdownloadlink.'">';
print img_mime($object->last_main_doc, '');

View File

@ -4993,6 +4993,7 @@ class Societe extends CommonObject
dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors);
}
$result = $companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
$this->last_main_doc=$companybankaccount->last_main_doc;
} else {
// Positionne le modele sur le nom du modele a utiliser
if (!dol_strlen($modele)) {

View File

@ -1446,6 +1446,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print_liste_field_titre("WithdrawMode");
}
print_liste_field_titre("Default", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre('', '', '', '', '', '', '', '', 'center ');
print_liste_field_titre('', '', '', '', '', '', '', '', 'center ');
// Fields from hook