Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-07-08 10:23:47 +02:00
commit 5e54639749
4 changed files with 47 additions and 52 deletions

View File

@ -1121,7 +1121,8 @@ if ($object->id > 0) {
* Latest contracts
*/
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity";
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
$sql .= " c.last_main_doc, c.model_pdf";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql .= " WHERE c.fk_soc = s.rowid ";
$sql .= " AND s.rowid = ".((int) $object->id);
@ -1154,6 +1155,8 @@ if ($object->id > 0) {
$contrat->ref_customer = $objp->refcus;
$contrat->ref_supplier = $objp->refsup;
$contrat->statut = $objp->contract_status;
$contrat->last_main_doc = $objp->last_main_doc;
$contrat->model_pdf = $objp->model_pdf;
$contrat->fetch_lines();
$late = '';
@ -1168,30 +1171,32 @@ if ($object->id > 0) {
print '<tr class="oddeven">';
print '<td class="nowraponall">';
print $contrat->getNomUrl(1, 12);
// Preview
$filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
$file_list = null;
if (!empty($filedir)) {
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
}
if (is_array($file_list)) {
// Defined relative dir to DOL_DATA_ROOT
$relativedir = '';
if ($filedir) {
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
if (!empty($contrat->model_pdf)) {
// Preview
$filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
$file_list = null;
if (!empty($filedir)) {
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
}
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
if (is_array($file_list)) {
// Defined relative dir to DOL_DATA_ROOT
$relativedir = '';
if ($filedir) {
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
}
// Get list of files stored into database for same relative directory
if ($relativedir) {
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
//var_dump($sortfield.' - '.$sortorder);
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
}
}
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
}
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
}
// $filename = dol_sanitizeFileName($objp->ref);
// $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);

View File

@ -669,6 +669,7 @@ if (!$error && $massaction == 'confirm_presend') {
}
}
if (!$error && $massaction == 'cancelorders') {
$db->begin();

View File

@ -806,7 +806,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
if ($action == 'clone') {
$formquestion = array(
'text' => $langs->trans("ConfirmClone"),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int') > 0 ?GETPOST('socid', 'int') : $object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200')),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int') > 0 ?GETPOST('socid', 'int') : $object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200 maxwidth250')),
array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true),
array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true),
array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true),
@ -815,7 +815,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false)
);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ToClone"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 300, 590);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ToClone"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 400, 590);
}

View File

@ -51,19 +51,15 @@ $formcompany = new FormCompany($db);
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'setcodeclient') {
if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON", $value, 'chaine', 0, '', $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
$result = dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON", $value, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
}
}
if ($action == 'setcodecompta') {
if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON", $value, 'chaine', 0, '', $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
$result = dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON", $value, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
}
}
@ -273,10 +269,8 @@ if ($action == 'setprofid') {
$status = GETPOST('status', 'alpha');
$idprof = "SOCIETE_".$value."_UNIQUE";
if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0) {
//header("Location: ".$_SERVER["PHP_SELF"]);
//exit;
} else {
$result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
}
}
@ -286,10 +280,8 @@ if ($action == 'setprofidmandatory') {
$status = GETPOST('status', 'alpha');
$idprof = "SOCIETE_".$value."_MANDATORY";
if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0) {
//header("Location: ".$_SERVER["PHP_SELF"]);
//exit;
} else {
$result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
}
}
@ -299,10 +291,8 @@ if ($action == 'setprofidinvoicemandatory') {
$status = GETPOST('status', 'alpha');
$idprof = "SOCIETE_".$value."_INVOICE_MANDATORY";
if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0) {
//header("Location: ".$_SERVER["PHP_SELF"]);
//exit;
} else {
$result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
}
}
@ -311,10 +301,8 @@ if ($action == 'setprofidinvoicemandatory') {
if ($action == 'sethideinactivethirdparty') {
$status = GETPOST('status', 'alpha');
if (dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX", $status, 'chaine', 0, '', $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
$result = dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX", $status, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
}
}
@ -331,6 +319,7 @@ if ($action == 'setonsearchandlistgooncustomerorsuppliercard') {
}
}
/*
* View
*/
@ -575,7 +564,7 @@ foreach ($dirsociete as $dirroot) {
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print $module->name;
print dol_escape_htmltag($module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
@ -589,7 +578,7 @@ foreach ($dirsociete as $dirroot) {
print "<td class=\"center\">\n";
//if ($conf->global->COMPANY_ADDON_PDF != "$name")
//{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&token='.newToken().'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&token='.newToken().'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
//}
@ -605,7 +594,7 @@ foreach ($dirsociete as $dirroot) {
print "</td>";
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.urlencode($name).'&token='.newToken().'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.urlencode($name).'&token='.newToken().'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
}
@ -626,7 +615,7 @@ foreach ($dirsociete as $dirroot) {
// Preview
print '<td class="center nowrap">';
if ($module->type == 'pdf') {
$linkspec = '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&token='.newToken().'&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
$linkspec = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=specimen&token='.newToken().'&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
$linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic');
}