Merge pull request #15959 from FHenry/dev_fix_contact_bulk

Dev fix contact bulk
This commit is contained in:
Laurent Destailleur 2021-01-12 20:25:26 +01:00 committed by GitHub
commit 3054fb4cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 33 deletions

View File

@ -661,7 +661,7 @@ if (empty($reshook)) {
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>'; $newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); if (!empty($user->rights->accounting->mouvements->export)) $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -266,6 +266,18 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m
$object->datev = $newdatepayment; $object->datev = $newdatepayment;
} }
if (GETPOSTISSET("clone_sens")) {
$object->sens = GETPOST("clone_sens", 'int');
} else {
$object->sens = $object->sens;
}
if (GETPOST("clone_amount", "alpha")) {
$object->amount = price2num(GETPOST("clone_amount", "alpha"));
} else {
$object->amount = price2num($object->amount);
}
if ($object->check()) if ($object->check())
{ {
$id = $object->create($user); $id = $object->create($user);
@ -486,14 +498,19 @@ if ($id)
// Clone confirmation // Clone confirmation
if ($action === 'clone') if ($action === 'clone')
{ {
$set_value_help = $form->textwithpicto('', $langs->trans($langs->trans("AccountingDirectionHelp")));
$sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit"));
$formquestion = array( $formquestion = array(
array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label), array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
); array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1),
$formquestion[] = array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1); array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1),
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1); array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)),
$formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)); array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)),
array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens") . ' ' . $set_value_help, 'values' => $sensarray, 'default' => $object->sens),
);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 300); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
} }
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);

View File

@ -1044,15 +1044,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1) if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1)
{ {
print "\n".'<script type="text/javascript" language="javascript">'."\n"; print "\n".'<script type="text/javascript" language="javascript">'."\n";
print 'jQuery(document).ready(function () {
jQuery("#email").keyup(function() { print '
if ($(this).val()!="") { jQuery(document).ready(function () {
$(".noemail").addClass("fieldrequired"); function init_check_no_email(input) {
} else { if (input.val()!="") {
$(".noemail").removeClass("fieldrequired"); $(".noemail").addClass("fieldrequired");
} } else {
}) $(".noemail").removeClass("fieldrequired");
})'."\n"; }
}
$("#email").keyup(function() {
init_check_no_email($(this));
});
init_check_no_email($("#email"));
})'."\n";
print '</script>'."\n"; print '</script>'."\n";
} }
if (!GETPOSTISSET("no_email") && !empty($object->email)) if (!GETPOSTISSET("no_email") && !empty($object->email))

View File

@ -1257,8 +1257,6 @@ class FormMail extends Form
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm"); $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm");
} elseif ($type_template == 'thirdparty') { } elseif ($type_template == 'thirdparty') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty");
} elseif ($type_template == 'user') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser");
} elseif (!empty($type_template)) { } elseif (!empty($type_template)) {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric"); $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric");
} }

View File

@ -80,12 +80,13 @@ class TraceableDB extends DoliDB
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica * Function to use to build INSERT, UPDATE or WHERE predica
* *
* @param int $param Date TMS to convert * @param int $param Date TMS to convert
* @return string Date in a string YYYYMMDDHHMMSS * @param mixed $gm 'gmt'=Input informations are GMT values, 'tzserver'=Local to server TZ
* @return string Date in a string YYYY-MM-DD HH:MM:SS
*/ */
public function idate($param) public function idate($param, $gm = 'tzserver')
{ {
return $this->db->idate($param); return $this->db->idate($param, $gm);
} }
/** /**

View File

@ -499,8 +499,8 @@ class Expedition extends CommonObject
// create shipment lines // create shipment lines
foreach ($stockLocationQty as $stockLocation => $qty) foreach ($stockLocationQty as $stockLocation => $qty)
{ {
if (($line_id = $this->create_line($stockLocation, $line_ext->origin_line_id, $qty, $line_ext->rang, $array_options)) < 0) $line_id = $this->create_line($stockLocation, $line_ext->origin_line_id, $qty, $line_ext->rang, $array_options);
{ if ($line_id < 0) {
$error++; $error++;
} else { } else {
// create shipment batch lines for stockLocation // create shipment batch lines for stockLocation
@ -629,7 +629,7 @@ class Expedition extends CommonObject
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
if (!empty($this->multicurrency_code)) $this->multicurrency_code = $this->thirdparty->multicurrency_code; if (!empty($this->multicurrency_code)) $this->multicurrency_code = $this->thirdparty->multicurrency_code;
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $this->multicurrency_tx = $this->thirdparty->multicurrency_tx; if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($this->thirdparty->multicurrency_tx)) $this->multicurrency_tx = $this->thirdparty->multicurrency_tx;
} }
/* /*
@ -1081,8 +1081,8 @@ class Expedition extends CommonObject
if (isset($this->size_units)) $this->size_units = trim($this->size_units); if (isset($this->size_units)) $this->size_units = trim($this->size_units);
if (isset($this->weight_units)) $this->weight_units = trim($this->weight_units); if (isset($this->weight_units)) $this->weight_units = trim($this->weight_units);
if (isset($this->trueWeight)) $this->weight = trim($this->trueWeight); if (isset($this->trueWeight)) $this->weight = trim($this->trueWeight);
if (isset($this->note_private)) $this->note = trim($this->note_private); if (isset($this->note_private)) $this->note_private = trim($this->note_private);
if (isset($this->note_public)) $this->note = trim($this->note_public); if (isset($this->note_public)) $this->note_public = trim($this->note_public);
if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf); if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf);
@ -1093,7 +1093,6 @@ class Expedition extends CommonObject
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").","; $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
$sql .= " ref_customer=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : "null").","; $sql .= " ref_customer=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : "null").",";
@ -2751,7 +2750,7 @@ class ExpeditionLigne extends CommonObjectLine
$ranktouse = $this->rang; $ranktouse = $this->rang;
if ($ranktouse == -1) if ($ranktouse == -1)
{ {
$rangmax = $this->line_max($fk_expedition); $rangmax = $this->line_max($this->fk_expedition);
$ranktouse = $rangmax + 1; $ranktouse = $rangmax + 1;
} }

View File

@ -511,7 +511,7 @@ if (!empty($arrayfields['t.label']['checked']))
print '<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'" size="8">'; print '<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'" size="8">';
print '</td>'; print '</td>';
} }
//Task Description // Task Description
if (!empty($arrayfields['t.description']['checked'])) if (!empty($arrayfields['t.description']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -728,7 +728,7 @@ while ($i < min($num, $limit))
// Project ref // Project ref
if (!empty($arrayfields['p.ref']['checked'])) if (!empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowraponall tdoverflowmax150">';
print $projectstatic->getNomUrl(1, 'task'); print $projectstatic->getNomUrl(1, 'task');
if ($projectstatic->hasDelay()) print img_warning("Late"); if ($projectstatic->hasDelay()) print img_warning("Late");
print '</td>'; print '</td>';

View File

@ -402,6 +402,11 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors');
} }
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors');
}
if (!$error) if (!$error)
{ {
if ($action == 'update') if ($action == 'update')
@ -1176,8 +1181,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$("#email").keyup(function() { $("#email").keyup(function() {
init_check_no_email($(this)); init_check_no_email($(this));
}); });
init_check_no_email($("#email")); init_check_no_email($("#email"));';
});';
} }
print '});'; print '});';
print '</script>'."\n"; print '</script>'."\n";
@ -1558,6 +1562,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print "</td></tr>"; print "</td></tr>";
} }
if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION))
{
print '<tr class="individualline"><td class="toptd">'.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1);
print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
// Supplier // Supplier
if (!empty($conf->fournisseur->enabled)) { if (!empty($conf->fournisseur->enabled)) {
print '<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td><td colspan="3">'; print '<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td><td colspan="3">';