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

This commit is contained in:
Laurent Destailleur 2019-07-22 19:06:57 +02:00
commit 47ec88c8b5
3 changed files with 70 additions and 62 deletions

View File

@ -43,7 +43,7 @@ $action=GETPOST('action','alpha');
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search
$resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int"); $resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int");
$pid=GETPOST("search_projectid",'int',3)?GETPOST("search_projectid",'int',3):GETPOST("projectid",'int',3); $pid=GETPOST("search_projectid",'int',3)?GETPOST("search_projectid",'int',3):GETPOST("projectid",'int',3);
$status=GETPOST("search_status",'alpha')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha'); $status=(GETPOST("search_status",'alpha') != '')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha');
$type=GETPOST('search_type','alphanohtml')?GETPOST('search_type','alphanohtml'):GETPOST('type','alphanohtml'); $type=GETPOST('search_type','alphanohtml')?GETPOST('search_type','alphanohtml'):GETPOST('type','alphanohtml');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$year=GETPOST("year",'int'); $year=GETPOST("year",'int');

View File

@ -1189,32 +1189,32 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
} }
$ids1='';$ids2=''; $ids1='';$ids2='';
if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h])); if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h]));
if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h])); if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h]));
if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">'; if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">'; else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
if (count($cases1[$h]) == 1) // only 1 event if (is_array($cases1[$h]) && count($cases1[$h]) == 1) // only 1 event
{ {
$output = array_slice($cases1[$h], 0, 1); $output = array_slice($cases1[$h], 0, 1);
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string']; if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color1 = $output[0]['color']; if ($output[0]['color']) $color1 = $output[0]['color'];
} }
else if (count($cases1[$h]) > 1) else if (is_array($cases1[$h]) && count($cases1[$h]) > 1)
{ {
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
$color1='222222'; $color1='222222';
} }
if (count($cases2[$h]) == 1) // only 1 event if (is_array($cases2[$h]) && count($cases2[$h]) == 1) // only 1 event
{ {
$output = array_slice($cases2[$h], 0, 1); $output = array_slice($cases2[$h], 0, 1);
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string']; if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color2 = $output[0]['color']; if ($output[0]['color']) $color2 = $output[0]['color'];
} }
else if (count($cases2[$h]) > 1) else if (is_array($cases2[$h]) && count($cases2[$h]) > 1)
{ {
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
$color2='222222'; $color2='222222';

View File

@ -63,78 +63,86 @@ $object = new BonPrelevement($db,"");
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
$hookmanager->initHooks(array('directdebitprevcard','globalcard'));
/* /*
* Actions * Actions
*/ */
if ( $action == 'confirm_delete' ) $parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{ {
$res=$object->delete($user); if ( $action == 'confirm_delete' )
if ($res > 0) {
{ $res=$object->delete($user);
header("Location: index.php"); if ($res > 0)
exit; {
} header("Location: index.php");
} exit;
}
}
// Seems to no be used and replaced with $action == 'infocredit // Seems to no be used and replaced with $action == 'infocredit
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes') if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
{ {
$res=$object->set_credite(); $res=$object->set_credite();
if ($res >= 0) if ($res >= 0)
{ {
header("Location: card.php?id=".$id); header("Location: card.php?id=".$id);
exit; exit;
} }
} }
if ($action == 'infotrans' && $user->rights->prelevement->bons->send) if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
/* /*
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref) if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
{ {
$dir = $conf->prelevement->dir_output.'/receipts'; $dir = $conf->prelevement->dir_output.'/receipts';
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0) if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
{ {
$object->set_infotrans($user, $dt, GETPOST('methode','alpha')); $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
} }
header("Location: card.php?id=".$id); header("Location: card.php?id=".$id);
exit; exit;
} }
else else
{ {
dol_syslog("Fichier invalide",LOG_WARNING); dol_syslog("Fichier invalide",LOG_WARNING);
$mesg='BadFile'; $mesg='BadFile';
}*/ }*/
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha')); $error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
if ($error) if ($error)
{ {
header("Location: card.php?id=".$id."&error=$error"); header("Location: card.php?id=".$id."&error=$error");
exit; exit;
} }
} }
// Set direct debit order to credited, create payment and close invoices // Set direct debit order to credited, create payment and close invoices
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
{ {
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
$error = $object->set_infocredit($user, $dt); $error = $object->set_infocredit($user, $dt);
if ($error) if ($error)
{ {
header("Location: card.php?id=".$id."&error=$error"); header("Location: card.php?id=".$id."&error=$error");
exit; exit;
} }
}
} }