mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
This commit is contained in:
commit
acc7a8b1be
|
|
@ -60,6 +60,8 @@ if ($action == 'update') {
|
|||
$amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2);
|
||||
$minamount = GETPOST('MEMBER_MIN_AMOUNT');
|
||||
$publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC');
|
||||
$showtable = GETPOST('MEMBER_SHOW_TABLE');;
|
||||
$showvoteallowed = GETPOST('MEMBER_SHOW_VOTE_ALLOWED');
|
||||
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
|
||||
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int');
|
||||
$forcemorphy = GETPOST('MEMBER_NEWFORM_FORCEMORPHY', 'aZ09');
|
||||
|
|
@ -68,6 +70,8 @@ if ($action == 'update') {
|
|||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", !$showtable, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show"
|
||||
$res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", !$showvoteallowed, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show"
|
||||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
|
||||
if ($forcetype < 0) {
|
||||
$res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
|
||||
|
|
@ -246,6 +250,22 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
|||
print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", (!empty($conf->global->MEMBER_COUNTERS_ARE_PUBLIC) ? $conf->global->MEMBER_COUNTERS_ARE_PUBLIC : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0)
|
||||
$skiptable = (!empty($conf->global->MEMBER_SKIP_TABLE) ? $conf->global->MEMBER_SKIP_TABLE : 0);
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MembersShowMembershipTypesTable");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("MEMBER_SHOW_TABLE", !$skiptable, 1); // Reverse the logic "hide -> show" for retrocompatibility
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Show "vote allowed" setting for membership types
|
||||
$hidevoteallowed = (!empty($conf->global->MEMBER_HIDE_VOTE_ALLOWED) ? $conf->global->MEMBER_HIDE_VOTE_ALLOWED : 0);
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MembersShowVotesAllowed");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("MEMBER_SHOW_VOTE_ALLOWED", !$hidevoteallowed, 1); // Reverse the logic "hide -> show" for retrocompatibility
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="trpayment"><td>';
|
||||
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
||||
|
|
|
|||
|
|
@ -607,6 +607,7 @@ class Documents extends DolibarrApi
|
|||
|
||||
if ($ref) {
|
||||
$tmpreldir = '';
|
||||
$fetchbyid = false;
|
||||
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice') {
|
||||
$modulepart = 'facture';
|
||||
|
|
@ -666,13 +667,22 @@ class Documents extends DolibarrApi
|
|||
$modulepart = 'propale';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$object = new Propal($this->db);
|
||||
} elseif ($modulepart == 'contact' || $modulepart == 'socpeople') {
|
||||
$modulepart = 'contact';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$object = new Contact($this->db);
|
||||
$fetchbyid = true;
|
||||
} else {
|
||||
// TODO Implement additional moduleparts
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
if (is_object($object)) {
|
||||
$result = $object->fetch('', $ref);
|
||||
if ($fetchbyid) {
|
||||
$result = $object->fetch($ref);
|
||||
} else {
|
||||
$result = $object->fetch('', $ref);
|
||||
}
|
||||
|
||||
if ($result == 0) {
|
||||
throw new RestException(404, "Object with ref '".$ref."' was not found.");
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Markus Welters <markus@welters.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -126,8 +126,8 @@ if (empty($reshook)) {
|
|||
$bprev = new BonPrelevement($db);
|
||||
|
||||
if (!$error) {
|
||||
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
|
||||
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
|
||||
// getDolGlobalString('PRELEVEMENT_CODE_BANQUE') and getDolGlobalString('PRELEVEMENT_CODE_GUICHET') should be empty (we don't use them anymore)
|
||||
$result = $bprev->create(getDolGlobalString('PRELEVEMENT_CODE_BANQUE'), getDolGlobalString('PRELEVEMENT_CODE_GUICHET'), $mode, $format, $executiondate, 0, $type);
|
||||
if ($result < 0) {
|
||||
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
||||
} elseif ($result == 0) {
|
||||
|
|
|
|||
|
|
@ -726,6 +726,8 @@ class ExtraFields
|
|||
|
||||
if (is_array($param) && count($param) > 0) {
|
||||
$params = serialize($param);
|
||||
} elseif (is_array($param)) {
|
||||
$params = '';
|
||||
} elseif (strlen($param) > 0) {
|
||||
$params = trim($param);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1445,7 +1445,25 @@ class FormFile
|
|||
if (in_array($modulepart, array('product', 'produit', 'service'))) {
|
||||
$newmodulepart = 'produit|service';
|
||||
}
|
||||
|
||||
if (image_format_supported($file['name']) > 0) {
|
||||
if ($permtoeditline) {
|
||||
$moreparaminurl = '';
|
||||
if (!empty($object->id) && $object->id > 0) {
|
||||
$moreparaminurl .= '&id='.$object->id;
|
||||
} elseif (GETPOST('website', 'alpha')) {
|
||||
$moreparaminurl .= '&website='.GETPOST('website', 'alpha');
|
||||
}
|
||||
// Set the backtourl
|
||||
if ($modulepart == 'medias' && !GETPOST('website')) {
|
||||
$moreparaminurl .= '&backtourl='.urlencode(DOL_URL_ROOT.'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.'§ion_dir='.$relativepath);
|
||||
}
|
||||
if ($modulepart == 'medias' && !GETPOST('website')) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/ecm/index_medias.php?action=confirmconvertimgwebp&token='.newToken().'§ion_dir='.urlencode($relativepath).'&filetoregenerate='.urlencode($fileinfo['basename']).'&module='.$modulepart.$param.$moreparaminurl.'" title="'.dol_escape_htmltag($langs->trans("GenerateChosenImgWebp")).'">'.img_picto('', 'images', 'class="flip marginrightonly"').'</a>';
|
||||
} elseif ($modulepart == 'medias' && GETPOST('website')) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/website/index.php?action=confirmconvertimgwebp&token='.newToken().'§ion_dir='.urlencode($relativepath).'&filetoregenerate='.urlencode($fileinfo['basename']).'&module='.$modulepart.$param.$moreparaminurl.'" title="'.dol_escape_htmltag($langs->trans("GenerateChosenImgWebp")).'">'.img_picto('', 'images', 'class="flip marginrightonly"').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$disablecrop && image_format_supported($file['name']) > 0) {
|
||||
if ($permtoeditline) {
|
||||
// Link to resize
|
||||
|
|
|
|||
|
|
@ -416,3 +416,85 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
|
|||
|
||||
return $error ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete all permissions
|
||||
* @param string $file file with path
|
||||
* @return void
|
||||
*/
|
||||
function deletePerms($file)
|
||||
{
|
||||
$start = "/* BEGIN MODULEBUILDER PERMISSIONS */";
|
||||
$end = "/* END MODULEBUILDER PERMISSIONS */";
|
||||
$i = 1;
|
||||
$array = array();
|
||||
$lines = file($file);
|
||||
// Search for start and end lines
|
||||
foreach ($lines as $i => $line) {
|
||||
if (strpos($line, $start) !== false) {
|
||||
$start_line = $i + 1;
|
||||
|
||||
// Copy lines until the end on array
|
||||
while (($line = $lines[++$i]) !== false) {
|
||||
if (strpos($line, $end) !== false) {
|
||||
$end_line = $i + 1;
|
||||
break;
|
||||
}
|
||||
$array[] = $line;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$allContent = implode("", $array);
|
||||
dolReplaceInFile($file, array($allContent => ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewriting all permissions after any actions
|
||||
* @param string $file filename or path
|
||||
* @param array $permissions permissions existing in file
|
||||
* @param int|null $key key for permission needed
|
||||
* @param array|null $right $right to update or add
|
||||
* @param int $action 0 for delete, 1 for add, 2 for update
|
||||
* @return int 1 if OK,-1 if KO
|
||||
*/
|
||||
function reWriteAllPermissions($file, $permissions, $key, $right, $action)
|
||||
{
|
||||
$error = 0;
|
||||
$rights = array();
|
||||
if ($action == 0) {
|
||||
// delete right from permissions array
|
||||
array_splice($permissions, array_search($permissions[$key], $permissions), 1);
|
||||
} elseif ($action == 1) {
|
||||
array_push($permissions, $right);
|
||||
} elseif ($action == 2 && !empty($right)) {
|
||||
// update right from permissions array
|
||||
array_splice($permissions, array_search($permissions[$key], $permissions), 1, $right);
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
// prepare permissions array
|
||||
$count_perms = count($permissions);
|
||||
for ($i = 0;$i<$count_perms;$i++) {
|
||||
$permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)";
|
||||
$permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'";
|
||||
$permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'";
|
||||
$permissions[$i][5] = "\$this->rights[\$r][5] = '".$permissions[$i][5]."';\n\t\t";
|
||||
}
|
||||
|
||||
//convert to string
|
||||
foreach ($permissions as $perms) {
|
||||
$rights[] = implode(";\n\t\t", $perms);
|
||||
$rights[] = "\$r++;\n\t\t";
|
||||
}
|
||||
$rights_str = implode("", $rights);
|
||||
// delete all permission from file
|
||||
deletePerms($file);
|
||||
// rewrite all permission again
|
||||
dolReplaceInFile($file, array('/* BEGIN MODULEBUILDER PERMISSIONS */' => '/* BEGIN MODULEBUILDER PERMISSIONS */'."\n\t\t".$rights_str));
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018-2021 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -342,10 +342,10 @@ class doc_generic_mo_odt extends ModelePDFMo
|
|||
$odfHandler = new odf(
|
||||
$srctemplatepath,
|
||||
array(
|
||||
'PATH_TO_TMP' => $conf->mrp->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
'PATH_TO_TMP' => $conf->mrp->dir_temp,
|
||||
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||
'DELIMITER_LEFT' => '{',
|
||||
'DELIMITER_RIGHT' => '}'
|
||||
)
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
|
|
@ -359,8 +359,6 @@ class doc_generic_mo_odt extends ModelePDFMo
|
|||
// [!-- BEGIN lines --]*[!-- END lines --]
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
/*
|
||||
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
try {
|
||||
|
|
@ -461,7 +459,7 @@ class doc_generic_mo_odt extends ModelePDFMo
|
|||
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
*/
|
||||
|
||||
// Write new file
|
||||
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -197,18 +197,22 @@ if ($action == 'confirmconvertimgwebp') {
|
|||
|
||||
$section_dir=GETPOST('section_dir', 'alpha');
|
||||
$section=GETPOST('section', 'alpha');
|
||||
$file=GETPOST('filetoregenerate', 'alpha');
|
||||
$form = new Form($db);
|
||||
$formquestion['section_dir']=array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir');
|
||||
$formquestion['section']=array('type'=>'hidden', 'value'=>$section, 'name'=>'section');
|
||||
$formquestion['filetoregenerate']=array('type'=>'hidden', 'value'=>$file, 'name'=>'filetoregenerate');
|
||||
if ($module == 'medias') {
|
||||
$formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website');
|
||||
}
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', $formquestion, "yes", 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp'), 'convertimgwebp', $formquestion, "yes", 1);
|
||||
$action = 'file_manager';
|
||||
}
|
||||
|
||||
// Duplicate images into .webp
|
||||
if ($action == 'convertimgwebp' && $permtoadd) {
|
||||
$file = GETPOST('filetoregenerate', 'alpha');
|
||||
|
||||
if ($module == 'medias') {
|
||||
$imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha'));
|
||||
} else {
|
||||
|
|
@ -217,9 +221,14 @@ if ($action == 'convertimgwebp' && $permtoadd) {
|
|||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
$regeximgext = getListOfPossibleImageExt();
|
||||
if (!empty($file)) {
|
||||
$filelist = array();
|
||||
$filelist[]["fullname"] = dol_osencode($imagefolder.'/'.$file); // get $imagefolder.'/'.$file infos
|
||||
} else {
|
||||
$regeximgext = getListOfPossibleImageExt();
|
||||
|
||||
$filelist = dol_dir_list($imagefolder, "files", 0, $regeximgext);
|
||||
$filelist = dol_dir_list($imagefolder, "files", 0, $regeximgext);
|
||||
}
|
||||
|
||||
$nbconverted = 0;
|
||||
|
||||
|
|
@ -245,7 +254,11 @@ if ($action == 'convertimgwebp' && $permtoadd) {
|
|||
}
|
||||
}
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans('SucessConvertImgWebp'), null);
|
||||
if (!empty($file)) {
|
||||
setEventMessages($langs->trans('SucessConvertChosenImgWebp'), null);
|
||||
} else {
|
||||
setEventMessages($langs->trans('SucessConvertImgWebp'), null);
|
||||
}
|
||||
}
|
||||
$action = 'file_manager';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ ECMSetup=ECM Setup
|
|||
GenerateImgWebp=Duplicate all images with another version with .webp format
|
||||
ConfirmGenerateImgWebp=If you confirm, you will generate an image in .webp format for all images currently into this folder (subfolders are not included)...
|
||||
ConfirmImgWebpCreation=Confirm all images duplication
|
||||
GenerateChosenImgWebp=Duplicate chosen image with another version with .webp format
|
||||
ConfirmGenerateChosenImgWebp=If you confirm, you will generate an image in .webp format for chosen image
|
||||
ConfirmChosenImgWebpCreation=Confirm chosen images duplication
|
||||
SucessConvertImgWebp=Images successfully duplicated
|
||||
SucessConvertChosenImgWebp=Chosen image successfully duplicated
|
||||
ECMDirName=Dir name
|
||||
ECMParentDirectory=Parent directory
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ MembersListNotUpToDate=List of valid members with out-of-date contribution
|
|||
MembersListExcluded=List of excluded members
|
||||
MembersListResiliated=List of terminated members
|
||||
MembersListQualified=List of qualified members
|
||||
MembersShowMembershipTypesTable=Show a table of all available membership types (if no, show directly the registration form)
|
||||
MembersShowVotesAllowed=Show whether votes are allowed, in the table of membership types
|
||||
MenuMembersToValidate=Draft members
|
||||
MenuMembersValidated=Validated members
|
||||
MenuMembersExcluded=Excluded members
|
||||
|
|
|
|||
|
|
@ -2146,6 +2146,7 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
|
|||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rights")), null, 'errors');
|
||||
}
|
||||
|
||||
$id = GETPOST('id', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$objectForPerms = strtolower(GETPOST('permissionObj', 'alpha'));
|
||||
$crud = GETPOST('crud', 'alpha');
|
||||
|
|
@ -2168,8 +2169,6 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
|
|||
$counter = 0;
|
||||
$permsForObject =array();
|
||||
$permissions = $moduleobj->rights;
|
||||
$firstRight = 0;
|
||||
$existRight = 0;
|
||||
$allObject = array();
|
||||
|
||||
$countPerms = count($permissions);
|
||||
|
|
@ -2188,53 +2187,34 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
|
|||
$countPermsObj = count($permsForObject);
|
||||
for ($j = 0; $j<$countPermsObj; $j++) {
|
||||
if (in_array($label, $permsForObject[$j])) {
|
||||
$existRight++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)), null, 'errors');
|
||||
}
|
||||
}
|
||||
// if not found permission for the object
|
||||
if (!in_array($objectForPerms, array_unique($allObject))) {
|
||||
$firstRight++;
|
||||
$existRight++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$key = $countPerms + 1;
|
||||
//prepare right to add
|
||||
$rightToAdd = [
|
||||
0=> $id,
|
||||
1=>$label,
|
||||
4=>$objectForPerms,
|
||||
5=>$crud
|
||||
];
|
||||
|
||||
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
//rewriting all permissions after add a right
|
||||
reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightToAdd, 1);
|
||||
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
|
||||
|
||||
if (isModEnabled(strtolower($module))) {
|
||||
$result = unActivateModule(strtolower($module));
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
|
||||
if ($result) {
|
||||
setEventMessages($result, null, 'errors');
|
||||
}
|
||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
|
||||
setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
|
||||
}
|
||||
//prepare stirng to add
|
||||
$rightToAdd = "
|
||||
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
|
||||
\$this->rights[\$r][1] = '$label';
|
||||
\$this->rights[\$r][4] = '$objectForPerms';
|
||||
\$this->rights[\$r][5] = '$crud';
|
||||
\$r++;
|
||||
";
|
||||
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
|
||||
//var_dump($existRight.' '.$firstRight);exit;
|
||||
if (!$existRight) {
|
||||
dolReplaceInFile($moduledescriptorfile, array('/*END '.strtoupper($objectForPerms).'*/' => $rightToAdd.'/*END '.strtoupper($objectForPerms).'*/'));
|
||||
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
|
||||
}
|
||||
if ($firstRight > 0) {
|
||||
$filecontentbefore = file_get_contents($moduledescriptorfile);
|
||||
|
||||
$result = dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectForPerms).'*/'.$rightToAdd."/*END ".strtoupper($objectForPerms).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */'));
|
||||
|
||||
$filecontentafter = file_get_contents($moduledescriptorfile);
|
||||
|
||||
if ($filecontentbefore != $filecontentafter) {
|
||||
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
|
||||
} else {
|
||||
setEventMessages($langs->trans('FailedToAddCodeIntoDescriptor', 'END MODULEBUILDER PERMISSIONS'), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearstatcache(true);
|
||||
|
|
@ -2291,11 +2271,11 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
|
|||
}
|
||||
|
||||
$permissions = $moduleobj->rights;
|
||||
$r =(int) GETPOST('counter');
|
||||
$key =(int) GETPOST('counter')-1;
|
||||
//get permission want to delete from permissions array
|
||||
$x1 = $permissions[$r-1][1];
|
||||
$x2 = $permissions[$r-1][4];
|
||||
$x3 = $permissions[$r-1][5];
|
||||
$x1 = $permissions[$key][1];
|
||||
$x2 = $permissions[$key][4];
|
||||
$x3 = $permissions[$key][5];
|
||||
//check existing object permission
|
||||
$counter = 0;
|
||||
$permsForObject =array();
|
||||
|
|
@ -2325,24 +2305,6 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
|
|||
}
|
||||
}
|
||||
|
||||
// TODO ALI Update of permission must be done by rewriting completely the permission section
|
||||
//prepare right want to delete
|
||||
$right = "
|
||||
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
|
||||
\$this->rights[\$r][1] = '$x1';
|
||||
\$this->rights[\$r][4] = '$x2';
|
||||
\$this->rights[\$r][5] = '$x3';
|
||||
\$r++;
|
||||
";
|
||||
// right after editing
|
||||
$rightUpdated = "
|
||||
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
|
||||
\$this->rights[\$r][1] = '$label';
|
||||
\$this->rights[\$r][4] = '$objectForPerms';
|
||||
\$this->rights[\$r][5] = '$crud';
|
||||
\$r++;
|
||||
";
|
||||
|
||||
if (!$error) {
|
||||
if (isModEnabled(strtolower($module))) {
|
||||
$result = unActivateModule(strtolower($module));
|
||||
|
|
@ -2350,12 +2312,12 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
|
|||
if ($result) {
|
||||
setEventMessages($result, null, 'errors');
|
||||
}
|
||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
|
||||
setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
|
||||
}
|
||||
|
||||
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
$check = dolReplaceInFile($moduledescriptorfile, array($right => $rightUpdated));
|
||||
// rewriting all permissions after update permission needed
|
||||
reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightUpdated, 2);
|
||||
|
||||
setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null);
|
||||
|
||||
|
|
@ -2386,36 +2348,13 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p
|
|||
|
||||
$permissions = $moduleobj->rights;
|
||||
$key = (int) GETPOST('permskey', 'int')-1;
|
||||
//get permission want to delete from permissions array
|
||||
$x1 = $permissions[$key][1];
|
||||
$x2 = $permissions[$key][4];
|
||||
$x3 = $permissions[$key][5];
|
||||
//prepare right want to delete
|
||||
$rightTodelete = "
|
||||
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
|
||||
\$this->rights[\$r][1] = '$x1';
|
||||
\$this->rights[\$r][4] = '$x2';
|
||||
\$this->rights[\$r][5] = '$x3';
|
||||
\$r++;
|
||||
";
|
||||
|
||||
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
|
||||
// TODO ALI The delete must be done by rewriting all content between /* BEGIN MODULEBUILDER PERMISSIONS */ and /* END MODULEBUILDER PERMISSIONS */
|
||||
$check = dolReplaceInFile($moduledescriptorfile, array($rightTodelete => "\n\t\t"));
|
||||
|
||||
if ($check > 0) {
|
||||
//check if all permissions of object was deleted
|
||||
$permsForObj = array();
|
||||
foreach ($permissions as $perms) {
|
||||
$permsForObj[] = $perms[4];
|
||||
}
|
||||
$permsForObj = array_count_values($permsForObj);
|
||||
if ($permsForObj[$permissions[$key][4]] == 1) {
|
||||
$delObjStart = dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($permissions[$key][4].'*/') => '','/*END '.strtoupper($permissions[$key][4].'*/') => ''));
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
|
||||
// rewriting all permissions
|
||||
reWriteAllPermissions($moduledescriptorfile, $permissions, $key, '', 0);
|
||||
|
||||
// check if module is enabled
|
||||
if (isModEnabled(strtolower($module))) {
|
||||
$result = unActivateModule(strtolower($module));
|
||||
|
|
|
|||
|
|
@ -630,6 +630,12 @@ if (!empty($extrafields->attributes[$object->table_element]['label']) && is_arra
|
|||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON m.fk_user_author = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
|
||||
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " WHERE m.fk_product = p.rowid";
|
||||
if ($msid > 0) {
|
||||
$sql .= " AND m.rowid = ".((int) $msid);
|
||||
|
|
|
|||
|
|
@ -836,6 +836,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
|
|||
$units[$lines->short_label] = $langs->trans(ucfirst($lines->label));
|
||||
|
||||
$publiccounters = getDolGlobalString("MEMBER_COUNTERS_ARE_PUBLIC");
|
||||
$hidevoteallowed = getDolGlobalString("MEMBER_HIDE_VOTE_ALLOWED");
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut as status, d.morphy,";
|
||||
$sql .= " COUNT(a.rowid) AS membercount";
|
||||
|
|
@ -859,7 +860,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
|
|||
print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Amount").'</th>';
|
||||
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
|
||||
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
|
||||
if (empty($hidevoteallowed)) print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
|
||||
if ($publiccounters) print '<th class="center">'.$langs->trans("Members").'</th>';
|
||||
print '<th class="center">'.$langs->trans("NewSubscription").'</th>';
|
||||
print "</tr>\n";
|
||||
|
|
@ -899,7 +900,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
|
|||
print $langs->trans("MorAndPhy");
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
if (empty($hidevoteallowed)) print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
$membercount = $objp->membercount>0? $objp->membercount: "–";
|
||||
if ($publiccounters) print '<td class="center">'.$membercount.'</td>';
|
||||
print '<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.'">'.$langs->trans("GetMembershipButtonLabel").'</button></td>';
|
||||
|
|
|
|||
|
|
@ -326,8 +326,13 @@ class Contacts extends DolibarrApi
|
|||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
} elseif ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->contact->array_options[$index] = $val;
|
||||
}
|
||||
} else {
|
||||
$this->contact->$field = $value;
|
||||
}
|
||||
$this->contact->$field = $value;
|
||||
}
|
||||
|
||||
if (isModEnabled('mailing') && !empty($this->contact->email) && isset($this->contact->no_email)) {
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$companybankaccount->old = dol_clone($companybankaccount);
|
||||
$companybankaccount->oldcopy = dol_clone($companybankaccount);
|
||||
|
||||
$companybankaccount->socid = $object->id;
|
||||
|
||||
|
|
@ -196,8 +196,8 @@ if (empty($reshook)) {
|
|||
$companybankaccount->setAsDefault($id); // This will make sure there is only one default rib
|
||||
}
|
||||
|
||||
if ($companypaymentmode->old->stripe_card_ref != $companypaymentmode->stripe_card_ref) {
|
||||
if ($companybankaccount->old->iban != $companybankaccount->iban) {
|
||||
if ($companypaymentmode->oldcopy->stripe_card_ref != $companypaymentmode->stripe_card_ref) {
|
||||
if ($companybankaccount->oldcopy->iban != $companybankaccount->iban) {
|
||||
// TODO If we modified the iban, we must also update the pm_ on Stripe side, or break the link completely ?
|
||||
}
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ if (empty($reshook)) {
|
|||
|
||||
$companypaymentmode->fetch($id);
|
||||
if (!$error) {
|
||||
$companybankaccount->old = dol_clone($companybankaccount);
|
||||
$companybankaccount->oldcopy = dol_clone($companybankaccount);
|
||||
|
||||
$companypaymentmode->fk_soc = $object->id;
|
||||
|
||||
|
|
@ -258,8 +258,8 @@ if (empty($reshook)) {
|
|||
$companypaymentmode->setAsDefault($id); // This will make sure there is only one default rib
|
||||
}
|
||||
|
||||
if ($companypaymentmode->old->stripe_card_ref != $companypaymentmode->stripe_card_ref) {
|
||||
if ($companybankaccount->old->number != $companybankaccount->number) {
|
||||
if ($companypaymentmode->oldcopy->stripe_card_ref != $companypaymentmode->stripe_card_ref) {
|
||||
if ($companybankaccount->oldcopy->number != $companybankaccount->number) {
|
||||
// TODO If we modified the card, we must also update the pm_ on Stripe side, or break the link completely ?
|
||||
}
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ if (empty($reshook)) {
|
|||
$companybankaccount->rum = GETPOST('rum', 'alpha');
|
||||
$companybankaccount->date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth', 'int'), GETPOST('date_rumday', 'int'), GETPOST('date_rumyear', 'int'));
|
||||
$companybankaccount->datec = dol_now();
|
||||
$companybankaccount->status = 1;
|
||||
$companybankaccount->status = 1;
|
||||
|
||||
$companybankaccount->bank = trim($companybankaccount->bank);
|
||||
if (empty($companybankaccount->bank) && !empty($companybankaccount->thirdparty)) {
|
||||
|
|
@ -1023,7 +1023,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
|||
// Get list of remote payment modes
|
||||
$listofsources = array();
|
||||
|
||||
if (is_object($stripe)) {
|
||||
if (isset($stripe) && is_object($stripe)) {
|
||||
try {
|
||||
$customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus);
|
||||
if (!empty($customerstripe->id)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user