Merge pull request #21931 from grandoc/new_branch_27_08_2022
FIX php8 compatibility
This commit is contained in:
commit
d0e08818e1
@ -223,13 +223,13 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
$listofval = array();
|
||||
$listofval['-1'] = $langs->trans('No');
|
||||
$listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
|
||||
if (!empty($conf->paybox->enabled)) {
|
||||
if (isModEnabled('paybox')) {
|
||||
$listofval['paybox'] = 'Paybox';
|
||||
}
|
||||
if (!empty($conf->paypal->enabled)) {
|
||||
if (isModEnabled('paypal')) {
|
||||
$listofval['paypal'] = 'PayPal';
|
||||
}
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
if (isModEnabled('stripe')) {
|
||||
$listofval['stripe'] = 'Stripe';
|
||||
}
|
||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0);
|
||||
@ -253,7 +253,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
|
||||
@ -404,7 +404,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" value="'.$mainserver.'" autocomplete="off">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="'.$mainserver.'">';
|
||||
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
@ -435,7 +435,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="'.$mainport.'">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="'.$mainport.'">';
|
||||
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
@ -453,7 +453,7 @@ if ($action == 'edit') {
|
||||
$mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID) ? $conf->global->MAIN_MAIL_SMTPS_ID : '');
|
||||
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="'.$mainstmpid.'">';
|
||||
} else {
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
@ -467,7 +467,7 @@ if ($action == 'edit') {
|
||||
// OAUTH
|
||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) {
|
||||
print '<tr class="oddeven smtp_auth_method"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'LOGIN' ? ' checked' : '').'> ';
|
||||
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
|
||||
print ' ';
|
||||
@ -489,7 +489,7 @@ if ($action == 'edit') {
|
||||
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="'.$mainsmtppw.'" autocomplete="off">';
|
||||
} else {
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
@ -911,7 +911,7 @@ if ($action == 'edit') {
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
if (!empty($conf->fckeditor->enabled)) {
|
||||
if (isModEnabled('fckeditor')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" size="18" value="'.$mainserver.'">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET_sav" name="MAIN_MAIL_SMTP_SERVER_TICKET_sav" value="'.$mainserver.'">';
|
||||
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
@ -360,7 +360,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" size="3" value="'.$mainport.'">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET_sav" name="MAIN_MAIL_SMTP_PORT_TICKET_sav" value="'.$mainport.'">';
|
||||
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
@ -378,7 +378,7 @@ if ($action == 'edit') {
|
||||
$mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID_TICKET) ? $conf->global->MAIN_MAIL_SMTPS_ID_TICKET : '');
|
||||
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_TICKET" size="32" value="'.$mainstmpid.'">';
|
||||
} else {
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
@ -412,7 +412,7 @@ if ($action == 'edit') {
|
||||
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_TICKET) ? $conf->global->MAIN_MAIL_SMTPS_PW_TICKET : '');
|
||||
print '<tr class="drag drop oddeven smtp_pw hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
|
||||
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_TICKET" size="32" value="'.$mainsmtppw.'">';
|
||||
} else {
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
@ -604,7 +604,7 @@ if ($action == 'edit') {
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
if (!empty($conf->fckeditor->enabled)) {
|
||||
if (isModEnabled('fckeditor')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -786,14 +786,14 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
|
||||
if (!empty($objMod->disabled)) {
|
||||
$codeenabledisable .= $langs->trans("Disabled");
|
||||
} elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
|
||||
} elseif (!empty($objMod->always_enabled) || ((isModEnabled('multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
|
||||
if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
|
||||
$codeenabledisable .= $langs->trans("Used");
|
||||
} else {
|
||||
$codeenabledisable .= img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium valignmiddle');
|
||||
//print $langs->trans("Required");
|
||||
}
|
||||
if (!empty($conf->multicompany->enabled) && $user->entity) {
|
||||
if (isModEnabled('multicompany') && $user->entity) {
|
||||
$disableSetup++;
|
||||
}
|
||||
} else {
|
||||
@ -1279,7 +1279,7 @@ if ($mode == 'develop') {
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).'</td>';
|
||||
print '<td class="maxwidth300">';
|
||||
if (!empty($conf->modulebuilder->enabled)) {
|
||||
if (isModEnabled('modulebuilder')) {
|
||||
print $langs->trans("SeeTopRightMenu");
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("ModuleBuilder")).'</span>';
|
||||
|
||||
@ -108,7 +108,7 @@ if ($action == 'update') {
|
||||
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (!empty($conf->project->enabled)) {
|
||||
if (isModEnabled('project')) {
|
||||
if (GETPOST('PDF_SHOW_PROJECT_REF_OR_LABEL') == 'no') {
|
||||
dolibarr_del_const($db, "PDF_SHOW_PROJECT", $conf->entity);
|
||||
dolibarr_del_const($db, "PDF_SHOW_PROJECT_TITLE", $conf->entity);
|
||||
@ -486,7 +486,7 @@ print '<input type="text" class="maxwidth50" name="MAIN_DOCUMENTS_LOGO_HEIGHT" v
|
||||
print '</td></tr>';
|
||||
|
||||
// Show project
|
||||
if (!empty($conf->project->enabled)) {
|
||||
if (isModEnabled('project')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_PROJECT").'</td><td>';
|
||||
$tmparray = array('no' => 'No', 'showprojectref' => 'RefProject', 'showprojectlabel' => 'ShowProjectLabel');
|
||||
$showprojectref = empty($conf->global->PDF_SHOW_PROJECT) ? (empty($conf->global->PDF_SHOW_PROJECT_TITLE) ? 'no' : 'showprojectlabel') : 'showprojectref';
|
||||
|
||||
@ -515,7 +515,7 @@ print '<td>';
|
||||
print '<input type="hidden" name="action" value="setribchq">';
|
||||
print $langs->trans("PaymentMode").'</td>';
|
||||
print '<td align="right">';
|
||||
if (empty($conf->facture->enabled)) {
|
||||
if (!isModEnabled('facture')) {
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
}
|
||||
print '</td>';
|
||||
@ -524,7 +524,7 @@ print "</tr>\n";
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
|
||||
print "<td>";
|
||||
if (empty($conf->facture->enabled)) {
|
||||
if (!isModEnabled('facture')) {
|
||||
if (isModEnabled("banque")) {
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
@ -563,7 +563,7 @@ print "</td></tr>";
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
|
||||
print "<td>";
|
||||
if (empty($conf->facture->enabled)) {
|
||||
if (!isModEnabled('facture')) {
|
||||
print '<select class="flat" name="chq" id="chq">';
|
||||
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
|
||||
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
|
||||
@ -700,7 +700,7 @@ print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
/* Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
|
||||
if ($conf->banque->enabled)
|
||||
if (isModEnabled('facture'))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
@ -205,7 +205,7 @@ print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
if (empty($conf->multicompany->enabled) || !$user->entity) {
|
||||
if (!isModEnabled('multicompany') || !$user->entity) {
|
||||
print '<td>'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
|
||||
}
|
||||
print "</tr>\n";
|
||||
@ -218,7 +218,7 @@ $sql .= ", type";
|
||||
$sql .= ", note";
|
||||
$sql .= ", entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."const";
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
// If no multicompany mode, admins can see global and their constantes
|
||||
$sql .= " WHERE entity IN (0,".$conf->entity.")";
|
||||
} else {
|
||||
@ -239,7 +239,7 @@ if ($resql) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$obj->name.'</td>'."\n";
|
||||
print '<td>'.$obj->value.'</td>'."\n";
|
||||
if (empty($conf->multicompany->enabled) || !$user->entity) {
|
||||
if (!isModEnabled('multicompany') || !$user->entity) {
|
||||
print '<td>'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -382,7 +382,7 @@ foreach ($configfileparameters as $key => $value) {
|
||||
$newkey = preg_replace('/^\?/', '', $key);
|
||||
|
||||
if (preg_match('/^\?/', $key) && empty(${$newkey})) {
|
||||
if ($newkey != 'multicompany_transverse_mode' || empty($conf->multicompany->enabled)) {
|
||||
if ($newkey != 'multicompany_transverse_mode' || !isModEnabled('multicompany')) {
|
||||
continue; // We discard parameters starting with ?
|
||||
}
|
||||
}
|
||||
@ -483,7 +483,7 @@ print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefield">'.$langs->trans("Parameters").' '.$langs->trans("Database").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
if (empty($conf->multicompany->enabled) || !$user->entity) {
|
||||
if (!isModEnabled('multicompany') || !$user->entity) {
|
||||
print '<td class="center width="80px"">'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
|
||||
}
|
||||
print "</tr>\n";
|
||||
@ -496,7 +496,7 @@ $sql .= ", type";
|
||||
$sql .= ", note";
|
||||
$sql .= ", entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."const";
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
// If no multicompany mode, admins can see global and their constantes
|
||||
$sql .= " WHERE entity IN (0,".$conf->entity.")";
|
||||
} else {
|
||||
@ -526,7 +526,7 @@ if ($resql) {
|
||||
print dol_escape_htmltag($obj->value);
|
||||
}
|
||||
print '</td>'."\n";
|
||||
if (empty($conf->multicompany->enabled) || !$user->entity) {
|
||||
if (!isModEnabled('multicompany') || !$user->entity) {
|
||||
print '<td class="center" width="80px">'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if (isModEnabled('accounting')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ if ($action == 'update') {
|
||||
llxHeader('', $langs->trans("TaxSetup"));
|
||||
|
||||
$form = new Form($db);
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$formaccounting = new FormAccounting($db);
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ echo '</table>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$langs->load("accountancy");
|
||||
print '<br><br><span class="opacitymedium">'.$langs->trans("AccountingAccountForSalesTaxAreDefinedInto", $langs->transnoentitiesnoconv("MenuAccountancy"), $langs->transnoentitiesnoconv("Setup")).'</span>';
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ if ($result) {
|
||||
$userstatic->status = $obj->status;
|
||||
|
||||
print $userstatic->getLoginUrl(1);
|
||||
if (!empty($conf->multicompany->enabled) && $userstatic->admin && !$userstatic->entity) {
|
||||
if (isModEnabled('multicompany') && $userstatic->admin && !$userstatic->entity) {
|
||||
print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
|
||||
} elseif ($userstatic->admin) {
|
||||
print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"');
|
||||
|
||||
@ -346,7 +346,7 @@ if ($mode == 'overwrite') {
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("NewTranslationStringToShow", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
//if (isModEnabled('multicompany') && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -504,7 +504,7 @@ if ($mode == 'searchkey') {
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($transvalue).'">';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
/*if (isModEnabled('multicompany') && !$user->entity)
|
||||
{
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="1" name="entitysearch" value="'.$conf->entity.'">';
|
||||
@ -525,7 +525,7 @@ if ($mode == 'searchkey') {
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
//if (isModEnabled('multicompany') && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -609,7 +609,7 @@ if ($mode == 'searchkey') {
|
||||
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
}
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
/*if (isModEnabled('multicompany') && !$user->entity)
|
||||
{
|
||||
print '<td>'.$val.'</td>';
|
||||
}*/
|
||||
|
||||
@ -195,7 +195,7 @@ class Asset extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ class AssetModel extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ class BOM extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
@ -1525,7 +1525,7 @@ class BOMLine extends CommonObjectLine
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ class ActionCommReminder extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -901,7 +901,7 @@ while ($currentdaytoshow < $lastdaytoshow) {
|
||||
/* Use this list to have for all users */
|
||||
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " WHERE ug.entity IN (".getEntity('usergroup').")";
|
||||
$sql .= " AND ug.fk_user = u.rowid ";
|
||||
|
||||
@ -258,7 +258,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
$substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = '<a target="_blank" rel="noopener noreferrer" href="'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.((!empty($conf->multicompany->enabled)) ? '?entity='.$conf->entity : '').'">'.$langs->trans('BlankSubscriptionForm'). '</a>';
|
||||
$substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = '<a target="_blank" rel="noopener noreferrer" href="'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '').'">'.$langs->trans('BlankSubscriptionForm'). '</a>';
|
||||
}
|
||||
/* For backward compatibility, deprecated */
|
||||
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) {
|
||||
|
||||
@ -424,12 +424,12 @@ if ($socid > 0) {
|
||||
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
@ -474,12 +474,12 @@ if ($socid > 0) {
|
||||
}
|
||||
print '<td class="nowrap"><span class="opacitymedium">'.$langs->trans("NotConsumed").'</span></td>';
|
||||
print '<td class="right amount">'.price($obj->amount_ht).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right amount">'.price($obj->multicurrency_amount_ht).'</td>';
|
||||
}
|
||||
print '<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).'</td>';
|
||||
print '<td class="right amount">'.price($obj->amount_ttc).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right amount">'.price($obj->multicurrency_amount_ttc).'</td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
@ -503,7 +503,7 @@ if ($socid > 0) {
|
||||
}
|
||||
} else {
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$colspan += 2;
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
@ -562,12 +562,12 @@ if ($socid > 0) {
|
||||
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
@ -612,12 +612,12 @@ if ($socid > 0) {
|
||||
}
|
||||
print '<td class="nowrap"><span class="opacitymedium">'.$langs->trans("NotConsumed").'</span></td>';
|
||||
print '<td class="right amount">'.price($obj->amount_ht).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right amount">'.price($obj->multicurrency_amount_ht).'</td>';
|
||||
}
|
||||
print '<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).'</td>';
|
||||
print '<td class="right amount">'.price($obj->amount_ttc).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right amount">'.price($obj->multicurrency_amount_ttc).'</td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
@ -641,7 +641,7 @@ if ($socid > 0) {
|
||||
}
|
||||
} else {
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$colspan += 2;
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
@ -735,12 +735,12 @@ if ($socid > 0) {
|
||||
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
|
||||
@ -808,12 +808,12 @@ if ($socid > 0) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($obj->amount_ht).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right">'.price($obj->multicurrency_amount_ht).'</td>';
|
||||
}
|
||||
print '<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).'</td>';
|
||||
print '<td class="right">'.price($obj->amount_ttc).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
@ -825,7 +825,7 @@ if ($socid > 0) {
|
||||
}
|
||||
} else {
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$colspan += 2;
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
@ -896,12 +896,12 @@ if ($socid > 0) {
|
||||
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right toverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
|
||||
@ -969,12 +969,12 @@ if ($socid > 0) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($obj->amount_ht).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right">'.price($obj->multicurrency_amount_ht).'</td>';
|
||||
}
|
||||
print '<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).'</td>';
|
||||
print '<td class="right">'.price($obj->amount_ttc).'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
@ -986,7 +986,7 @@ if ($socid > 0) {
|
||||
}
|
||||
} else {
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$colspan += 2;
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
|
||||
@ -117,12 +117,12 @@ if ($user->socid > 0) {
|
||||
|
||||
// Define $arrayofentities if multientity is set.
|
||||
$arrayofentities = array();
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
$arrayofentities = $mc->getEntitiesList();
|
||||
}
|
||||
|
||||
$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity));
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
if (empty($entity) && !empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
||||
$entity = '0,'.join(',', array_keys($arrayofentities));
|
||||
}
|
||||
@ -456,7 +456,7 @@ if ($result && $action == "dl" && !$error) {
|
||||
dol_mkdir($dirfortmpfile);
|
||||
|
||||
$log = $langs->transnoentitiesnoconv("Type");
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Entity");
|
||||
}
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Date");
|
||||
@ -498,7 +498,7 @@ if ($result && $action == "dl" && !$error) {
|
||||
}
|
||||
|
||||
$log .= '"'.$langs->trans($file['item']).'"';
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
$log .= ',"'.(empty($arrayofentities[$file['entity']]) ? $file['entity'] : $arrayofentities[$file['entity']]).'"';
|
||||
}
|
||||
$log .= ','.dol_print_date($file['date'], 'dayrfc');
|
||||
@ -583,7 +583,7 @@ print "\n";
|
||||
|
||||
// Export is for current company only
|
||||
$socid = 0;
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
$mc->getInfo($conf->entity);
|
||||
print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES) ? ' opacitymedium' : '').'">('.$langs->trans("Entity").' : ';
|
||||
print "<td>";
|
||||
@ -696,14 +696,14 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<td class="center">'.$langs->trans("Code").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Country").'</td>';
|
||||
print '<td class="center">'.$langs->trans("VATIntra").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="center">'.$langs->trans("Currency").'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (empty($TData)) {
|
||||
print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
@ -833,7 +833,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
$totalVAT_debit -= $data['amount_vat'];
|
||||
}
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="center">'.$data['currency']."</td>\n";
|
||||
}
|
||||
|
||||
@ -847,7 +847,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
@ -858,7 +858,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
@ -869,7 +869,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -425,7 +425,7 @@ if ($resql) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Bill').'</td>';
|
||||
print '<td>'.$langs->trans('Company').'</td>';
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
|
||||
print '<td>'.$langs->trans('Entity').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';
|
||||
@ -462,7 +462,7 @@ if ($resql) {
|
||||
print '</td>';
|
||||
|
||||
// Expected to pay
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
|
||||
print '<td>';
|
||||
$mc->getInfo($objp->entity);
|
||||
print $mc->label;
|
||||
|
||||
@ -73,7 +73,7 @@ if ($type == 'proposal') {
|
||||
$securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN');
|
||||
}
|
||||
|
||||
if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(empty($conf->multicompany->enabled) ? '' : $entity), $SECUREKEY, '0')) {
|
||||
if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) {
|
||||
http_response_code(403);
|
||||
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
|
||||
exit(-1);
|
||||
|
||||
@ -371,7 +371,7 @@ class Conf
|
||||
}
|
||||
|
||||
// Object $mc
|
||||
if (!defined('NOREQUIREMC') && !empty($this->multicompany->enabled)) {
|
||||
if (!defined('NOREQUIREMC') && isModEnabled('multicompany')) {
|
||||
global $mc;
|
||||
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||
if ($ret) {
|
||||
@ -425,7 +425,7 @@ class Conf
|
||||
$rootfordata = DOL_DATA_ROOT;
|
||||
$rootforuser = DOL_DATA_ROOT;
|
||||
// If multicompany module is enabled, we redefine the root of data
|
||||
if (!empty($this->multicompany->enabled) && !empty($this->entity) && $this->entity > 1) {
|
||||
if (isModEnabled('multicompany') && !empty($this->entity) && $this->entity > 1) {
|
||||
$rootfordata .= '/'.$this->entity;
|
||||
}
|
||||
// Set standard temporary folder name or global override
|
||||
@ -987,7 +987,7 @@ class Conf
|
||||
}
|
||||
|
||||
// Object $mc
|
||||
if (!defined('NOREQUIREMC') && !empty($this->multicompany->enabled)) {
|
||||
if (!defined('NOREQUIREMC') && isModEnabled('multicompany')) {
|
||||
if (is_object($mc)) {
|
||||
$mc->setValues($this);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ class DefaultValues extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ class EmailSenderProfile extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1961,11 +1961,11 @@ class Form
|
||||
|
||||
// Forge request to select users
|
||||
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut as status, u.login, u.admin, u.entity, u.photo";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= ", e.label";
|
||||
}
|
||||
$sql .= " FROM ".$this->db->prefix()."user as u";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
|
||||
if ($force_entity) {
|
||||
$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
|
||||
@ -1973,7 +1973,7 @@ class Form
|
||||
$sql .= " WHERE u.entity IS NOT NULL";
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."usergroup_user as ug";
|
||||
$sql .= " ON ug.fk_user = u.rowid";
|
||||
$sql .= " WHERE ug.entity = ".$conf->entity;
|
||||
@ -2075,7 +2075,7 @@ class Form
|
||||
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
|
||||
}
|
||||
}
|
||||
if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (!$obj->entity) {
|
||||
$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
|
||||
} else {
|
||||
@ -9030,7 +9030,7 @@ class Form
|
||||
/*
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
@ -9477,11 +9477,11 @@ class Form
|
||||
|
||||
// On recherche les groupes
|
||||
$sql = "SELECT ug.rowid, ug.nom as name";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= ", e.label";
|
||||
}
|
||||
$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
|
||||
if ($force_entity) {
|
||||
$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
|
||||
@ -9531,7 +9531,7 @@ class Form
|
||||
$out .= '>';
|
||||
|
||||
$out .= $obj->name;
|
||||
if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||
if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||
$out .= " (".$obj->label.")";
|
||||
}
|
||||
|
||||
|
||||
@ -992,7 +992,7 @@ class FormFile
|
||||
$entity = 1; // Without multicompany
|
||||
|
||||
// Get object entity
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$regs = array();
|
||||
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir, '/').'$/', $filedir, $regs);
|
||||
$entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default
|
||||
|
||||
@ -2421,7 +2421,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
return 'ErrorBadParameter';
|
||||
}
|
||||
if (empty($entity)) {
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
$entity = 1;
|
||||
} else {
|
||||
$entity = 0;
|
||||
|
||||
@ -7812,7 +7812,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
));
|
||||
}
|
||||
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$substitutionarray = array_merge($substitutionarray, array('__ENTITY_ID__' => $conf->entity));
|
||||
}
|
||||
if (empty($exclude) || !in_array('system', $exclude)) {
|
||||
|
||||
@ -393,7 +393,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
}
|
||||
|
||||
// For multicompany
|
||||
if (!empty($out) && !empty($conf->multicompany->enabled)) {
|
||||
if (!empty($out) && isModEnabled('multicompany')) {
|
||||
$out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
|
||||
}
|
||||
|
||||
|
||||
@ -796,7 +796,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
if (in_array($feature, $check) && $objectid > 0) { // For $objectid = 0, no check
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled)) { // Special for multicompany
|
||||
if (($feature == 'user' || $feature == 'usergroup') && isModEnabled('multicompany')) { // Special for multicompany
|
||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if ($conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
||||
@ -840,7 +840,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
$sql .= " AND sc.fk_user = ".((int) $user->id);
|
||||
$sql .= " AND sc.fk_soc = s.rowid";
|
||||
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
|
||||
} elseif (!empty($conf->multicompany->enabled)) {
|
||||
} elseif (isModEnabled('multicompany')) {
|
||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||
$sql = "SELECT COUNT(s.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -865,7 +865,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
||||
$sql .= " AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)"; // Contact not linked to a company or to a company of user
|
||||
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||
} elseif (!empty($conf->multicompany->enabled)) {
|
||||
} elseif (isModEnabled('multicompany')) {
|
||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
@ -951,7 +951,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR sc.fk_user IS NULL)";
|
||||
}
|
||||
} elseif (!empty($conf->multicompany->enabled)) {
|
||||
} elseif (isModEnabled('multicompany')) {
|
||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
|
||||
@ -90,7 +90,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
|
||||
if ($mode == 1) {
|
||||
$out .= "hash('".$securekeyseed."' + '".$type."' + proposal_ref)";
|
||||
} else {
|
||||
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(empty($conf->multicompany->enabled) ? '' : $object->entity), '0');
|
||||
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
|
||||
}
|
||||
/*
|
||||
if ($mode == 1) {
|
||||
@ -119,7 +119,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
|
||||
}
|
||||
|
||||
// For multicompany
|
||||
if (!empty($out) && !empty($conf->multicompany->enabled)) {
|
||||
if (!empty($out) && isModEnabled('multicompany')) {
|
||||
$out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
|
||||
|
||||
// Force master entity in transversal mode
|
||||
$entity = $entitytotest;
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$entity = 1;
|
||||
}
|
||||
|
||||
@ -134,11 +134,11 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
|
||||
}
|
||||
|
||||
// We must check entity
|
||||
if ($passok && !empty($conf->multicompany->enabled)) { // We must check entity
|
||||
if ($passok && isModEnabled('multicompany')) { // We must check entity
|
||||
global $mc;
|
||||
|
||||
if (!isset($mc)) {
|
||||
$conf->multicompany->enabled = false; // Global not available, disable $conf->multicompany->enabled for safety
|
||||
!isModEnabled('multicompany'); // Global not available, disable $conf->multicompany->enabled for safety
|
||||
} else {
|
||||
$ret = $mc->checkRight($obj->rowid, $entitytotest);
|
||||
if ($ret < 0) {
|
||||
|
||||
@ -46,7 +46,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
||||
|
||||
// Force master entity in transversal mode
|
||||
$entity = $entitytotest;
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$entity = 1;
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
||||
unset($usertmp);
|
||||
}
|
||||
|
||||
if (!empty($conf->multicompany->enabled)) { // We must check entity (even if sync is not active)
|
||||
if (isModEnabled('multicompany')) { // We must check entity (even if sync is not active)
|
||||
global $mc;
|
||||
|
||||
$usertmp = new User($db);
|
||||
|
||||
@ -221,7 +221,7 @@ class modCommande extends DolibarrModules
|
||||
// Add multicompany field
|
||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
$nbofallowedentities = count(explode(',', getEntity('commande')));
|
||||
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) {
|
||||
if (isModEnabled('multicompany') && $nbofallowedentities > 1) {
|
||||
$this->export_fields_array[$r]['c.entity'] = 'Entity';
|
||||
}
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ class modFacture extends DolibarrModules
|
||||
// Add multicompany field
|
||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
$nbofallowedentities = count(explode(',', getEntity('invoice')));
|
||||
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) {
|
||||
if (isModEnabled('multicompany') && $nbofallowedentities > 1) {
|
||||
$this->export_fields_array[$r]['f.entity'] = 'Entity';
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ class modProjet extends DolibarrModules
|
||||
// Add multicompany field
|
||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
$nbofallowedentities = count(explode(',', getEntity('project'))); // If project are shared, nb will be > 1
|
||||
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) {
|
||||
if (isModEnabled('multicompany') && $nbofallowedentities > 1) {
|
||||
$this->export_fields_array[$r] += array('p.entity'=>'Entity');
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ class modPropale extends DolibarrModules
|
||||
// Add multicompany field
|
||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
$nbofallowedentities = count(explode(',', getEntity('propal')));
|
||||
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) {
|
||||
if (isModEnabled('multicompany') && $nbofallowedentities > 1) {
|
||||
$this->export_fields_array[$r]['c.entity'] = 'Entity';
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ class modSociete extends DolibarrModules
|
||||
// Add multicompany field
|
||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
$nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1
|
||||
if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) {
|
||||
if (isModEnabled('multicompany') && $nbofallowedentities > 1) {
|
||||
$this->export_fields_array[$r] += array('s.entity'=>'Entity');
|
||||
}
|
||||
}
|
||||
@ -379,7 +379,7 @@ class modSociete extends DolibarrModules
|
||||
);
|
||||
// Add multicompany field
|
||||
if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$nbofallowedentities = count(explode(',', getEntity('contact')));
|
||||
if ($nbofallowedentities > 1) {
|
||||
$this->export_fields_array[$r]['c.entity'] = 'Entity';
|
||||
|
||||
@ -92,7 +92,7 @@ print '<div>';
|
||||
//print '<br>';
|
||||
|
||||
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
$langs->load("admin");
|
||||
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).'</span>';
|
||||
$bookmarkList .= '<br><br>';
|
||||
|
||||
@ -205,7 +205,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php<br>Contact:con
|
||||
<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable', 'alpha') || GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag((empty($help) ? '' : $help)); ?>"></td></tr>
|
||||
<?php if (!empty($conf->multicompany->enabled)) { ?>
|
||||
<?php if (isModEnabled('multicompany')) { ?>
|
||||
<!-- Multicompany entity -->
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall', 'alpha') ? '' : ' checked'); ?>></td></tr>
|
||||
<?php } ?>
|
||||
|
||||
@ -296,7 +296,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
|
||||
<!-- Help tooltip -->
|
||||
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
|
||||
|
||||
<?php if (!empty($conf->multicompany->enabled)) { ?>
|
||||
<?php if (isModEnabled('multicompany')) { ?>
|
||||
<!-- Multicompany entity -->
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr>
|
||||
<?php } ?>
|
||||
|
||||
@ -65,7 +65,7 @@ print '<td class="center">'.$langs->trans("AlwaysEditable").'</td>';
|
||||
print '<td class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</td>';
|
||||
print '<td class="center">'.$form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")).'</td>';
|
||||
print '<td class="center">'.$form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")).'</td>';
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="center">'.$langs->trans("Entity").'</td>';
|
||||
}
|
||||
print '<td width="80"> </td>';
|
||||
@ -113,7 +113,7 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel
|
||||
print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($extrafields->attributes[$elementtype]['printable'][$key]).'">'.dol_escape_htmltag($extrafields->attributes[$elementtype]['printable'][$key])."</td>\n";
|
||||
// Summable
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n";
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<td class="center">';
|
||||
if (empty($extrafields->attributes[$elementtype]['entityid'][$key])) {
|
||||
print $langs->trans("All");
|
||||
@ -139,7 +139,7 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel
|
||||
}
|
||||
} else {
|
||||
$colspan = 14;
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
|
||||
@ -612,7 +612,7 @@ if (($action == "create") || ($action == "edit")) {
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<tr><td>';
|
||||
print $langs->trans('Entity')."</td><td>";
|
||||
if (empty($object->entity)) {
|
||||
|
||||
@ -407,7 +407,7 @@ class EcmFiles extends CommonObject
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
/* Fetching this table depends on filepath+filename, it must not depends on entity because filesystem on disk does not know what is Dolibarr entities
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";
|
||||
}*/
|
||||
if ($relativepath) {
|
||||
@ -546,7 +546,7 @@ class EcmFiles extends CommonObject
|
||||
}
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
/* Fetching this table depends on filepath+filename, it must not depends on entity
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";
|
||||
}*/
|
||||
if (count($sqlwhere) > 0) {
|
||||
|
||||
@ -251,7 +251,7 @@ class EmailCollector extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ class EmailCollectorAction extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ class EmailCollectorFilter extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ class ConferenceOrBooth extends ActionComm
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['id']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -196,7 +196,7 @@ class ConferenceOrBoothAttendee extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ if (! empty($conf->global->EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH)) {
|
||||
$rootfordata = DOL_DATA_ROOT;
|
||||
$rootforuser = DOL_DATA_ROOT;
|
||||
// If multicompany module is enabled, we redefine the root of data
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->entity) && $conf->entity > 1) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->entity) && $conf->entity > 1) {
|
||||
$rootfordata .= '/'.$conf->entity;
|
||||
}
|
||||
$conf->expensereport->dir_output = $rootfordata.'/expensereport';
|
||||
|
||||
@ -219,12 +219,12 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
|
||||
*/
|
||||
|
||||
$sql = "SELECT";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " DISTINCT";
|
||||
}
|
||||
$sql .= " u.rowid, u.lastname, u.firstname, u.email, u.statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " WHERE ((ug.fk_user = u.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
|
||||
@ -1765,13 +1765,13 @@ class Holiday extends CommonObject
|
||||
if ($type) {
|
||||
// If user of Dolibarr
|
||||
$sql = "SELECT";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " DISTINCT";
|
||||
}
|
||||
$sql .= " u.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " WHERE ((ug.fk_user = u.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
@ -1855,13 +1855,13 @@ class Holiday extends CommonObject
|
||||
if ($type) {
|
||||
// If we need users of Dolibarr
|
||||
$sql = "SELECT";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " DISTINCT";
|
||||
}
|
||||
$sql .= " u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut, u.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " WHERE ((ug.fk_user = u.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
|
||||
@ -189,7 +189,7 @@ class Evaluation extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ class Evaluationline extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ class Job extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ class Position extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
//$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -189,7 +189,7 @@ class Skill extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ class Skilldet extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ class SkillRank extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ if ($action == 'create') {
|
||||
|
||||
// Entity
|
||||
/*
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
@ -282,7 +282,7 @@ if (($id || $ref) && $action == 'edit') {
|
||||
|
||||
// Entity
|
||||
/*
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<tr><td>'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print $object->entity > 0 ? $object->entity : $conf->entity;
|
||||
@ -371,7 +371,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Entity
|
||||
/*
|
||||
if ($conf->multicompany->enabled) {
|
||||
if (!isModEnabled('multicompany') {
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Entity").'</td>';
|
||||
print '<td>'.$object->entity.'</td>';
|
||||
|
||||
@ -259,7 +259,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
|
||||
@ -420,7 +420,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$afterversionarray = explode('.', '5.0.9');
|
||||
$beforeversionarray = explode('.', '6.0.9');
|
||||
if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) {
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
global $multicompany_transverse_mode;
|
||||
|
||||
// Only if the transverse mode is not used
|
||||
|
||||
@ -187,7 +187,7 @@ class KnowledgeRecord extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -253,7 +253,7 @@ class MyObject extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ class Mo extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
@ -1637,7 +1637,7 @@ class MoLine extends CommonObjectLine
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
|
||||
@ -204,7 +204,7 @@ class Partnership extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
// if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
// if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
// $this->fields['entity']['enabled'] = 0;
|
||||
// }
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ class PartnershipType extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -338,7 +338,7 @@ foreach ($dirproduct as $dirroot) {
|
||||
print "</td>\n";
|
||||
} else {
|
||||
$disabled = false;
|
||||
if (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true) {
|
||||
if (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true) {
|
||||
}
|
||||
print '<td class="center">';
|
||||
if (!$disabled) {
|
||||
@ -556,7 +556,7 @@ print '</tr>';
|
||||
// Rule for price
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
print '<td>'.$langs->trans("PricingRule").'</td>';
|
||||
} else {
|
||||
print '<td>'.$form->textwithpicto($langs->trans("PricingRule"), $langs->trans("SamePriceAlsoForSharedCompanies"), 1).'</td>';
|
||||
|
||||
@ -178,7 +178,7 @@ class ProductFournisseurPrice extends CommonObject
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
|
||||
// Unset fields that are disabled
|
||||
foreach ($this->fields as $key => $val) {
|
||||
|
||||
@ -233,7 +233,7 @@ class Inventory extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class StockTransfer extends CommonObject
|
||||
$this->origin_type = 'StockTransfer@product/stock/stocktransfer';
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
|
||||
// Example to show how to set values of fields definition dynamically
|
||||
/*if ($user->rights->stocktransfer->stocktransfer->read) {
|
||||
|
||||
@ -165,7 +165,7 @@ class StockTransferLine extends CommonObjectLine
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
|
||||
// Example to show how to set values of fields definition dynamically
|
||||
/*if ($user->rights->stocktransfer->stocktransferline->read) {
|
||||
|
||||
@ -158,7 +158,7 @@ if (!empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
|
||||
@ -139,7 +139,7 @@ if ($source == 'proposal') {
|
||||
$securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN');
|
||||
}
|
||||
|
||||
if (!dol_verifyHash($securekeyseed.$type.$ref.(empty($conf->multicompany->enabled) ? '' : $entity), $SECUREKEY, '0')) {
|
||||
if (!dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) {
|
||||
http_response_code(403);
|
||||
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
|
||||
exit(-1);
|
||||
@ -193,7 +193,7 @@ $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
|
||||
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1);
|
||||
|
||||
if ($action == 'refusepropal') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).($conf->multicompany->enabled?'&entity='.$entity:''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany')?'&entity='.$entity:''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
|
||||
}
|
||||
|
||||
// Check link validity for param 'source' to avoid use of the examples as value
|
||||
@ -429,7 +429,7 @@ if ($action == "dosign" && empty($cancel)) {
|
||||
success: function(response) {
|
||||
if(response == "success"){
|
||||
console.log("Success on saving signature");
|
||||
window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&message=signed&securekey='.urlencode($SECUREKEY).($conf->multicompany->enabled?'&entity='.$entity:'').'");
|
||||
window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&message=signed&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany')?'&entity='.$entity:'').'");
|
||||
}else{
|
||||
console.error(response);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ try {
|
||||
$langs->load("main");
|
||||
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->stripeconnect->enabled) && is_object($mc)) {
|
||||
$sql = "SELECT entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql .= " WHERE service = '".$db->escape($service)."' and tokenstring LIKE '%".$db->escape($event->account)."%'";
|
||||
|
||||
@ -425,7 +425,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) {
|
||||
$messagetoshow = str_replace(array('{s1}', '{s2}'), array('<strong>'.$object->track_id.'</strong>', '<strong>'.$object->ref.'</strong>'), $messagetoshow);
|
||||
setEventMessages($messagetoshow, null, 'warnings');
|
||||
setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
|
||||
header("Location: index.php".(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:''));
|
||||
header("Location: index.php".(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:''));
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -84,9 +84,9 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
|
||||
print '<div class="ticketpublicarea">';
|
||||
print '<p style="text-align: center">'.($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")).'</p>';
|
||||
print '<div class="ticketform">';
|
||||
print '<a href="create_ticket.php'.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-15x fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
|
||||
print '<a href="list.php'.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded"><span class="fa fa-15x fa-list-alt valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'</div></a>';
|
||||
print '<a href="view.php'.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded">'.img_picto('', 'ticket', 'class="fa-15x"').'<br>'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
|
||||
print '<a href="create_ticket.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-15x fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
|
||||
print '<a href="list.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded"><span class="fa fa-15x fa-list-alt valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'</div></a>';
|
||||
print '<a href="view.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded">'.img_picto('', 'ticket', 'class="fa-15x"').'<br>'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
|
||||
print '<div style="clear:both;"></div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
@ -221,7 +221,7 @@ if ($action == "view_ticketlist") {
|
||||
|
||||
$filter = array();
|
||||
$param = '&action=view_ticketlist';
|
||||
if (!empty($entity) && !empty($conf->multicompany->enabled)) {
|
||||
if (!empty($entity) && isModEnabled('multicompany')) {
|
||||
$param .= '&entity='.$entity;
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ if ($action == "view_ticketlist") {
|
||||
't.fk_user_create' => array('label' => $langs->trans("Author"), 'checked' => 1),
|
||||
't.fk_user_assign' => array('label' => $langs->trans("AssignedTo"), 'checked' => 0),
|
||||
|
||||
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
|
||||
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(isModEnabled('multicompany') && empty($conf->multicompany->transverse_mode))),
|
||||
//'t.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500),
|
||||
//'t.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 2)
|
||||
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
@ -401,7 +401,7 @@ if ($action == "view_ticketlist") {
|
||||
print_barre_liste($langs->trans('TicketList'), $page, '/public/ticket/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
|
||||
|
||||
// Search bar
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" id="searchFormList" >'."\n";
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" id="searchFormList" >'."\n";
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="view_ticketlist">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
@ -688,7 +688,7 @@ if ($action == "view_ticketlist") {
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '<form method="post" id="form_view_ticket" name="form_view_ticket" action="'.dol_buildpath('/public/ticket/view.php', 1).(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" style="display:none;">';
|
||||
print '<form method="post" id="form_view_ticket" name="form_view_ticket" action="'.dol_buildpath('/public/ticket/view.php', 1).(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" style="display:none;">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="view_ticket">';
|
||||
print '<input type="hidden" name="btn_view_ticket_list" value="1">';
|
||||
@ -713,7 +713,7 @@ if ($action == "view_ticketlist") {
|
||||
print '<br>';
|
||||
|
||||
print '<div id="form_view_ticket">';
|
||||
print '<form method="post" name="form_view_ticketlist" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'">';
|
||||
print '<form method="post" name="form_view_ticketlist" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="view_ticketlist">';
|
||||
//print '<input type="hidden" name="search_fk_status" value="non_closed">';
|
||||
|
||||
@ -170,7 +170,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
if ($object->dao->close($user)) {
|
||||
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
||||
|
||||
$url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha').(!empty($entity) && !empty($conf->multicompany->enabled)?'&entity='.$entity:'');
|
||||
$url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha').(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'');
|
||||
header("Location: ".$url);
|
||||
exit;
|
||||
} else {
|
||||
@ -234,7 +234,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
if ($display_ticket) {
|
||||
// Confirmation close
|
||||
if ($action == 'close') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id.(!empty($entity) && !empty($conf->multicompany->enabled)?'&entity='.$entity:''), $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:''), $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
|
||||
}
|
||||
|
||||
print '<div id="form_view_ticket" class="margintoponly">';
|
||||
@ -347,7 +347,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
$formticket->id = $object->dao->id;
|
||||
|
||||
$formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1',
|
||||
'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php'.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:''));
|
||||
'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:''));
|
||||
|
||||
$formticket->withfile = 2;
|
||||
$formticket->withcancel = 1;
|
||||
@ -356,7 +356,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
}
|
||||
|
||||
if ($action != 'presend') {
|
||||
print '<form method="post" id="form_view_ticket_list" name="form_view_ticket_list" action="'.DOL_URL_ROOT.'/public/ticket/list.php'.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'">';
|
||||
print '<form method="post" id="form_view_ticket_list" name="form_view_ticket_list" action="'.DOL_URL_ROOT.'/public/ticket/list.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="view_ticketlist">';
|
||||
print '<input type="hidden" name="track_id" value="'.$object->dao->track_id.'">';
|
||||
@ -371,11 +371,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
|
||||
if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
||||
// New message
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.(!empty($entity) && !empty($conf->multicompany->enabled)?'&entity='.$entity:'').'">'.$langs->trans('AddMessage').'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'">'.$langs->trans('AddMessage').'</a></div>';
|
||||
|
||||
// Close ticket
|
||||
if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=close&track_id='.$object->dao->track_id.(!empty($entity) && !empty($conf->multicompany->enabled)?'&entity='.$entity:'').'">'.$langs->trans('CloseTicket').'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=close&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'">'.$langs->trans('CloseTicket').'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,13 +386,13 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'conversation');
|
||||
$object->viewTicketMessages(false, true, $object->dao);
|
||||
} else {
|
||||
print '<div class="error">Not Allowed<br><a href="'.$_SERVER['PHP_SELF'].'?track_id='.$object->dao->track_id.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" rel="nofollow noopener">'.$langs->trans('Back').'</a></div>';
|
||||
print '<div class="error">Not Allowed<br><a href="'.$_SERVER['PHP_SELF'].'?track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" rel="nofollow noopener">'.$langs->trans('Back').'</a></div>';
|
||||
}
|
||||
} else {
|
||||
print '<div class="center opacitymedium margintoponly marginbottomonly">'.$langs->trans("TicketPublicMsgViewLogIn").'</div>';
|
||||
|
||||
print '<div id="form_view_ticket">';
|
||||
print '<form method="post" name="form_view_ticket" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'">';
|
||||
print '<form method="post" name="form_view_ticket" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="view_ticket">';
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
|
||||
@ -174,7 +174,7 @@ class RecruitmentCandidature extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ class RecruitmentJobPosition extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ function getPublicJobPositionUrl($mode, $ref = '', $localorexternal = 0)
|
||||
}*/
|
||||
|
||||
// For multicompany
|
||||
if (!empty($out) && !empty($conf->multicompany->enabled)) {
|
||||
if (!empty($out) && isModEnabled('multicompany')) {
|
||||
$out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
|
||||
}
|
||||
|
||||
|
||||
@ -406,7 +406,7 @@ foreach ($arrayofmodules as $file => $modCodeTiers) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print "</td>\n";
|
||||
} else {
|
||||
$disabled = (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false);
|
||||
$disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false);
|
||||
print '<td class="center">';
|
||||
if (!$disabled) {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&token='.newToken().'&value='.urlencode($file).'">';
|
||||
|
||||
@ -235,7 +235,7 @@ class CompanyPaymentMode extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1737,7 +1737,7 @@ class Societe extends CommonObject
|
||||
$sql .= ', st.libelle as stcomm, st.picto as stcomm_picto';
|
||||
$sql .= ', te.code as typent_code';
|
||||
$sql .= ', i.libelle as label_incoterms';
|
||||
if (empty($conf->multicompany->enabled)) {
|
||||
if (!isModEnabled('multicompany')) {
|
||||
$sql .= ', s.remise_client, s.remise_supplier';
|
||||
} else {
|
||||
$sql .= ', sr.remise_client, sr2.remise_supplier';
|
||||
@ -1756,7 +1756,7 @@ class Societe extends CommonObject
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid';
|
||||
// With default setup, llx_societe_remise is a history table in default setup and current value is in llx_societe.
|
||||
// We use it for real value when multicompany is on. A better place would be into llx_societe_perentity.
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise_supplier as sr2 ON sr2.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise_supplier WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))';
|
||||
}
|
||||
@ -2378,7 +2378,7 @@ class Societe extends CommonObject
|
||||
$sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut as status, u.entity, u.photo, u.gender";
|
||||
$sql .= ", u.office_fax, u.user_mobile, u.personal_mobile";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " WHERE ((ug.fk_user = sc.fk_user";
|
||||
$sql .= " AND ug.entity = ".$conf->entity.")";
|
||||
|
||||
@ -189,7 +189,7 @@ class CTicketCategory extends CommonObject
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -331,7 +331,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
|
||||
@ -312,7 +312,7 @@ if (empty($reshook)) {
|
||||
|
||||
// Set entity property
|
||||
$entity = GETPOST('entity', 'int');
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
if (GETPOST('superadmin', 'int')) {
|
||||
$object->entity = 0;
|
||||
} else {
|
||||
@ -476,7 +476,7 @@ if (empty($reshook)) {
|
||||
$object->lang = GETPOST('default_lang', 'aZ09');
|
||||
|
||||
// Do we update also ->entity ?
|
||||
if (!empty($conf->multicompany->enabled) && empty($user->entity) && !empty($user->admin)) { // If multicompany is not enabled, we never update the entity of a user.
|
||||
if (isModEnabled('multicompany') && empty($user->entity) && !empty($user->admin)) { // If multicompany is not enabled, we never update the entity of a user.
|
||||
if (GETPOST('superadmin', 'int')) {
|
||||
$object->entity = 0;
|
||||
} else {
|
||||
@ -886,7 +886,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print '<td>';
|
||||
print $form->selectyesno('admin', GETPOST('admin'), 1);
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && !$user->entity) {
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<script type="text/javascript">
|
||||
$(function() {
|
||||
@ -1181,7 +1181,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
||||
if (!method_exists($mc, 'formObjectOptions')) {
|
||||
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { // condition must be same for create and edit mode
|
||||
@ -1435,7 +1435,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
@ -1654,10 +1654,10 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
||||
if (!method_exists($mc, 'formObjectOptions')) {
|
||||
if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
print '<tr><td>'.$langs->trans("Entity").'</td><td>';
|
||||
if (empty($object->entity)) {
|
||||
print $langs->trans("AllEntities");
|
||||
@ -1864,7 +1864,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params);
|
||||
}
|
||||
|
||||
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
if ($caneditfield && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
@ -1878,7 +1878,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken(), '', true, $params);
|
||||
}
|
||||
} elseif ($caneditpassword && !$object->ldap_sid &&
|
||||
(empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
(!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
@ -1900,7 +1900,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
$params['attr']['title'] = $langs->trans('UserDisabled');
|
||||
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password&token='.newToken(), '', true, $params);
|
||||
}
|
||||
|
||||
@ -1908,7 +1908,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
$params['attr']['title'] = $langs->trans('UserDisabled');
|
||||
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
|
||||
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
if ($object->email) {
|
||||
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
@ -1926,12 +1926,12 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
)
|
||||
);
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken(), '', true, $params);
|
||||
}
|
||||
// Disable user
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
if ($user->id == $id) {
|
||||
@ -1941,7 +1941,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
}
|
||||
// Delete
|
||||
if ($user->id <> $id && $candisableuser &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
|
||||
if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin
|
||||
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', true, $params);
|
||||
} else {
|
||||
@ -2134,13 +2134,13 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
if ($user->admin // Need to be admin to allow downgrade of an admin
|
||||
&& ($user->id != $object->id) // Don't downgrade ourself
|
||||
&& (
|
||||
(empty($conf->multicompany->enabled) && $nbAdmin >= 1)
|
||||
|| (!empty($conf->multicompany->enabled) && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone
|
||||
(!isModEnabled('multicompany') && $nbAdmin >= 1)
|
||||
|| (isModEnabled('multicompany') && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone
|
||||
)
|
||||
) {
|
||||
print $form->selectyesno('admin', $object->admin, 1);
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && !$user->entity) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print '<script type="text/javascript">
|
||||
$(function() {
|
||||
@ -2186,7 +2186,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
$yn = yn($object->admin);
|
||||
print '<input type="hidden" name="admin" value="'.$object->admin.'">';
|
||||
print '<input type="hidden" name="superadmin" value="'.(empty($object->entity) ? 1 : 0).'">';
|
||||
if (!empty($conf->multicompany->enabled) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && empty($object->entity)) {
|
||||
print $form->textwithpicto($yn, $langs->trans("DontDowngradeSuperAdmin"), 1, 'warning');
|
||||
} else {
|
||||
print $yn;
|
||||
@ -2645,7 +2645,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
|
||||
// Multicompany
|
||||
// TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !!
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
|
||||
if (!method_exists($mc, 'formObjectOptions')) {
|
||||
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
|
||||
@ -487,7 +487,7 @@ class Users extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && !empty(DolibarrApiAccess::$user->admin) && empty(DolibarrApiAccess::$user->entity)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && !empty(DolibarrApiAccess::$user->admin) && empty(DolibarrApiAccess::$user->entity)) {
|
||||
$entity = (!empty($entity) ? $entity : $conf->entity);
|
||||
} else {
|
||||
// When using API, action is done on entity of logged user because a user of entity X with permission to create user should not be able to
|
||||
|
||||
@ -466,14 +466,14 @@ class User extends CommonObject
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."c_departements as d ON u.fk_state = d.rowid";
|
||||
|
||||
if ($entity < 0) {
|
||||
if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity))) {
|
||||
if ((!isModEnabled('multicompany') || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity))) {
|
||||
$sql .= " WHERE u.entity IN (0, ".((int) $conf->entity).")";
|
||||
} else {
|
||||
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||
}
|
||||
} else {
|
||||
// The fetch was forced on an entity
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
|
||||
} else {
|
||||
$sql .= " WHERE u.entity IN (0, ".((int) (($entity != '' && $entity >= 0) ? $entity : $conf->entity)).")"; // search in entity provided in parameter
|
||||
@ -588,7 +588,7 @@ class User extends CommonObject
|
||||
|
||||
// Protection when module multicompany was set, admin was set to first entity and then, the module was disabled,
|
||||
// in such case, this admin user must be admin for ALL entities.
|
||||
if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) {
|
||||
if (!isModEnabled('multicompany') && $this->admin && $this->entity == 1) {
|
||||
$this->entity = 0;
|
||||
}
|
||||
|
||||
@ -1130,7 +1130,7 @@ class User extends CommonObject
|
||||
$sql .= " WHERE r.id = ur.fk_id";
|
||||
if (!empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
|
||||
// on old version, we use entity defined into table r only
|
||||
$sql .= " AND r.entity IN (0,".(!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "").$conf->entity.")";
|
||||
$sql .= " AND r.entity IN (0,".(isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "").$conf->entity.")";
|
||||
} else {
|
||||
// On table r=rights_def, the unique key is (id, entity) because id is hard coded into module descriptor and insert during module activation.
|
||||
// So we must include the filter on entity on both table r. and ur.
|
||||
@ -1188,7 +1188,7 @@ class User extends CommonObject
|
||||
$sql .= " ".$this->db->prefix()."rights_def as r";
|
||||
$sql .= " WHERE r.id = gr.fk_id";
|
||||
if (!empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " AND gu.entity IN (0,".$conf->entity.")";
|
||||
} else {
|
||||
$sql .= " AND r.entity = ".((int) $conf->entity);
|
||||
@ -3661,7 +3661,7 @@ class User extends CommonObject
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT u.rowid) as nb";
|
||||
$sql .= " FROM ".$this->db->prefix()."user as u";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ", ".$this->db->prefix()."usergroup_user as ug";
|
||||
$sql .= " WHERE ug.entity IN (".getEntity('usergroup').")";
|
||||
$sql .= " AND ug.fk_user = u.rowid";
|
||||
|
||||
@ -195,7 +195,7 @@ class UserGroup extends CommonObject
|
||||
$sql .= " ".$this->db->prefix()."usergroup_user as ug";
|
||||
$sql .= " WHERE ug.fk_usergroup = g.rowid";
|
||||
$sql .= " AND ug.fk_user = ".((int) $userid);
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= " AND g.entity IS NOT NULL";
|
||||
} else {
|
||||
$sql .= " AND g.entity IN (0,".$conf->entity.")";
|
||||
@ -252,7 +252,7 @@ class UserGroup extends CommonObject
|
||||
if (!empty($this->id)) {
|
||||
$sql .= " AND ug.fk_usergroup = ".((int) $this->id);
|
||||
}
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= " AND u.entity IS NOT NULL";
|
||||
} else {
|
||||
$sql .= " AND u.entity IN (0,".$conf->entity.")";
|
||||
|
||||
@ -180,7 +180,7 @@ if ($object->id) {
|
||||
print '<td>';
|
||||
$addadmin = '';
|
||||
if (property_exists($object, 'admin')) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
|
||||
if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
|
||||
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
|
||||
} elseif (!empty($object->admin)) {
|
||||
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
|
||||
|
||||
@ -73,7 +73,7 @@ $hookmanager->initHooks(array('groupcard', 'globalcard'));
|
||||
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2);
|
||||
|
||||
// Users/Groups management only in master entity if transverse mode
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
|
||||
if (isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$object->entity = 0;
|
||||
} else {
|
||||
if ($conf->entity == 1 && $user->admin && !$user->entity) { // Same permissions test than the one used to show the combo of entities into the form
|
||||
@ -215,7 +215,7 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$object->entity = 0;
|
||||
} elseif (GETPOSTISSET("entity")) {
|
||||
$object->entity = GETPOST("entity", "int");
|
||||
@ -274,7 +274,7 @@ if ($action == 'create') {
|
||||
print '<table class="border centpercent tableforfieldcreate">';
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
|
||||
print "<td>".$mc->select_entities($conf->entity);
|
||||
@ -348,7 +348,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$mc->getInfo($object->entity);
|
||||
print "<tr>".'<td class="titlefield">'.$langs->trans("Entity").'</td>';
|
||||
print '<td class="valeur">'.dol_escape_htmltag($mc->label);
|
||||
@ -520,7 +520,7 @@ if ($action == 'create') {
|
||||
print '<table class="border centpercent tableforfieldedit">'."\n";
|
||||
|
||||
// Multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
|
||||
print "<td>".$mc->select_entities($object->entity);
|
||||
|
||||
@ -46,7 +46,7 @@ $object->fetch($id);
|
||||
$object->getrights();
|
||||
|
||||
// Users/Groups management only in master entity if transverse mode
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && $conf->entity > 1 && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
}
|
||||
|
||||
// Users/Groups management only in master entity if transverse mode
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
|
||||
if (isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ $sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms as datem
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
|
||||
$sql .= " WHERE g.entity IS NOT NULL";
|
||||
} else {
|
||||
$sql .= " WHERE g.entity IN (0,".$conf->entity.")";
|
||||
@ -192,7 +192,7 @@ if ($resql) {
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder);
|
||||
//multicompany
|
||||
if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||
if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||
print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
@ -219,7 +219,7 @@ if ($resql) {
|
||||
}
|
||||
print "</td>";
|
||||
//multicompany
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||
if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||
$mc->getInfo($obj->entity);
|
||||
print '<td class="center">'.$mc->label.'</td>';
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ if (!is_array($user_arbo) && $user_arbo < 0) {
|
||||
$entitystring = '';
|
||||
|
||||
// TODO Set of entitystring should be done with a hook
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
if (empty($entity)) {
|
||||
$entitystring = $langs->trans("AllEntities");
|
||||
} else {
|
||||
@ -131,7 +131,7 @@ if (!is_array($user_arbo) && $user_arbo < 0) {
|
||||
}
|
||||
|
||||
$li = $userstatic->getNomUrl(-1, '', 0, 1);
|
||||
if (!empty($conf->multicompany->enabled) && $userstatic->admin && !$userstatic->entity) {
|
||||
if (isModEnabled('multicompany') && $userstatic->admin && !$userstatic->entity) {
|
||||
$li .= img_picto($langs->trans("SuperAdministrator"), 'redstar');
|
||||
} elseif ($userstatic->admin) {
|
||||
$li .= img_picto($langs->trans("Administrator"), 'star');
|
||||
|
||||
@ -166,7 +166,7 @@ if ($resql) {
|
||||
$lastcreatedbox .= '<tr class="oddeven">';
|
||||
$lastcreatedbox .= '<td class="nowraponall tdoverflowmax150">';
|
||||
$lastcreatedbox .= $fuserstatic->getNomUrl(-1);
|
||||
if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) {
|
||||
if (isModEnabled('multicompany') && $obj->admin && !$obj->entity) {
|
||||
$lastcreatedbox .= img_picto($langs->trans("SuperAdministrator"), 'redstar');
|
||||
} elseif ($obj->admin) {
|
||||
$lastcreatedbox .= img_picto($langs->trans("Administrator"), 'star');
|
||||
@ -185,7 +185,7 @@ if ($resql) {
|
||||
$entity = $obj->entity;
|
||||
$entitystring = '';
|
||||
// TODO Set of entitystring should be done with a hook
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
if (empty($entity)) {
|
||||
$entitystring = $langs->trans("AllEntities");
|
||||
} else {
|
||||
@ -223,7 +223,7 @@ if ($canreadperms) {
|
||||
|
||||
$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
|
||||
if (isModEnabled('multicompany') && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
|
||||
$sql .= " WHERE g.entity IS NOT NULL";
|
||||
} else {
|
||||
$sql .= " WHERE g.entity IN (0,".$conf->entity.")";
|
||||
@ -234,7 +234,7 @@ if ($canreadperms) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$colspan = 1;
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
if (isModEnabled('multicompany')) {
|
||||
$colspan++;
|
||||
}
|
||||
$num = $db->num_rows($resql);
|
||||
@ -262,7 +262,7 @@ if ($canreadperms) {
|
||||
$lastgroupbox .= img_picto($langs->trans("GlobalGroup"), 'redstar');
|
||||
}
|
||||
$lastgroupbox .= "</td>";
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc)) {
|
||||
$mc->getInfo($obj->entity);
|
||||
$lastgroupbox .= '<td>';
|
||||
$lastgroupbox .= $mc->label;
|
||||
|
||||
@ -121,7 +121,7 @@ $arrayfields = array(
|
||||
'u.login'=>array('label'=>"Login", 'checked'=>1, 'position'=>10),
|
||||
'u.lastname'=>array('label'=>"Lastname", 'checked'=>1, 'position'=>15),
|
||||
'u.firstname'=>array('label'=>"Firstname", 'checked'=>1, 'position'=>20),
|
||||
'u.entity'=>array('label'=>"Entity", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
|
||||
'u.entity'=>array('label'=>"Entity", 'checked'=>1, 'position'=>50, 'enabled'=>(isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
|
||||
'u.gender'=>array('label'=>"Gender", 'checked'=>0, 'position'=>22),
|
||||
'u.employee'=>array('label'=>"Employee", 'checked'=>($mode == 'employee' ? 1 : 0), 'position'=>25),
|
||||
'u.fk_user'=>array('label'=>"HierarchicalResponsible", 'checked'=>1, 'position'=>27),
|
||||
@ -981,7 +981,7 @@ while ($i < $imaxinloop) {
|
||||
if (!empty($arrayfields['u.login']['checked'])) {
|
||||
print '<td class="nowraponall tdoverflowmax150">';
|
||||
print $li;
|
||||
if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) {
|
||||
if (isModEnabled('multicompany') && $obj->admin && !$obj->entity) {
|
||||
print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
|
||||
} elseif ($obj->admin) {
|
||||
print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"');
|
||||
@ -1054,7 +1054,7 @@ while ($i < $imaxinloop) {
|
||||
$user2->statut = $obj->status2;
|
||||
$user2->status = $obj->status2;
|
||||
print $user2->getNomUrl(-1, '', 0, 0, 24, 0, '', '', 1);
|
||||
if (!empty($conf->multicompany->enabled) && $obj->admin2 && !$obj->entity2) {
|
||||
if (isModEnabled('multicompany') && $obj->admin2 && !$obj->entity2) {
|
||||
print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
|
||||
} elseif ($obj->admin2) {
|
||||
print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"');
|
||||
@ -1123,7 +1123,7 @@ while ($i < $imaxinloop) {
|
||||
}
|
||||
}
|
||||
// Multicompany enabled
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (!empty($arrayfields['u.entity']['checked'])) {
|
||||
print '<td>';
|
||||
if (!$obj->entity) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user