Merge remote-tracking branch 'upstream/develop' into userbankaccount

This commit is contained in:
Frédéric FRANCE 2022-08-29 17:00:09 +02:00
commit 8ab6d293e1
179 changed files with 1331 additions and 836 deletions

View File

@ -6,9 +6,13 @@ on:
- cron: "0 21 * * *"
issue_comment:
types: [created]
permissions: {} # none
jobs:
stale:
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- uses: Dolibarr/stale@staleunstale
@ -21,4 +25,4 @@ jobs:
days-before-close: 10
operations-per-run: 100
dry-run: false

View File

@ -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 = '';

View File

@ -178,6 +178,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
$object->status = (int) $status;
$object->subscription = (int) $subscription;
$object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
$object->caneditamount = $caneditamount;
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);
@ -828,6 +829,10 @@ if ($rowid > 0) {
print '">';
print '</td></tr>';
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).'</td><td>';
print $form->selectyesno("caneditamount", $object->caneditamount);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote", $object->vote, 1);
print '</td></tr>';

View File

@ -261,9 +261,9 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_SERVER").show();
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".dkim").hide();
jQuery(".dkim").hide();
jQuery(".smtp_auth_method").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
@ -290,9 +290,9 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".smtp_method").show();
jQuery(".dkim").show();
jQuery(".smtp_auth_method").show();
jQuery(".smtp_auth_method").show();
}
}
function change_smtp_auth_method() {
@ -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 '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@ -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>';
}
}

View File

@ -71,7 +71,15 @@ if ($action == 'update' && !$cancel) {
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_EMAILING", GETPOST("MAIN_MAIL_SMTP_PORT_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_EMAILING", GETPOST("MAIN_MAIL_SMTP_SERVER_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_EMAILING", GETPOST("MAIN_MAIL_SMTPS_ID_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_EMAILING", GETPOST("MAIN_MAIL_SMTPS_PW_EMAILING"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_EMAILING")) {
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_EMAILING", GETPOST("MAIN_MAIL_SMTPS_PW_EMAILING", 'none'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING")) {
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING", 'chaine'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING")) {
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING", 'chaine'), 'chaine', 0, '', $conf->entity);
}
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_TLS_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING"), 'chaine', 0, '', $conf->entity);
@ -145,6 +153,24 @@ if (version_compare(phpversion(), '7.0', '>=')) {
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
}
// List of oauth services
$oauthservices = array();
foreach ($conf->global as $key => $val) {
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
$key = preg_replace('/^OAUTH_/', '', $key);
$key = preg_replace('/_ID$/', '', $key);
if (preg_match('/^.*-/', $key)) {
$name = preg_replace('/^.*-/', '', $key);
} else {
$name = $langs->trans("NoName");
}
$provider = preg_replace('/-.*$/', '', $key);
$provider = ucfirst(strtolower($provider));
$oauthservices[$key] = $name." (".$provider.")";
}
}
if ($action == 'edit') {
if ($conf->use_javascript_ajax) {
@ -170,6 +196,8 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").prop("disabled", true);
jQuery(".smtp_method").hide();
jQuery(".smtp_auth_method").hide();
';
if ($linuxlike) {
print '
@ -201,9 +229,11 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
jQuery("#smtp_port_mess").hide();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
}
jQuery(".smtp_method").show();
jQuery(".smtp_auth_method").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\')
{
jQuery(".drag").show();
@ -219,12 +249,35 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".smtp_auth_method").show();
}
}
function change_smtp_auth_method() {
console.log(jQuery("#radio_pw").prop("checked"));
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
jQuery(".smtp_oauth_service").show();
jQuery(".smtp_pw").hide();
} else if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
jQuery(".smtp_oauth_service").show();
jQuery(".smtp_pw").hide();
} else if(jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\' || jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\'){
jQuery(".smtp_oauth_service").hide();
jQuery(".smtp_pw").hide();
} else {
jQuery(".smtp_oauth_service").hide();
jQuery(".smtp_pw").show();
}
}
initfields();
jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
change_smtp_auth_method();
jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
initfields();
});
change_smtp_auth_method();
});
jQuery("#radio_pw, #radio_oauth").change(function() {
change_smtp_auth_method();
});
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").change(function() {
if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
@ -237,7 +290,7 @@ if ($action == 'edit') {
else
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
});
})';
})';
print '</script>'."\n";
}
@ -354,10 +407,28 @@ if ($action == 'edit') {
print '</td></tr>';
}
// OAUTH
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'LOGIN' ? ' checked' : '').'> ';
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'XOAUTH2' ? ' checked' : '').'> ';
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
} else {
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="'.$value.'">';
}
print '</td></tr>';
}
// PW
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_PW_EMAILING : '');
print '<tr class="drag drop oddeven hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_PW") . '</td><td>';
print '<tr class="drag drop oddeven smtp_pw hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_PW") . '</td><td>';
// SuperAdministrator access only
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="' . $mainsmtppw . '">';
@ -369,6 +440,26 @@ if ($action == 'edit') {
print '</td></tr>';
}
// OAUTH service provider
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING);
} else {
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING];
if (empty($text)) {
$text = $langs->trans("Undefined");
}
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING" value="'.$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING.'">';
}
print '</td></tr>';
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
@ -458,11 +549,28 @@ if ($action == 'edit') {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING').'</td></tr>';
}
// AUTH method
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) {
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
}
// SMTPS PW
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING')).'</td></tr>';
}
// SMTPS oauth service
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') === "XOAUTH2") {
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING];
if (empty($text)) {
$text = $langs->trans("Undefined").img_warning();
}
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING").'</td><td>'.$text.'</td></tr>';
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {

View File

@ -66,8 +66,15 @@ if ($action == 'update' && !$cancel) {
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_TICKET", GETPOST("MAIN_MAIL_SMTP_PORT_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_TICKET", GETPOST("MAIN_MAIL_SMTP_SERVER_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_TICKET", GETPOST("MAIN_MAIL_SMTPS_ID_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_TICKET", GETPOST("MAIN_MAIL_SMTPS_PW_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_TLS_TICKET"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_TICKET")) {
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_TICKET", GETPOST("MAIN_MAIL_SMTPS_PW_TICKET", 'none'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET")) {
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", 'chaine'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET")) {
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", 'chaine'), 'chaine', 0, '', $conf->entity);
}dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_TLS_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_TICKET"), 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
@ -139,6 +146,25 @@ if (version_compare(phpversion(), '7.0', '>=')) {
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
}
// List of oauth services
$oauthservices = array();
foreach ($conf->global as $key => $val) {
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
$key = preg_replace('/^OAUTH_/', '', $key);
$key = preg_replace('/_ID$/', '', $key);
if (preg_match('/^.*-/', $key)) {
$name = preg_replace('/^.*-/', '', $key);
} else {
$name = $langs->trans("NoName");
}
$provider = preg_replace('/-.*$/', '', $key);
$provider = ucfirst(strtolower($provider));
$oauthservices[$key] = $name." (".$provider.")";
}
}
if ($action == 'edit') {
if ($conf->use_javascript_ajax) {
@ -162,6 +188,8 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").prop("disabled", true);
jQuery(".smtp_method").hide();
jQuery(".smtp_auth_method").hide();
';
if ($linuxlike) {
print '
@ -192,7 +220,9 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").show();
jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".smtp_auth_method").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\')
{
@ -207,12 +237,37 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".smtp_auth_method").show();
}
}
function change_smtp_auth_method() {
console.log(jQuery("#radio_pw").prop("checked"));
if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
jQuery(".smtp_oauth_service").show();
jQuery(".smtp_pw").hide();
} else if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
jQuery(".smtp_oauth_service").show();
jQuery(".smtp_pw").hide();
} else if(jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'mail\' || jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'default\'){
jQuery(".smtp_oauth_service").hide();
jQuery(".smtp_pw").hide();
} else {
jQuery(".smtp_oauth_service").hide();
jQuery(".smtp_pw").show();
}
}
initfields();
change_smtp_auth_method();
jQuery("#MAIN_MAIL_SENDMODE_TICKET").change(function() {
initfields();
change_smtp_auth_method();
});
jQuery("#radio_pw, #radio_oauth").change(function() {
change_smtp_auth_method();
});
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
@ -275,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>';
@ -305,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>';
@ -323,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");
@ -333,12 +388,31 @@ if ($action == 'edit') {
print '</td></tr>';
}
// OAUTH
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') == 'LOGIN' ? ' checked' : '').'> ';
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') == 'XOAUTH2' ? ' checked' : '').'> ';
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
} else {
$value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="'.$value.'">';
}
print '</td></tr>';
}
// PW
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_TICKET) ? $conf->global->MAIN_MAIL_SMTPS_PW_TICKET : '');
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
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");
@ -348,6 +422,24 @@ if ($action == 'edit') {
print '</td></tr>';
}
// OAUTH service provider
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET);
} else {
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET];
if (empty($text)) {
$text = $langs->trans("Undefined");
}
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET" value="'.$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET.'">';
}
print '</td></tr>';
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
@ -425,11 +517,27 @@ if ($action == 'edit') {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID_TICKET.'</td></tr>';
}
// AUTH method
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
}
// SMTPS PW
if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW_TICKET).'</td></tr>';
}
// SMTPS oauth service
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') === "XOAUTH2") {
$text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET];
if (empty($text)) {
$text = $langs->trans("Undefined").img_warning();
}
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET").'</td><td>'.$text.'</td></tr>';
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
@ -496,7 +604,7 @@ if ($action == 'edit') {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
if (!empty($conf->fckeditor->enabled)) {
if (isModEnabled('fckeditor')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&amp;mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
}
}

View File

@ -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>';

View File

@ -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';

View File

@ -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>';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
*
@ -47,9 +47,6 @@ $allow_disable_encryption = true;
if ($action == 'setgeneraterule') {
if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', $_GET["value"], 'chaine', 0, '', $conf->entity)) {
dol_print_error($db);
} else {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
}
@ -94,8 +91,6 @@ if ($action == 'activate_encrypt') {
//exit;
if (!$error) {
$db->commit();
header("Location: security.php");
exit;
} else {
$db->rollback();
dol_print_error($db, '');
@ -106,8 +101,6 @@ if ($action == 'activate_encrypt') {
if ($allow_disable_encryption) {
dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", $conf->entity);
}
header("Location: security.php");
exit;
}
if ($action == 'activate_encryptdbpassconf') {
@ -138,12 +131,8 @@ if ($action == 'activate_encryptdbpassconf') {
if ($action == 'activate_MAIN_SECURITY_DISABLEFORGETPASSLINK') {
dolibarr_set_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", '1', 'chaine', 0, '', $conf->entity);
header("Location: security.php");
exit;
} elseif ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') {
dolibarr_del_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", $conf->entity);
header("Location: security.php");
exit;
}
if ($action == 'updatepattern') {
@ -387,9 +376,9 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
// Cryptage mot de passe
print '<br>';
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print "<input type=\"hidden\" name=\"action\" value=\"encrypt\">";
print '<input type="hidden" name="action" value="encrypt">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
@ -408,7 +397,7 @@ if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print '</td>';
if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print '<td align="center" width="100">';
print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>';
print '<a class="reposition" href="security.php?action=activate_encrypt&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print "</td>";
}
@ -418,7 +407,7 @@ if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
if ($allow_disable_encryption) {
//On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes
//Do not allow "disable encryption" as passwords cannot be decrypted
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_encrypt&token='.newToken().'">'.$langs->trans("Disable").'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_encrypt&token='.newToken().'">'.$langs->trans("Disable").'</a>';
} else {
print '-';
}
@ -444,10 +433,10 @@ if (empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
print img_warning($langs->trans("WarningPassIsEmpty"));
} else {
if (empty($dolibarr_main_db_encrypted_pass)) {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_encryptdbpassconf&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_encryptdbpassconf&token='.newToken().'">'.$langs->trans("Activate").'</a>';
}
if (!empty($dolibarr_main_db_encrypted_pass)) {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_encryptdbpassconf&token='.newToken().'">'.$langs->trans("Disable").'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_encryptdbpassconf&token='.newToken().'">'.$langs->trans("Disable").'</a>';
}
}
print "</td>";
@ -467,12 +456,12 @@ if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print '</td>';
if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print '<td align="center" width="100">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print "</td>";
}
if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print '<td align="center" width="100">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>';
print "</td>";
}
print "</td>";

View File

@ -200,10 +200,10 @@ print '</tr>';
print '</table>';
print dol_get_fiche_end();
print $form->buttonsSaveCancel("Modify", '');
print dol_get_fiche_end();
print '</form>';
// End of page

View File

@ -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";

View File

@ -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";

View File

@ -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>';
}

View File

@ -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"');

View File

@ -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>';
}*/

View File

@ -115,6 +115,8 @@ class DolibarrApi
// Remove linkedObjects. We should already have linkedObjectsIds that avoid huge responses
unset($object->linkedObjects);
unset($object->linkedObjectsFullLoaded);
//unset($object->lines[$i]->linked_objects); // This is the array to create linked object during create
unset($object->fields);
unset($object->oldline);
@ -139,6 +141,7 @@ class DolibarrApi
unset($object->projet); // Should be fk_project
unset($object->project); // Should be fk_project
unset($object->fk_projet); // Should be fk_project
unset($object->author); // Should be fk_user_author
unset($object->timespent_old_duration);
unset($object->timespent_id);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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 ";

View File

@ -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)) {

View File

@ -47,7 +47,6 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
if (!empty($conf->project->enabled)) {
@ -875,7 +874,7 @@ if (empty($reshook)) {
}
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '' && $usercancreate) {
// Define vat_rate
// Define a vat_rate for all lines
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
@ -884,7 +883,7 @@ if (empty($reshook)) {
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
// Define vat_rate
// Define a discount for all lines
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
$remise_percent = str_replace('*', '', $remise_percent);
foreach ($object->lines as $line) {
@ -894,22 +893,36 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode');
$price_ht = '';
$price_ht_devise = '';
$price_ttc = '';
$price_ttc_devise = '';
if (GETPOST('price_ht') !== '') {
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ht') !== '') {
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
}
if (GETPOST('price_ttc') !== '') {
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ttc') !== '') {
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
}
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx'))) : 0);
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
@ -930,7 +943,7 @@ if (empty($reshook)) {
$error++;
}
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht === '' && $price_ht_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal.
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht === '' && $price_ht_devise === '' && $price_ttc === '' && $price_ttc_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal.
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
@ -1077,13 +1090,15 @@ if (empty($reshook)) {
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
// Set unit price to use
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif (!empty($price_ttc) || $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} elseif ($tmpvat != $tmpprodvat) {
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
// Is this still used ?
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
@ -1170,16 +1185,22 @@ if (empty($reshook)) {
$fk_unit = $prod->fk_unit;
} else {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$pu_ttc = price2num($price_ttc, 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
if (empty($tva_tx)) {
$tva_npr = 0;
}
$tva_tx = str_replace('*', '', $tva_tx);
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$fk_unit = GETPOST('units', 'alpha');
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
if ($pu_ttc && !$pu_ht) {
$price_base_type = 'TTC';
}
}
// Margin
@ -1298,7 +1319,7 @@ if (empty($reshook)) {
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
//$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
@ -1382,7 +1403,14 @@ if (empty($reshook)) {
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
$pu = $pu_ht;
$price_base_type = 'HT';
if (empty($pu) && ! empty($pu_ttc)) {
$pu = $pu_ttc;
$price_base_type = 'TTC';
}
$result = $object->updateline(GETPOST('lineid', 'int'), $pu, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, $price_base_type, $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
if ($result >= 0) {
$db->commit();
@ -2696,7 +2724,7 @@ if ($action == 'create') {
* Lines
*/
// Show object lines
// Get object lines
$result = $object->getLinesArray();
// Add products/services form
@ -2704,7 +2732,7 @@ if ($action == 'create') {
global $inputalsopricewithtax;
$inputalsopricewithtax = 1;
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
@ -2906,7 +2934,7 @@ if ($action == 'create') {
if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
print '<br><!-- Link to sign -->';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
print showOnlineSignatureUrl('proposal', $object->ref).'<br>';
}

View File

@ -932,9 +932,6 @@ class Propal extends CommonObject
$this->line->date_start = $date_start;
$this->line->date_end = $date_end;
// TODO deprecated
$this->line->price = $price;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
foreach ($array_options as $key => $value) {

View File

@ -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>';

View File

@ -30,37 +30,41 @@
*/
/**
* \file htdocs/commande/card.php
* \ingroup commande
* \brief Page to show customer order
* \file htdocs/commande/card.php
* \ingroup commande
* \brief Page to show customer order
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (isModEnabled("propal")) {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
}
if (!empty($conf->project->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
if (!empty($conf->project->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other'));
if (!empty($conf->incoterm->enabled)) {
$langs->load('incoterm');
}
@ -68,21 +72,22 @@ if (!empty($conf->margin->enabled)) {
$langs->load('margins');
}
if (!empty($conf->productbatch->enabled)) {
$langs->load("productbatch");
$langs->load('productbatch');
}
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('orderid', 'int'));
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$lineid = GETPOST('lineid', 'int');
$contactid = GETPOST('contactid', 'int');
$projectid = GETPOST('projectid', 'int');
$origin = GETPOST('origin', 'alpha');
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('orderid', 'int'));
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$lineid = GETPOST('lineid', 'int');
$contactid = GETPOST('contactid', 'int');
$projectid = GETPOST('projectid', 'int');
$origin = GETPOST('origin', 'alpha');
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
// PDF
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
@ -106,25 +111,27 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
// Permissions / Rights
$usercanread = $user->hasRight("commande", "lire");
$usercancreate = $user->hasRight("commande", "creer");
$usercandelete = $user->hasRight("commande", "supprimer");
$usercanread = $user->hasRight("commande", "lire");
$usercancreate = $user->hasRight("commande", "creer");
$usercandelete = $user->hasRight("commande", "supprimer");
// Advanced permissions
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'close')));
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'validate')));
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'annuler')));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('commande', 'order_advance', 'send'));
$usercangeneretedoc = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('commande', 'order_advance', 'generetedoc'));
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'close')));
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'validate')));
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'annuler')));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('commande', 'order_advance', 'send'));
$usercangeneretedoc = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('commande', 'order_advance', 'generetedoc'));
$usermustrespectpricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
$usermustrespectpricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
$usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer'));
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$error = 0;
@ -166,11 +173,11 @@ if (empty($reshook)) {
$action = '';
}
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate) {
@ -646,22 +653,35 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode');
$price_ht = '';
$price_ht_devise = '';
$price_ttc = '';
$price_ttc_devise = '';
if (GETPOST('price_ht') !== '') {
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ht') !== '') {
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
}
if (GETPOST('price_ttc') !== '') {
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ttc') !== '') {
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
}
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
@ -686,7 +706,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht == '' && $price_ht_devise == '') { // Unit price can be 0 but not ''. Also price can be negative for order.
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht === '' && $price_ht_devise === '' && $price_ttc === '' && $price_ttc_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for order.
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
@ -835,13 +855,15 @@ if (empty($reshook)) {
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
// Set unit price to use
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif (!empty($price_ttc) || $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} elseif ($tmpvat != $tmpprodvat) {
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
// Is this still used ?
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
@ -928,14 +950,22 @@ if (empty($reshook)) {
$fk_unit = $prod->fk_unit;
} else {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$pu_ttc = price2num($price_ttc, 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
if (empty($tva_tx)) {
$tva_npr = 0;
}
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
$desc = $product_desc;
$type = GETPOST('type');
$fk_unit = GETPOST('units', 'alpha');
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
if ($pu_ttc && !$pu_ht) {
$price_base_type = 'TTC';
}
}
// Margin
@ -946,13 +976,13 @@ if (empty($reshook)) {
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
$desc = dol_htmlcleanlastbr($desc);
$info_bits = 0;
if ($tva_npr) {
$info_bits |= 0x01;
}
$desc = dol_htmlcleanlastbr($desc);
if ($usermustrespectpricemin) {
if ($pu_ht && $price_min && ((price2num($pu_ht) * (1 - $remise_percent / 100)) < price2num($price_min))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
@ -1035,12 +1065,14 @@ if (empty($reshook)) {
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml'));
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0);
$vat_rate = str_replace('*', '', $vat_rate);
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
$pu_ttc = price2num(GETPOST('price_ttc'), '', 2);
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
//$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$qty = price2num(GETPOST('qty'), 'MS');
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
// Define info_bits
$info_bits = 0;
@ -1135,7 +1167,15 @@ if (empty($reshook)) {
}
}
}
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
$price_base_type = 'HT';
$pu = $pu_ht;
if (empty($pu) && ! empty($pu_ttc)) {
$pu = $pu_ttc;
$price_base_type = 'TTC';
}
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -2678,9 +2718,16 @@ if ($action == 'create' && $usercancreate) {
/*
* Lines
*/
// Get object lines
$result = $object->getLinesArray();
print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
// Add products/services form
//$forceall = 1;
global $inputalsopricewithtax;
$inputalsopricewithtax = 1;
print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">

View File

@ -31,7 +31,7 @@
/**
* \file htdocs/commande/class/commande.class.php
* \ingroup commande
* \brief Fichier des classes de commandes
* \brief class for orders
*/
include_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
@ -93,12 +93,12 @@ class Commande extends CommonOrder
protected $table_ref_field = 'ref';
/**
* @var int Thirparty ID
* @var int Thirdparty ID
*/
public $socid;
/**
* @var string Thirparty ref of order
* @var string Thirdparty ref of order
*/
public $ref_client;

View File

@ -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";

View File

@ -37,11 +37,13 @@
* \brief Page to create/see an invoice
*/
// Libraries
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@ -51,6 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (!empty($conf->commande->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
@ -69,16 +72,19 @@ if (!empty($conf->accounting->enabled)) {
// Load translation files required by the page
$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals'));
if (!empty($conf->incoterm->enabled)) {
$langs->load('incoterm');
}
if (!empty($conf->margin->enabled)) {
$langs->load('margins');
}
// General $Variables
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0);
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
@ -102,7 +108,7 @@ $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') :
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
// Nombre de ligne pour choix de produit/service predefinis
// Number of lines for predefined product/service choices
$NBLINES = 4;
$usehm = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : 0);
@ -128,11 +134,14 @@ if ($id > 0 || !empty($ref)) {
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('invoicecard', 'globalcard'));
// Permissions
$usercanread = $user->hasRight("facture", "lire");
$usercancreate = $user->hasRight("facture", "creer");
$usercanissuepayment = $user->hasRight("facture", "paiement");
$usercandelete = $user->hasRight("facture", "supprimer");
$usercancreatecontract = $user->hasRight("contrat", "creer");
// Advanced Permissions
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->validate)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->send)));
$usercanreopen = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->reopen)));
@ -2008,22 +2017,39 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc =(GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
$price_ht = '';
$price_ht_devise = '';
$price_ttc = '';
$price_ttc_devise = '';
if (GETPOST('price_ht') !== '') {
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ht') !== '') {
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
}
if (GETPOST('price_ttc') !== '') {
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ttc') !== '') {
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
}
$prod_entry_mode = GETPOST('prod_entry_mode', 'aZ09');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef), 'MS', 2);
$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -2050,8 +2076,8 @@ if (empty($reshook)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if (($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && (($price_ht_devise < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht_devise == '') && $price_ttc === '' && $price_ttc_devise === '' && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
if (($price_ht < 0 || $price_ttc < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
$langs->load("errors");
if ($object->type == $object::TYPE_DEPOSIT) {
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
@ -2131,19 +2157,22 @@ if (empty($reshook)) {
$price_min = $datapriceofproduct['price_min'];
$price_min_ttc = $datapriceofproduct['price_min_ttc'];
$price_base_type = $datapriceofproduct['price_base_type'];
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
// Set unit price to use
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif (!empty($price_ttc) || $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} elseif ($tmpvat != $tmpprodvat) {
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
// Is this still used ?
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
@ -2231,7 +2260,7 @@ if (empty($reshook)) {
$fk_unit = $prod->fk_unit;
} else {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$pu_ttc = price2num($price_ttc, 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
if (empty($tva_tx)) {
@ -2243,6 +2272,10 @@ if (empty($reshook)) {
$fk_unit = GETPOST('units', 'alpha');
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
if ($pu_ttc && !$pu_ht) {
$price_base_type = 'TTC';
}
}
// Margin
@ -2381,12 +2414,14 @@ if (empty($reshook)) {
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml'));
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$vat_rate = str_replace('*', '', $vat_rate);
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
$pu_ttc = price2num(GETPOST('price_ttc'), '', 2);
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
//$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$qty = GETPOST('qty');
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
// Define info_bits
$info_bits = 0;
@ -2495,8 +2530,8 @@ if (empty($reshook)) {
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
$error++;
}
if ((empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && (($pu_ht_devise < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht_devise == '') && $pu_ttc === '' && $pu_ttc_devise === '' && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
if (($pu_ht < 0 || $pu_ttc < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
$langs->load("errors");
if ($object->type == $object::TYPE_DEPOSIT) {
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
@ -2524,10 +2559,17 @@ if (empty($reshook)) {
}
}
$price_base_type = 'HT';
$pu = $pu_ht;
if (empty($pu) && ! empty($pu_ttc)) {
$pu = $pu_ttc;
$price_base_type = 'TTC';
}
$result = $object->updateline(
GETPOST('lineid', 'int'),
$description,
$pu_ht,
$pu,
$qty,
$remise_percent,
$date_start,
@ -2535,7 +2577,7 @@ if (empty($reshook)) {
$vat_rate,
$localtax1_rate,
$localtax2_rate,
'HT',
$price_base_type,
$info_bits,
$type,
GETPOST('fk_parent_line', 'int'),
@ -5318,10 +5360,15 @@ if ($action == 'create') {
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
}
// Lines
// Get object lines
$result = $object->getLinesArray();
// Show global modifiers
// Add products/services form
//$forceall = 1;
global $inputalsopricewithtax;
$inputalsopricewithtax = 1;
// Show global modifiers for situation invoices
if (!empty($conf->global->INVOICE_USE_SITUATION)) {
if ($object->situation_cycle_ref && $object->statut == 0) {
print '<!-- Area to change globally the situation percent -->'."\n";
@ -5363,7 +5410,7 @@ if ($action == 'create') {
}
}
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">

View File

@ -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;

View File

@ -396,11 +396,28 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$price_ht = '';
$price_ht_devise = '';
$price_ttc = '';
$price_ttc_devise = '';
if (GETPOST('price_ht') !== '') {
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ht') !== '') {
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
}
if (GETPOST('price_ttc') !== '') {
$price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2);
}
if (GETPOST('multicurrency_price_ttc') !== '') {
$price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2);
}
if (GETPOST('prod_entry_mode', 'alpha') == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
$tva_tx = (GETPOST('tva_tx', 'alpha') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx', 'alpha'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
@ -408,6 +425,9 @@ if (empty($reshook)) {
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
if ($qty == '') {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
@ -460,6 +480,7 @@ if (empty($reshook)) {
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
$price_min_ttc = $prod->price_min_ttc;
$price_base_type = $prod->price_base_type;
// On defini prix unitaire
@ -467,8 +488,10 @@ if (empty($reshook)) {
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_min_ttc = $prod->multiprices_min_ttc[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// If price per customer
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
@ -478,10 +501,12 @@ if (empty($reshook)) {
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result) {
if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$tva_tx = $prodcustprice->lines [0]->tva_tx;
$pu_ht = price($prodcustprice->lines[0]->price);
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_min = price($prodcustprice->lines[0]->price_min);
$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
}
@ -496,9 +521,15 @@ if (empty($reshook)) {
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tmpvat != $tmpprodvat) {
// Set unit price to use
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif (!empty($price_ttc) || $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} elseif ($tmpvat != $tmpprodvat) {
// Is this still used ?
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
@ -521,12 +552,22 @@ if (empty($reshook)) {
$fk_unit = $prod->fk_unit;
} else {
$pu_ht = GETPOST('price_ht');
$price_base_type = 'HT';
$tva_tx = GETPOST('tva_tx') ?str_replace('*', '', GETPOST('tva_tx')) : 0; // tva_tx field may be disabled, so we use vat rate 0
$tva_npr = preg_match('/\*/', GETPOST('tva_tx')) ? 1 : 0;
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($price_ttc, 'MU');
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
if (empty($tva_tx)) {
$tva_npr = 0;
}
$tva_tx = str_replace('*', '', $tva_tx);
$desc = $product_desc;
$fk_unit = GETPOST('units', 'alpha');
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ttc_devise = price2num($price_ttc_devise, 'MU');
$price_base_type = 'HT';
if ($pu_ttc && !$pu_ht) {
$price_base_type = 'TTC';
}
}
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
@ -1427,6 +1468,11 @@ if ($action == 'create') {
* Lines of contracts
*/
// Add products/services form
//$forceall = 1;
global $inputalsopricewithtax;
$inputalsopricewithtax = 1;
$productstatic = new Product($db);
$usemargins = 0;

View File

@ -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);

View File

@ -691,11 +691,11 @@ class CMailFile
}
$keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER';
$keyforsmtpauthtype = "MAIN_MAIL_SMTPS_AUTH_TYPE";
$keyforsmtpoauthservice = "MAIN_MAIL_SMTPS_OAUTH_SERVICE";
$keyforsmtpport = 'MAIN_MAIL_SMTP_PORT';
$keyforsmtpid = 'MAIN_MAIL_SMTPS_ID';
$keyforsmtppw = 'MAIN_MAIL_SMTPS_PW';
$keyforsmtpauthtype = 'MAIN_MAIL_SMTPS_AUTH_TYPE';
$keyforsmtpoauthservice = 'MAIN_MAIL_SMTPS_OAUTH_SERVICE';
$keyfortls = 'MAIN_MAIL_EMAIL_TLS';
$keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS';
$keyforsslseflsigned = 'MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED';
@ -708,6 +708,8 @@ class CMailFile
$keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_'.$smtpContextKey;
$keyforsmtpid = 'MAIN_MAIL_SMTPS_ID_'.$smtpContextKey;
$keyforsmtppw = 'MAIN_MAIL_SMTPS_PW_'.$smtpContextKey;
$keyforsmtpauthtype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_'.$smtpContextKey;
$keyforsmtpoauthservice = 'MAIN_MAIL_SMTPS_OAUTH_SERVICE_'.$smtpContextKey;
$keyfortls = 'MAIN_MAIL_EMAIL_TLS_'.$smtpContextKey;
$keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_'.$smtpContextKey;
$keyforsslseflsigned = 'MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_'.$smtpContextKey;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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 {
@ -6470,8 +6470,8 @@ class Form
} elseif ($usecalendar == 'jquery') {
if (!$disabled) {
// Output javascript for datepicker
$minYear = $conf->global->MIN_YEAR_SELECT_DATE ? $conf->global->MIN_YEAR_SELECT_DATE : (date('Y') - 100);
$maxYear = $conf->global->MAX_YEAR_SELECT_DATE ? $conf->global->MAX_YEAR_SELECT_DATE : (date('Y') + 100);
$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (date('Y') - 100));
$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (date('Y') + 100));
$retstring .= "<script type='text/javascript'>";
$retstring .= "$(function(){ $('#".$prefix."').datepicker({
@ -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.")";
}

View File

@ -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

View File

@ -1334,4 +1334,74 @@ class Utils
return $result;
}
}
/**
* Clean unfinished cronjob in processing when pid is no longer present in the system
* CAN BE A CRON TASK
*
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
* @throws Exception
*/
public function cleanUnfinishedCronjob()
{
global $db, $user;
dol_syslog("Utils::cleanUnfinishedCronjob Starting cleaning");
// Import Cronjob class if not present
dol_include_once('/cron/class/cronjob.class.php');
// Get this job object
$this_job = new Cronjob($db);
$this_job->fetch(-1, 'Utils', 'cleanUnfinishedCronjob');
if (empty($this_job->id) || !empty($this_job->error)) {
dol_syslog("Utils::cleanUnfinishedCronjob Unable to fetch himself: ".$this_job->error, LOG_ERR);
return -1;
}
// Set this job processing to 0 to avoid being locked by his processing state
$this_job->processing = 0;
if ($this_job->update($user) < 0) {
dol_syslog("Utils::cleanUnfinishedCronjob Unable to update himself: ".implode(', ', $this_job->errors), LOG_ERR);
return -1;
}
$cron_job = new Cronjob($db);
$cron_job->fetchAll('DESC', 't.rowid', 100, 0, 1, '', 1); // Fetch jobs that are currently running
// Iterate over all jobs in processing (this can't be this job since his state is set to 0 before)
foreach ($cron_job->lines as $job_line) {
// Avoid job with no PID
if (empty($job_line->pid)) {
dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." don't have a PID", LOG_DEBUG);
continue;
}
$job = new Cronjob($db);
$job->fetch($job_line->id);
if (empty($job->id) || !empty($job->error)) {
dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." can't be fetch: ".$job->error, LOG_ERR);
continue;
}
// Calling posix_kill with the 0 kill signal will return true if the process is running, false otherwise.
if (! posix_kill($job->pid, 0)) {
// Clean processing and pid values
$job->processing = 0;
$job->pid = null;
// Set last result as an error and add the reason on the last output
$job->lastresult = -1;
$job->lastoutput = 'Job killed by job cleanUnfinishedCronjob';
if ($job->update($user) < 0) {
dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." can't be updated: ".implode(', ', $job->errors), LOG_ERR);
continue;
}
dol_syslog("Utils::cleanUnfinishedCronjob Cronjob ".$job_line->id." cleaned");
}
}
dol_syslog("Utils::cleanUnfinishedCronjob Cleaning completed");
return 0;
}
}

View File

@ -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;

View File

@ -432,8 +432,8 @@ function GETPOSTISSET($paramname)
* Can be used before GETPOST to know if the $check param of GETPOST need to check an array or a string
*
* @param string $paramname Name or parameter to test
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
* @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
* @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty)
*/
function GETPOSTISARRAY($paramname, $method = 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)) {

View File

@ -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
}

View File

@ -1181,6 +1181,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$pdf->SetAutoPageBreak(1, 0); // Restore pagebreak
}
if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak
if ($line) { // Free text
$pdf->SetXY($dims['lm'], -$posy);
if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { // by default
@ -1190,6 +1191,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
}
$posy -= $freetextheight;
}
if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak
$pdf->SetY(-$posy);
@ -1199,16 +1201,15 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
}
// Option for set top margin height of footer after freetext
if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalString('PDF_FOOTER_TOP_MARGIN') === '0') {
// TODO Remove this case. Height should be good automatically, only $posy-- should be required.
$posy -= getDolGlobalInt('PDF_FOOTER_TOP_MARGIN');
if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalInt('PDF_FOOTER_TOP_MARGIN') === 0) {
$posy -= floatval(getDolGlobalString('PDF_FOOTER_TOP_MARGIN'));
} else {
$posy--;
}
if (getDolGlobalString('PDF_FOOTER_DISABLE_PAGEBREAK') === '1') { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak
if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak
$pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $mycustomfooterheight, $dims['lm'], $dims['hk'] - $posy, dol_htmlentitiesbr($mycustomfooter, 1, 'UTF-8', 0));
if (getDolGlobalString('PDF_FOOTER_DISABLE_PAGEBREAK') === '1') { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak
if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak
$posy -= $mycustomfooterheight - 3;
} else {
@ -1224,6 +1225,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$pdf->SetAutoPageBreak(1, 0); // Restore pagebreak
}
if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak
if ($line) { // Free text
$pdf->SetXY($dims['lm'], -$posy);
if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { // by default
@ -1233,6 +1235,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
}
$posy -= $freetextheight;
}
if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak
$pdf->SetY(-$posy);
@ -1242,9 +1245,8 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
}
// Option for set top margin height of footer after freetext
if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalString('PDF_FOOTER_TOP_MARGIN') === '0') {
// TODO Remove this case. Height should be good automatically, only $posy-- should be required.
$posy -= getDolGlobalString('PDF_FOOTER_TOP_MARGIN');
if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalInt('PDF_FOOTER_TOP_MARGIN') === 0) {
$posy -= floatval(getDolGlobalString('PDF_FOOTER_TOP_MARGIN'));
} else {
$posy--;
}

View File

@ -792,11 +792,11 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename); // We change dbtablename, so we set sharedelement too.
}
// Check permission for object on entity only
if (in_array($feature, $check)) {
// Check permission for objectid on entity only
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).")";
@ -825,7 +825,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
}
$checkonentitydone = 1;
}
if (in_array($feature, $checksoc)) { // We check feature = checksoc
if (in_array($feature, $checksoc) && $objectid > 0) { // We check feature = checksoc. For $objectid = 0, no check
// If external user: Check permission for external users
if ($user->socid > 0) {
if ($user->socid != $objectid) {
@ -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";
@ -850,7 +850,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$checkonentitydone = 1;
}
if (in_array($feature, $checkother)) { // Test on entity + link to thirdparty. Allowed if link is empty (Ex: contacts...).
if (in_array($feature, $checkother) && $objectid > 0) { // Test on entity + link to thirdparty. Allowed if link is empty (Ex: contacts...).
// If external user: Check permission for external users
if ($user->socid > 0) {
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
@ -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";
@ -875,7 +875,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$checkonentitydone = 1;
}
if (in_array($feature, $checkproject)) {
if (in_array($feature, $checkproject) && $objectid > 0) {
if (!empty($conf->project->enabled) && empty($user->rights->projet->all->lire)) {
$projectid = $objectid;
@ -896,7 +896,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$checkonentitydone = 1;
}
if (in_array($feature, $checktask)) {
if (in_array($feature, $checktask) && $objectid > 0) {
if (!empty($conf->project->enabled) && empty($user->rights->projet->all->lire)) {
$task = new Task($db);
$task->fetch($objectid);
@ -919,7 +919,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$checkonentitydone = 1;
}
if (!$checkonentitydone && !in_array($feature, $nocheck)) { // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield
if (!$checkonentitydone && !in_array($feature, $nocheck) && $objectid > 0) { // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield
// If external user: Check permission for external users
if ($user->socid > 0) {
if (empty($dbt_keyfield)) {
@ -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";
@ -962,7 +962,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
//print $sql;
// For events, check on users assigned to event
if ($feature === 'agenda') {
if ($feature === 'agenda' && $objectid > 0) {
// Also check owner or attendee for users without allactions->read
if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -976,7 +976,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
// For some object, we also have to check it is in the user hierarchy
// Param $object must be the full object and not a simple id to have this test possible.
if (in_array($feature, $checkhierarchy) && is_object($object)) {
if (in_array($feature, $checkhierarchy) && is_object($object) && $objectid > 0) {
$childids = $user->getAllChildIds(1);
$useridtocheck = 0;
if ($feature == 'holiday') {

View File

@ -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
}

View File

@ -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) {

View File

@ -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);

View File

@ -1169,7 +1169,7 @@ class pdf_crabe extends ModelePDFFactures
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $object->thirdparty->id);
$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
$lib_mode_reg .= $langs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
$lib_mode_reg .= $outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
}
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');

View File

@ -1278,7 +1278,7 @@ class pdf_sponge extends ModelePDFFactures
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $object->thirdparty->id);
$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
$lib_mode_reg .= $langs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
$lib_mode_reg .= $outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
}
$pdf->MultiCell($posxend - $posxval, 5, $lib_mode_reg, 0, 'L');

View File

@ -115,7 +115,7 @@ class ImportCsv extends ModeleImports
$this->datatoimport = $datatoimport;
if (preg_match('/^societe_/', $datatoimport)) {
$this->thirpartyobject = new Societe($this->db);
$this->thirdpartyobject = new Societe($this->db);
}
}
@ -560,8 +560,8 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codeclient(0, 0);
$newval = $this->thirpartyobject->code_client;
$this->thirdpartyobject->get_codeclient(0, 0);
$newval = $this->thirdpartyobject->code_client;
//print 'code_client='.$newval;
}
if (empty($newval)) {
@ -569,8 +569,8 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto') {
$newval = $this->thirpartyobject->get_codefournisseur(0, 1);
$newval = $this->thirpartyobject->code_fournisseur;
$newval = $this->thirdpartyobject->get_codefournisseur(0, 1);
$newval = $this->thirdpartyobject->code_fournisseur;
//print 'code_fournisseur='.$newval;
}
if (empty($newval)) {
@ -578,8 +578,8 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('customer');
$newval = $this->thirpartyobject->code_compta;
$this->thirdpartyobject->get_codecompta('customer');
$newval = $this->thirdpartyobject->code_compta;
//print 'code_compta='.$newval;
}
if (empty($newval)) {
@ -587,8 +587,8 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('supplier');
$newval = $this->thirpartyobject->code_compta_fournisseur;
$this->thirdpartyobject->get_codecompta('supplier');
$newval = $this->thirdpartyobject->code_compta_fournisseur;
if (empty($newval)) {
$arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
}

View File

@ -133,7 +133,7 @@ class ImportXlsx extends ModeleImports
$this->datatoimport = $datatoimport;
if (preg_match('/^societe_/', $datatoimport)) {
$this->thirpartyobject = new Societe($this->db);
$this->thirdpartyobject = new Societe($this->db);
}
}
@ -604,8 +604,8 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codeclient(0, 0);
$newval = $this->thirpartyobject->code_client;
$this->thirdpartyobject->get_codeclient(0, 0);
$newval = $this->thirdpartyobject->code_client;
//print 'code_client='.$newval;
}
if (empty($newval)) {
@ -613,8 +613,8 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto') {
$newval = $this->thirpartyobject->get_codefournisseur(0, 1);
$newval = $this->thirpartyobject->code_fournisseur;
$newval = $this->thirdpartyobject->get_codefournisseur(0, 1);
$newval = $this->thirdpartyobject->code_fournisseur;
//print 'code_fournisseur='.$newval;
}
if (empty($newval)) {
@ -622,8 +622,8 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('customer');
$newval = $this->thirpartyobject->code_compta;
$this->thirdpartyobject->get_codecompta('customer');
$newval = $this->thirdpartyobject->code_compta;
//print 'code_compta='.$newval;
}
if (empty($newval)) {
@ -631,8 +631,8 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('supplier');
$newval = $this->thirpartyobject->code_compta_fournisseur;
$this->thirdpartyobject->get_codecompta('supplier');
$newval = $this->thirdpartyobject->code_compta_fournisseur;
if (empty($newval)) {
$arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
}

View File

@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2018-2018 Andre Schild <a.schild@aarboard.ch>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
@ -16,6 +17,8 @@
* \brief Example file to provide a list of recipients for mailing module
*/
// Load Dolibarr Environment
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
@ -24,9 +27,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
*/
class mailing_partnership extends MailingTargets
{
public $name = 'PartnershipThirdartiesOrMembers';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
public $name = 'PartnershipThirdpartiesOrMembers';
public $desc = "Thirdparties or members included into a partnership program";
public $require_admin = 0;
public $require_module = array(); // This module allows to select by categories must be also enabled if category module is not activated
@ -52,7 +56,7 @@ class mailing_partnership extends MailingTargets
public function __construct($db)
{
global $conf, $langs;
$langs->load("companies");
$langs->load('companies');
$this->db = $db;
}
@ -218,7 +222,7 @@ class mailing_partnership extends MailingTargets
$num = $this->db->num_rows($resql);
if (empty($conf->partnership->enabled)) {
$num = 0; // Force empty list if category module is not enabled
$num = 0; // Force empty list if category module is not enabled
}
if ($num) {
@ -253,7 +257,7 @@ class mailing_partnership extends MailingTargets
*/
public function url($id, $sourcetype = 'thirdparty')
{
if ($sourcetype == 'thirparty') {
if ($sourcetype == 'thirdparty') {
return '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.((int) $id).'">'.img_object('', "societe").'</a>';
}
if ($sourcetype == 'member') {

View File

@ -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';
}
}

View File

@ -101,6 +101,7 @@ class modCron extends DolibarrModules
0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'tempfilesold+logfiles', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>'in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendDumpDatabase', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
3=>array('entity'=>0, 'label'=>'CleanUnfinishedCronjobShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'cleanUnfinishedCronjob', 'parameters'=>'', 'comment'=>'CleanUnfinishedCronjob', 'frequency'=>5, 'unitfrequency'=>60, 'priority'=>10, 'status'=>0, 'test'=>'getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 2'),
// 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
);

View File

@ -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';
}
}

View File

@ -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');
}
}

View File

@ -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';
}
}

View File

@ -261,7 +261,7 @@ class modRecruitment extends DolibarrModules
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
'mainmenu'=>'hrm',
'leftmenu'=>'recruitmentjobposition',
'url'=>'/recruitment/recruitmentindex.php',
'url'=>'/recruitment/index.php',
'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000 + $r,
'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled.

View File

@ -148,7 +148,7 @@ class modSociete extends DolibarrModules
$this->rights[$r][1] = 'Read thirdparties customers';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'thirparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'thirdparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'read';
$r++;
@ -172,7 +172,7 @@ class modSociete extends DolibarrModules
$this->rights[$r][1] = 'Create thirdparties customers';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'thirparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'thirdparty_customer_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'read';
$r++;
@ -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';

View File

@ -98,8 +98,8 @@ class modGeneratePassPerso extends ModeleGenPassword
$this->user = $user;
if (empty($conf->global->USER_PASSWORD_PATTERN)) {
// default value at auto generation (12 chars, 1 upercase, 1 digit, 1 special char, 3 repeat, exclude ambiguous characters).
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '12;1;1;1;3;1', 'chaine', 0, '', $conf->entity);
// default value at auto generation (12 chars, 1 uppercase, 1 digit, 0 special char, 3 repeat max, exclude ambiguous characters).
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '12;1;1;0;3;1', 'chaine', 0, '', $conf->entity);
}
$this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

View File

@ -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>';

View File

@ -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 } ?>

View File

@ -197,9 +197,10 @@ $typewecanchangeinto = array(
'text'=>array('text', 'html'),
'html'=>array('text', 'html'),
'password'=>array('password', 'varchar'),
'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'url'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'mail'=>array('ip', 'varchar', 'phone', 'mail', 'url', 'select'),
'url'=>array('ip', 'varchar', 'phone', 'mail', 'url', 'select'),
'phone'=>array('ip', 'varchar', 'phone', 'mail', 'url', 'select'),
'ip'=>array('ip', 'varchar', 'phone', 'mail', 'url', 'select'),
'select'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'date'=>array('date', 'datetime')
);
@ -295,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 } ?>

View File

@ -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">&nbsp;</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++;
}

View File

@ -146,6 +146,11 @@ if ($action == 'presend') {
$formmail->fromname = (!empty($conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME) ? $conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME : '');
$formmail->fromtype = 'special';
}
if ($object->element === 'recruitmentcandidature' ) {
$formmail->frommail = (!empty($conf->global->RECRUITMENT_EMAIL_SENDER) ? $conf->global->RECRUITMENT_EMAIL_SENDER : $recruitermail);
$formmail->fromname = (!empty($conf->global->RECRUITMENT_EMAIL_SENDER_NAME) ? $conf->global->RECRUITMENT_EMAIL_SENDER_NAME : (!empty($recruitername) ? $recruitername : ''));
$formmail->fromtype = 'special';
}
$formmail->trackid = empty($trackid) ? '' : $trackid;
$formmail->inreplyto = empty($inreplyto) ? '' : $inreplyto;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -325,8 +325,8 @@ $coldisplay++;
<!-- colspan for this td because it replace total_ht+3 td for buttons+... -->
<td class="center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay += $colspan; ?>
<input type="submit" class="button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
<input type="submit" class="reposition button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="reposition button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td>
</tr>

View File

@ -987,7 +987,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
*/
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
// Add entry in event table
$now = dol_now();

View File

@ -69,7 +69,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
return 1;
}
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$b = new BlockedLog($this->db);

View File

@ -74,7 +74,7 @@ class InterfaceNotification extends DolibarrTriggers
return 0;
}
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
$notify = new Notify($this->db);
$notify->send($action, $object);

View File

@ -70,7 +70,7 @@ class InterfaceContactRoles extends DolibarrTriggers
if ($action === 'PROPAL_CREATE' || $action === 'ORDER_CREATE' || $action === 'BILL_CREATE'
|| $action === 'ORDER_SUPPLIER_CREATE' || $action === 'BILL_SUPPLIER_CREATE' || $action === 'PROPOSAL_SUPPLIER_CREATE'
|| $action === 'CONTRACT_CREATE' || $action === 'FICHINTER_CREATE' || $action === 'PROJECT_CREATE' || $action === 'TICKET_CREATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
$socid = (property_exists($object, 'socid') ? $object->socid : $object->fk_soc);

View File

@ -396,7 +396,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
// case 'SHIPPING_DELETE':
}
if ($logtriggeraction) {
dol_syslog("Trigger '".$this->name."' for action '.$action.' launched by ".__FILE__." id=".$object->id);
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__." id=".$object->id);
}
return 0;
}
@ -404,14 +404,20 @@ class InterfaceZapierTriggers extends DolibarrTriggers
/**
* Post webhook in zapier with object data
*
* @param string $url url provided by zapier
* @param string $json data to send
* @param string $url Url provided by zapier
* @param string $json Data to send
* @return void
*/
function zapierPostWebhook($url, $json)
{
$headers = array('Accept: application/json', 'Content-Type: application/json');
// TODO supprimer le webhook en cas de mauvaise réponse
// TODO disable wekhook if error ?
dol_syslog("Send message to Zapier with json size=".dol_strlen($json), LOG_DEBUG);
getURLContent($url, 'POSTALREADYFORMATED', $json, 1, $headers, array('http', 'https'), 0);
/*
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@ -420,8 +426,10 @@ function zapierPostWebhook($url, $json)
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec($ch);
curl_close($ch);
*/
}
/**

View File

@ -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)) {

View File

@ -1140,7 +1140,7 @@ class Cronjob extends CommonObject
$this->lastoutput = '';
$this->lastresult = '';
$this->processing = 1; // To know job was started
$this->pid = dol_getmypid();
$this->pid = function_exists('getmypid') ? getmypid() : null; // Avoid dol_getmypid to get null if the function is not available
$this->nbrun = $this->nbrun + 1;
$result = $this->update($user); // This include begin/commit
if ($result < 0) {

View File

@ -49,7 +49,7 @@ if (!empty($conf->project->enabled)) {
}
// Load translation files required by the page
$langs->loadLangs(array("sendings", "bills", 'deliveries', 'orders'));
$langs->loadLangs(array('bills', 'deliveries', 'orders', 'sendings'));
if (!empty($conf->incoterm->enabled)) {
$langs->load('incoterm');
@ -89,10 +89,10 @@ $error = 0;
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Delete Link
$permissiondellink = $user->rights->expedition->delivery->supprimer; // Used by the include of actions_dellink.inc.php
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
if ($action == 'add') {
$db->begin();
@ -101,7 +101,7 @@ if ($action == 'add') {
$object->note = GETPOST("note", 'restricthtml');
$object->note_private = GETPOST("note", 'restricthtml');
$object->commande_id = GETPOST("commande_id", 'int');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) {
$expedition->entrepot_id = GETPOST('entrepot_id', 'int');

View File

@ -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) {

View File

@ -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;
}
@ -1582,7 +1582,9 @@ class EmailCollector extends CommonObject
$plainmsg = $imapemail->getTextBody();
}
if ($imapemail->hasAttachments()) {
$attachments = $imapemail->getAttachments();
$attachments = $imapemail->getAttachments()->all();
} else {
$attachments = [];
}
} else {
$this->getmsg($connection, $imapemail);
@ -2440,6 +2442,20 @@ class EmailCollector extends CommonObject
$errorforactions++;
$this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error);
$this->errors = $projecttocreate->errors;
} else {
if ($attachments) {
$destdir = $conf->project->dir_output.'/'.$projecttocreate->ref;
if (!dol_is_dir($destdir)) {
dol_mkdir($destdir);
}
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
foreach ($attachments as $attachment) {
$attachment->save($destdir.'/');
}
} else {
$this->getmsg($connection, $imapemail, $destdir);
}
}
}
}
}
@ -2550,13 +2566,16 @@ class EmailCollector extends CommonObject
$this->errors = $tickettocreate->errors;
} else {
if ($attachments) {
$destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref;
if (!dol_is_dir($destdir)) {
dol_mkdir($destdir);
}
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
$destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref;
if (!dol_is_dir($destdir)) {
return -1;
dol_mkdir($destdir);
$this->getmsg($connection, $imapemail, $destdir);
foreach ($attachments as $attachment) {
$attachment->save($destdir.'/');
}
} else {
$this->getmsg($connection, $imapemail, $destdir);
}
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -35,8 +35,9 @@ require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_confere
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "projects", "companies", "other", "mails"));
$langs->loadLangs(array('companies', 'eventorganization', 'mails', 'others', 'projects'));
// Variables GET
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
@ -51,12 +52,14 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$withproject = GETPOST('withproject', 'int');
// Initialize technical objects
$object = new ConferenceOrBooth($db);
$extrafields = new ExtraFields($db);
$projectstatic = new Project($db);
$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('conferenceorboothcontact', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
@ -69,6 +72,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
if ($user->socid > 0) {
accessforbidden();
}
$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);

View File

@ -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';

View File

@ -1959,7 +1959,7 @@ class CommandeFournisseur extends CommonOrder
$this->line->total_localtax2 = $total_localtax2;
$this->line->total_ttc = $total_ttc;
$this->line->product_type = $type;
$this->line->special_code = $special_code;
$this->line->special_code = (!empty($this->special_code) ? $this->special_code : 0);
$this->line->origin = $origin;
$this->line->origin_id = $origin_id;
$this->line->fk_unit = $fk_unit;
@ -2858,7 +2858,7 @@ class CommandeFournisseur extends CommonOrder
$this->line->total_localtax2 = $total_localtax2;
$this->line->total_ttc = $total_ttc;
$this->line->product_type = $type;
$this->line->special_code = $this->special_code;
$this->line->special_code = (!empty($this->special_code) ? $this->special_code : 0);
$this->line->origin = $this->origin;
$this->line->fk_unit = $fk_unit;

View File

@ -669,11 +669,10 @@ if (empty($reshook)) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
$newlang = '';
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
if (GETPOST('lang_id', 'aZ09'))
$newlang = GETPOST('lang_id', 'aZ09');
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);

View File

@ -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')."))";

View File

@ -120,7 +120,7 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
if (is_array(GETPOST('search_status', 'none'))) { // 'none' because we want to know type before sanitizing
if (GETPOSTISARRAY('search_status')) {
$search_status = join(',', GETPOST('search_status', 'array:intcomma'));
} else {
$search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma'));

View File

@ -284,7 +284,7 @@ if (empty($reshook)) {
}
}
// If this is an update and we are an approver, we can update to change the approver
// If this is an update and we are an approver, we can update to change the expected approver with another one (including himself)
if ($action == 'update' && GETPOSTISSET('savevalidator') && !empty($user->rights->holiday->approve)) {
$object->fetch($id);
@ -558,9 +558,10 @@ if (empty($reshook)) {
if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) {
$object->oldcopy = dol_clone($object);
$object->date_valid = dol_now();
$object->fk_user_valid = $user->id;
$object->date_approval = dol_now();
$object->fk_user_approve = $user->id;
$object->statut = Holiday::STATUS_APPROVED;
$object->status = Holiday::STATUS_APPROVED;
$db->begin();
@ -663,6 +664,7 @@ if (empty($reshook)) {
$object->date_refuse = dol_print_date('dayhour', dol_now());
$object->fk_user_refuse = $user->id;
$object->statut = Holiday::STATUS_REFUSED;
$object->status = Holiday::STATUS_REFUSED;
$object->detail_refuse = GETPOST('detail_refuse', 'alphanohtml');
$db->begin();
@ -751,6 +753,7 @@ if (empty($reshook)) {
$oldstatus = $object->statut;
$object->statut = Holiday::STATUS_DRAFT;
$object->status = Holiday::STATUS_DRAFT;
$result = $object->update($user);
if ($result < 0) {
@ -783,6 +786,7 @@ if (empty($reshook)) {
$object->date_cancel = dol_now();
$object->fk_user_cancel = $user->id;
$object->statut = Holiday::STATUS_CANCELED;
$object->status = Holiday::STATUS_CANCELED;
$result = $object->update($user);
@ -1497,8 +1501,8 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
}
}
if ($object->statut == Holiday::STATUS_APPROVED) { // If validated and approved
if ($user->id == $object->fk_validator || $cancreate || $cancreateall) {
if (($object->date_debut > dol_now()) || !empty($user->admin)) {
if ($user->id == $object->fk_validator || $user->id == $object->fk_user_approve || $cancreate || $cancreateall) {
if (($object->date_debut > dol_now()) || !empty($user->admin) || $user->id == $object->fk_user_approve) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
} else {
print '<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans("HolidayStarted").'-'.$langs->trans("NotAllowed").'">'.$langs->trans("ActionCancelCP").'</a>';

View File

@ -59,12 +59,6 @@ class Holiday extends CommonObject
*/
public $picto = 'holiday';
/**
* @deprecated
* @see $id
*/
public $rowid;
/**
* @var int User ID
*/
@ -95,14 +89,19 @@ class Holiday extends CommonObject
public $date_valid = '';
/**
* @var int ID of user that has approved (empty if not approved)
* @var int ID of user that has validated
*/
public $fk_user_valid;
/**
* @var int Date approbation
* @var int Date approval
*/
public $date_approbation;
public $date_approval;
/**
* @var int ID of user that has approved
*/
public $fk_user_approve;
/**
* @var int Date for refuse
@ -383,6 +382,8 @@ class Holiday extends CommonObject
$sql .= " cp.fk_validator,";
$sql .= " cp.date_valid,";
$sql .= " cp.fk_user_valid,";
$sql .= " cp.date_approval,";
$sql .= " cp.fk_user_approve,";
$sql .= " cp.date_refuse,";
$sql .= " cp.fk_user_refuse,";
$sql .= " cp.date_cancel,";
@ -420,6 +421,8 @@ class Holiday extends CommonObject
$this->fk_validator = $obj->fk_validator;
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->fk_user_valid = $obj->fk_user_valid;
$this->date_approval = $this->db->jdate($obj->date_approval);
$this->fk_user_approve = $obj->fk_user_approve;
$this->date_refuse = $this->db->jdate($obj->date_refuse);
$this->fk_user_refuse = $obj->fk_user_refuse;
$this->date_cancel = $this->db->jdate($obj->date_cancel);
@ -473,6 +476,8 @@ class Holiday extends CommonObject
$sql .= " cp.fk_validator,";
$sql .= " cp.date_valid,";
$sql .= " cp.fk_user_valid,";
$sql .= " cp.date_approval,";
$sql .= " cp.fk_user_approve,";
$sql .= " cp.date_refuse,";
$sql .= " cp.fk_user_refuse,";
$sql .= " cp.date_cancel,";
@ -525,6 +530,7 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid;
$tab_result[$i]['id'] = $obj->rowid;
$tab_result[$i]['ref'] = ($obj->ref ? $obj->ref : $obj->rowid);
$tab_result[$i]['fk_user'] = $obj->fk_user;
@ -540,6 +546,8 @@ class Holiday extends CommonObject
$tab_result[$i]['fk_validator'] = $obj->fk_validator;
$tab_result[$i]['date_valid'] = $this->db->jdate($obj->date_valid);
$tab_result[$i]['fk_user_valid'] = $obj->fk_user_valid;
$tab_result[$i]['date_approval'] = $this->db->jdate($obj->date_approval);
$tab_result[$i]['fk_user_approve'] = $obj->fk_user_approve;
$tab_result[$i]['date_refuse'] = $this->db->jdate($obj->date_refuse);
$tab_result[$i]['fk_user_refuse'] = $obj->fk_user_refuse;
$tab_result[$i]['date_cancel'] = $this->db->jdate($obj->date_cancel);
@ -598,6 +606,8 @@ class Holiday extends CommonObject
$sql .= " cp.fk_validator,";
$sql .= " cp.date_valid,";
$sql .= " cp.fk_user_valid,";
$sql .= " cp.date_approval,";
$sql .= " cp.fk_user_approve,";
$sql .= " cp.date_refuse,";
$sql .= " cp.fk_user_refuse,";
$sql .= " cp.date_cancel,";
@ -649,7 +659,9 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid;
$tab_result[$i]['id'] = $obj->rowid;
$tab_result[$i]['ref'] = ($obj->ref ? $obj->ref : $obj->rowid);
$tab_result[$i]['fk_user'] = $obj->fk_user;
$tab_result[$i]['fk_type'] = $obj->fk_type;
$tab_result[$i]['date_create'] = $this->db->jdate($obj->date_create);
@ -664,6 +676,8 @@ class Holiday extends CommonObject
$tab_result[$i]['fk_validator'] = $obj->fk_validator;
$tab_result[$i]['date_valid'] = $this->db->jdate($obj->date_valid);
$tab_result[$i]['fk_user_valid'] = $obj->fk_user_valid;
$tab_result[$i]['date_approval'] = $this->db->jdate($obj->date_approval);
$tab_result[$i]['fk_user_approve'] = $obj->fk_user_approve;
$tab_result[$i]['date_refuse'] = $obj->date_refuse;
$tab_result[$i]['fk_user_refuse'] = $obj->fk_user_refuse;
$tab_result[$i]['date_cancel'] = $obj->date_cancel;
@ -868,6 +882,16 @@ class Holiday extends CommonObject
} else {
$sql .= " fk_user_valid = NULL,";
}
if (!empty($this->date_approval)) {
$sql .= " date_approval = '".$this->db->idate($this->date_approval)."',";
} else {
$sql .= " date_approval = NULL,";
}
if (!empty($this->fk_user_approve)) {
$sql .= " fk_user_approve = '".$this->db->escape($this->fk_user_approve)."',";
} else {
$sql .= " fk_user_approve = NULL,";
}
if (!empty($this->date_refuse)) {
$sql .= " date_refuse = '".$this->db->idate($this->date_refuse)."',";
} else {
@ -983,17 +1007,27 @@ class Holiday extends CommonObject
$sql .= " date_valid = NULL,";
}
if (!empty($this->fk_user_valid)) {
$sql .= " fk_user_valid = '".$this->db->escape($this->fk_user_valid)."',";
$sql .= " fk_user_valid = ".((int) $this->fk_user_valid).",";
} else {
$sql .= " fk_user_valid = NULL,";
}
if (!empty($this->date_approval)) {
$sql .= " date_approval = '".$this->db->idate($this->date_approval)."',";
} else {
$sql .= " date_approval = NULL,";
}
if (!empty($this->fk_user_approve)) {
$sql .= " fk_user_approve = ".((int) $this->fk_user_approve).",";
} else {
$sql .= " fk_user_approve = NULL,";
}
if (!empty($this->date_refuse)) {
$sql .= " date_refuse = '".$this->db->idate($this->date_refuse)."',";
} else {
$sql .= " date_refuse = NULL,";
}
if (!empty($this->fk_user_refuse)) {
$sql .= " fk_user_refuse = '".$this->db->escape($this->fk_user_refuse)."',";
$sql .= " fk_user_refuse = ".((int) $this->fk_user_refuse).",";
} else {
$sql .= " fk_user_refuse = NULL,";
}
@ -1003,7 +1037,7 @@ class Holiday extends CommonObject
$sql .= " date_cancel = NULL,";
}
if (!empty($this->fk_user_cancel)) {
$sql .= " fk_user_cancel = '".$this->db->escape($this->fk_user_cancel)."',";
$sql .= " fk_user_cancel = ".((int) $this->fk_user_cancel).",";
} else {
$sql .= " fk_user_cancel = NULL,";
}
@ -1731,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')."))";
@ -1821,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')."))";
@ -1855,6 +1889,7 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid; // rowid of user
$tab_result[$i]['id'] = $obj->rowid; // id of user
$tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname;
@ -1897,6 +1932,7 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid; // rowid of user
$tab_result[$i]['id'] = $obj->rowid; // id of user
$tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname;
@ -2131,6 +2167,7 @@ class Holiday extends CommonObject
$obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid;
$tab_result[$i]['id'] = $obj->rowid;
$tab_result[$i]['date_action'] = $obj->date_action;
$tab_result[$i]['fk_user_action'] = $obj->fk_user_action;
$tab_result[$i]['fk_user_update'] = $obj->fk_user_update;
@ -2179,7 +2216,7 @@ class Holiday extends CommonObject
$num = $this->db->num_rows($result);
if ($num) {
while ($obj = $this->db->fetch_object($result)) {
$types[$obj->rowid] = array('rowid'=> $obj->rowid, 'code'=> $obj->code, 'label'=>$obj->label, 'affect'=>$obj->affect, 'delay'=>$obj->delay, 'newbymonth'=>$obj->newbymonth);
$types[$obj->rowid] = array('id'=> $obj->rowid, 'rowid'=> $obj->rowid, 'code'=> $obj->code, 'label'=>$obj->label, 'affect'=>$obj->affect, 'delay'=>$obj->delay, 'newbymonth'=>$obj->newbymonth);
}
return $types;
@ -2206,12 +2243,13 @@ class Holiday extends CommonObject
$sql .= " f.date_create as datec,";
$sql .= " f.tms as date_modification,";
$sql .= " f.date_valid as datev,";
$sql .= " f.date_approve as datea,";
$sql .= " f.date_approval as datea,";
$sql .= " f.date_refuse as dater,";
$sql .= " f.fk_user_create as fk_user_creation,";
$sql .= " f.fk_user_modif as fk_user_modification,";
$sql .= " f.fk_user_valid as fk_user_approve_done,";
$sql .= " f.fk_validator as fk_user_approve_expected,";
$sql .= " f.fk_user_valid as fk_user_validation,";
$sql .= " f.fk_user_approve as fk_user_approval_done,";
$sql .= " f.fk_validator as fk_user_approval_expected,";
$sql .= " f.fk_user_refuse as fk_user_refuse";
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as f";
$sql .= " WHERE f.rowid = ".((int) $id);
@ -2227,16 +2265,16 @@ class Holiday extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_approbation = $this->db->jdate($obj->datea);
$this->date_approval = $this->db->jdate($obj->datea);
if (!empty($obj->fk_user_creation)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creation);
$this->user_creation = $cuser;
}
if (!empty($obj->fk_user_approve_done)) {
if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_approve_done);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if (!empty($obj->fk_user_modification)) {
@ -2246,15 +2284,15 @@ class Holiday extends CommonObject
}
if ($obj->status == Holiday::STATUS_APPROVED || $obj->status == Holiday::STATUS_CANCELED) {
if ($obj->fk_user_approve_done) {
if ($obj->fk_user_approval_done) {
$auser = new User($this->db);
$auser->fetch($obj->fk_user_approve_done);
$auser->fetch($obj->fk_user_approval_done);
$this->user_approve = $auser;
}
} else {
if (!empty($obj->fk_user_approve_expected)) {
if (!empty($obj->fk_user_approval_expected)) {
$auser = new User($this->db);
$auser->fetch($obj->fk_user_approve_expected);
$auser->fetch($obj->fk_user_approval_expected);
$this->user_approve = $auser;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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>';

View File

@ -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"');

View File

@ -13,4 +13,5 @@
./vendor/phpdocumentor
./vendor/nesbot/carbon/src/Carbon/Lang
./vendor/doctrine
./vendor/bin
./tests

View File

@ -16,24 +16,24 @@ class ComposerStaticInit4da13270269c89a28e472e1f7324e6d1
);
public static $prefixLengthsPsr4 = array (
'v' =>
'v' =>
array (
'voku\\' => 5,
),
'p' =>
'p' =>
array (
'phpDocumentor\\Reflection\\' => 25,
),
'W' =>
'W' =>
array (
'Webmozart\\Assert\\' => 17,
'Webklex\\PHPIMAP\\' => 16,
),
'T' =>
'T' =>
array (
'Tests\\' => 6,
// 'Tests\\' => 6,
),
'S' =>
'S' =>
array (
'Symfony\\Polyfill\\Php80\\' => 23,
'Symfony\\Polyfill\\Mbstring\\' => 26,
@ -43,115 +43,115 @@ class ComposerStaticInit4da13270269c89a28e472e1f7324e6d1
'Symfony\\Component\\Translation\\' => 30,
'Symfony\\Component\\HttpFoundation\\' => 33,
),
'P' =>
'P' =>
array (
'Psr\\SimpleCache\\' => 16,
'Psr\\Container\\' => 14,
'Prophecy\\' => 9,
),
'I' =>
'I' =>
array (
'Illuminate\\Support\\' => 19,
'Illuminate\\Pagination\\' => 22,
'Illuminate\\Contracts\\' => 21,
),
'D' =>
'D' =>
array (
'Doctrine\\Instantiator\\' => 22,
'Doctrine\\Inflector\\' => 19,
),
'C' =>
'C' =>
array (
'Carbon\\' => 7,
),
);
public static $prefixDirsPsr4 = array (
'voku\\' =>
'voku\\' =>
array (
0 => __DIR__ . '/..' . '/voku/portable-ascii/src/voku',
),
'phpDocumentor\\Reflection\\' =>
'phpDocumentor\\Reflection\\' =>
array (
0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src',
1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
2 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
),
'Webmozart\\Assert\\' =>
'Webmozart\\Assert\\' =>
array (
0 => __DIR__ . '/..' . '/webmozart/assert/src',
),
'Webklex\\PHPIMAP\\' =>
'Webklex\\PHPIMAP\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
'Tests\\' =>
'Tests\\' =>
array (
0 => __DIR__ . '/../..' . '/tests',
),
'Symfony\\Polyfill\\Php80\\' =>
'Symfony\\Polyfill\\Php80\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
),
'Symfony\\Polyfill\\Mbstring\\' =>
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Ctype\\' =>
'Symfony\\Polyfill\\Ctype\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
),
'Symfony\\Contracts\\Translation\\' =>
'Symfony\\Contracts\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation-contracts',
),
'Symfony\\Component\\Yaml\\' =>
'Symfony\\Component\\Yaml\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/yaml',
),
'Symfony\\Component\\Translation\\' =>
'Symfony\\Component\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation',
),
'Symfony\\Component\\HttpFoundation\\' =>
'Symfony\\Component\\HttpFoundation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/http-foundation',
),
'Psr\\SimpleCache\\' =>
'Psr\\SimpleCache\\' =>
array (
0 => __DIR__ . '/..' . '/psr/simple-cache/src',
),
'Psr\\Container\\' =>
'Psr\\Container\\' =>
array (
0 => __DIR__ . '/..' . '/psr/container/src',
),
'Prophecy\\' =>
'Prophecy\\' =>
array (
0 => __DIR__ . '/..' . '/phpspec/prophecy/src/Prophecy',
),
'Illuminate\\Support\\' =>
'Illuminate\\Support\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/macroable',
1 => __DIR__ . '/..' . '/illuminate/collections',
2 => __DIR__ . '/..' . '/illuminate/support',
),
'Illuminate\\Pagination\\' =>
'Illuminate\\Pagination\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/pagination',
),
'Illuminate\\Contracts\\' =>
'Illuminate\\Contracts\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/contracts',
),
'Doctrine\\Instantiator\\' =>
'Doctrine\\Instantiator\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator',
),
'Doctrine\\Inflector\\' =>
'Doctrine\\Inflector\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Inflector',
),
'Carbon\\' =>
'Carbon\\' =>
array (
0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon',
),

Some files were not shown because too many files have changed in this diff Show More