Merge branch 'template1' of https://github.com/Quatadah/dolibarr into template1

This commit is contained in:
Quatadah Nasdami 2022-07-27 00:27:35 +02:00
commit 6dccf3052a
2 changed files with 28 additions and 23 deletions

View File

@ -10358,6 +10358,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
* 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
* 'modal' => true, // true|false to display dialog as a modal (with dark background)
* 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background)
* ],
* ]
* // phpcs:enable
@ -10367,12 +10368,16 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
{
global $hookmanager, $action, $object, $langs;
$class = 'butAction';
if ($actionType == 'danger' || $actionType == 'delete') {
$class = 'butActionDelete';
if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken();
//var_dump($params);
if ($params['isDropdown'])
$class = "dropdown-item";
else {
$class = 'butAction';
if ($actionType == 'danger' || $actionType == 'delete') {
$class = 'butActionDelete';
if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken();
}
}
$attr = array(
'class' => $class,
'href' => empty($url) ? '' : $url,

View File

@ -1316,56 +1316,56 @@ if ($action == 'create' && $user->rights->projet->creer) {
}
}
// Add button to create objects from project
if (!empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) {
print'<div class="dropdown-holder">';
print'<a class="dropdown-toggle butAction">'.$langs->trans("Create").'</a>';
print'<div class="dropdown-content">';
print'<div class="dropdown inline-block">';
print'<a style="margin-right: auto;"class="dropdown-toggle butAction" data-toggle="dropdown">'.$langs->trans("Create").'</a>';
print '<div class="dropdown-menu">';
print '<div class="dropdown-global-search-button-list" >';
if (!empty($conf->propal->enabled) && $user->rights->propal->creer) {
$langs->load("propal");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/comm/propal/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('AddProp') . '</a>';
print dolGetButtonAction('', $langs->trans('AddProp'), 'default', DOL_URL_ROOT.'/comm/propal/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->commande->enabled) && $user->rights->commande->creer) {
$langs->load("orders");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/commande/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('createOrder') . '</a>';
print dolGetButtonAction('', $langs->trans('CreateOrder'), 'default', DOL_URL_ROOT.'/commande/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (isModEnabled('facture') && $user->rights->facture->creer) {
$langs->load("bills");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('createBill') . '</a>';
print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer) {
$langs->load("supplier_proposal");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid. '">' . $langs->trans('AddSupplierProposal') . '</a>';
print dolGetButtonAction('', $langs->trans('AddSupplierProposal'), 'default', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->supplier_order->enabled) && ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)) {
$langs->load("suppliers");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('AddSupplierOrder') . '</a>';
print dolGetButtonAction('', $langs->trans('AddSupplierOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->supplier_invoice->enabled) && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
$langs->load("suppliers");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('AddSupplierInvoice') . '</a>';
print dolGetButtonAction('', $langs->trans('AddSupplierInvoice'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) {
$langs->load("interventions");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->s . '">' . $langs->trans('AddIntervention') . '</a>';
print dolGetButtonAction('', $langs->trans('AddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->contrat->enabled) && $user->rights->contrat->creer) {
$langs->load("contracts");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/contrat/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('AddContract') . '</a>';
print dolGetButtonAction('', $langs->trans('AddContract'), 'default', DOL_URL_ROOT.'/contrat/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) {
$langs->load("trips");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/expensereport/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('AddTrip') . '</a>';
print dolGetButtonAction('', $langs->trans('AddTrip'), 'default', DOL_URL_ROOT.'/expensereport/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
if (!empty($conf->don->enabled) && $user->rights->don->creer) {
$langs->load("donations");
print '<a class="dropdown-item" href="' . DOL_URL_ROOT.'/don/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid . '">' . $langs->trans('AddDonation') . '</a>';
print dolGetButtonAction('', $langs->trans('AddDonation'), 'default', DOL_URL_ROOT.'/don/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
}
print'</div>';
print'</div>';
//print'</div>';
print "</div>";
print "</div>";
print "</div>";
}
// Clone
if ($user->rights->projet->creer) {
if ($userWrite > 0) {