Merge branch '15.0' of github.com:Dolibarr/dolibarr into 15_fix_export_contact

This commit is contained in:
Florian HENRY
2023-09-19 11:35:37 +02:00
48 changed files with 258 additions and 143 deletions

View File

@@ -509,8 +509,8 @@ if (!$error && $massaction == 'confirm_presend') {
$resaction .= '<div class="error">'.$mailfile->error.'</div>';
} else {
$result = $mailfile->sendfile();
if ($result) {
$resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'<br>'; // Must not contain "
if ($result > 0) {
$resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($mailfile->addr_from, 2), $mailfile->getValidAddress($mailfile->addr_to, 2)).'<br>'; // Must not contain "
$error = 0;

View File

@@ -6415,6 +6415,11 @@ abstract class CommonObject
$this->array_options["options_".$key] = null;
}
break;
case 'link':
if ($this->array_options["options_".$key] === '') {
$this->array_options["options_".$key] = null;
}
break;
/*
case 'link':
$param_list = array_keys($attributeParam['options']);
@@ -9452,6 +9457,19 @@ abstract class CommonObject
$this->{$key} = $value;
}
}
// Force values to default values when known
foreach ($this->fields as $key => $value) {
// If fields are already set, do nothing
if (array_key_exists($key, $fields)) {
continue;
}
if (!empty($value['default'])) {
$this->$key = $value['default'];
}
}
return 1;
}

View File

@@ -2000,6 +2000,9 @@ class ExtraFields
|| (!is_array($_POST["options_".$key]) && isset($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'sellist' && $_POST['options_'.$key] == '0')
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) {
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
if (!empty($this->attributes[$object->table_element]['langfile'][$key])) {
$langs->load($this->attributes[$object->table_element]['langfile'][$key]);
}
$nofillrequired++;
$error_field_required[] = $langs->transnoentitiesnoconv($value);
}

View File

@@ -69,18 +69,17 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
}
print '<input type="hidden" name="search_showbirthday" value="'.((int) $showbirthday).'">';
print '<div class="divsearchfield">';
// Type
$multiselect = 0;
if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
$multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
}
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500');
print '</div>';
if ($canedit) {
print '<div class="divsearchfield">';
// Type
$multiselect = 0;
if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
$multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
}
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500');
print '</div>';
// Assigned to user
print '<div class="divsearchfield">';
print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="fawidth30 inline-block"');

View File

@@ -68,6 +68,17 @@ function getDolGlobalInt($key, $default = 0)
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
}
/**
* Is Dolibarr module enabled
* @param string $module module name to check
* @return int
*/
function isModEnabled($module)
{
global $conf;
return !empty($conf->$module->enabled);
}
/**
* Return a DoliDB instance (database handler).
*

View File

@@ -913,21 +913,24 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($showproject) {
print '<td></td><td></td>';
}
if (count($arrayfields) > 0 && !empty($arrayfields['t.label']['checked'])) {
if (count($arrayfields) > 0 && ! empty($arrayfields['t.label']['checked'])) {
print '<td></td>';
}
if (count($arrayfields) > 0 && !empty($arrayfields['t.dateo']['checked'])) {
if (count($arrayfields) > 0 && ! empty($arrayfields['t.description']['checked'])) {
print '<td></td>';
}
if (count($arrayfields) > 0 && !empty($arrayfields['t.datee']['checked'])) {
if (count($arrayfields) > 0 && ! empty($arrayfields['t.dateo']['checked'])) {
print '<td></td>';
}
if (count($arrayfields) > 0 && !empty($arrayfields['t.planned_workload']['checked'])) {
if (count($arrayfields) > 0 && ! empty($arrayfields['t.datee']['checked'])) {
print '<td></td>';
}
if (count($arrayfields) > 0 && ! empty($arrayfields['t.planned_workload']['checked'])) {
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
print '</td>';
}
if (count($arrayfields) > 0 && !empty($arrayfields['t.duration_effective']['checked'])) {
if (count($arrayfields) > 0 && ! empty($arrayfields['t.duration_effective']['checked'])) {
print '<td class="nowrap liste_total right">';
if ($projectidfortotallink > 0) {
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ? '' : '&withproject=1').'">';
@@ -1021,6 +1024,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td></td>';
}
if (! empty($totalarray['nbfield'])) {
print '<td colspan="'.$totalarray['nbfield'].'" class=""></td>';
}
print '<td class=""></td>';
print '</tr>';
}

View File

@@ -363,7 +363,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
}
if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { // Entry in accountancy journal for each bank account
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy', 10);
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy_journal', 10);
// Multi journal
$sql = "SELECT rowid, code, label, nature";

View File

@@ -1283,7 +1283,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Journals
if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', '');
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy_journal');
// Multi journal
$sql = "SELECT rowid, code, label, nature";

View File

@@ -232,7 +232,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
if ($conf->reception->dir_output."/reception") {
if ($conf->reception->dir_output) {
// If $object is id instead of object
if (!is_object($object)) {
$id = $object;
@@ -246,7 +246,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$object->fetch_thirdparty();
$dir = $conf->reception->dir_output."/reception";
$dir = !empty($conf->reception->multidir_output[$object->entity]) ? $conf->reception->multidir_output[$object->entity] : $conf->reception->dir_output;
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
@@ -419,7 +419,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$linenumber = 0;
foreach ($object->lines as $line) {
$linenumber++;
$tmparray = $this->get_substitutionarray_reception_lines($line, $outputlangs);
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
// Call the ODTSubstitutionLine hook
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);

View File

@@ -753,11 +753,19 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Load translation files required by the page
$langs->loadLangs(array("agenda", "other", "members"));
if (empty($object->actionmsg2)) {
$object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
$member = $this->context['member'];
if (!is_object($member)) { // This should not happen but it happen when deleting a subscription from adherents/subscription/card.php
dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object");
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$member->fetch($object->fk_adherent);
}
$object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
$object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
if (empty($object->actionmsg2)) {
$object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $member->getFullName($langs));
}
$object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $member->getFullName($langs));
$object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
$object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
$object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');