Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into new_avoir_situation
This commit is contained in:
commit
63180f45a8
@ -135,6 +135,7 @@ $elementList = array();
|
||||
'3' => $langs->trans('AccountingJournalType3'),
|
||||
'4' => $langs->trans('AccountingJournalType4'),
|
||||
'5' => $langs->trans('AccountingJournalType5'),
|
||||
'8' => $langs->trans('AccountingJournalType8'),
|
||||
'9' => $langs->trans('AccountingJournalType9')
|
||||
);
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class AccountingJournal extends CommonObject
|
||||
|
||||
public $code;
|
||||
public $label;
|
||||
public $nature; // 0:various operations, 1:sale, 2:purchase, 3:bank, 4:expense-report, 9: has-new
|
||||
public $nature; // 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
|
||||
public $active;
|
||||
|
||||
public $lines;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
@ -301,7 +301,7 @@ if (empty($reshook))
|
||||
$object->phone = trim(GETPOST("phone",'alpha'));
|
||||
$object->phone_perso = trim(GETPOST("phone_perso",'alpha'));
|
||||
$object->phone_mobile= trim(GETPOST("phone_mobile",'alpha'));
|
||||
$object->email = trim(GETPOST("member_email",'alpha'));
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email",'alpha'));
|
||||
$object->skype = trim(GETPOST("skype",'alpha'));
|
||||
$object->birth = $birthdate;
|
||||
|
||||
@ -445,7 +445,7 @@ if (empty($reshook))
|
||||
$phone_perso=GETPOST("phone_perso",'alpha');
|
||||
$phone_mobile=GETPOST("phone_mobile",'alpha');
|
||||
$skype=GETPOST("member_skype",'alpha');
|
||||
$email=GETPOST("member_email",'alpha');
|
||||
$email=preg_replace('/\s+/', '', GETPOST("member_email",'alpha'));
|
||||
$login=GETPOST("member_login",'alpha');
|
||||
$pass=GETPOST("password",'alpha');
|
||||
$photo=GETPOST("photo",'alpha');
|
||||
|
||||
@ -2316,15 +2316,15 @@ class Adherent extends CommonObject
|
||||
if ($this->societe && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe;
|
||||
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
|
||||
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
|
||||
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
||||
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
|
||||
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
|
||||
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
|
||||
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
|
||||
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
|
||||
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
|
||||
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
|
||||
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
|
||||
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_private, 2);
|
||||
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = dol_string_nohtmltag($this->note_public, 2);
|
||||
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
|
||||
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
|
||||
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
|
||||
|
||||
@ -456,7 +456,7 @@ class AdherentType extends CommonObject
|
||||
|
||||
// Champs
|
||||
if ($this->label && ! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
|
||||
if ($this->note && ! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = $this->note;
|
||||
if ($this->note && ! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1);
|
||||
if (! empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS))
|
||||
{
|
||||
$valueofldapfield=array();
|
||||
|
||||
@ -48,9 +48,6 @@ $subscriptionstatic=new Subscription($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("MembersArea"));
|
||||
|
||||
|
||||
$var=True;
|
||||
|
||||
$Adherents=array();
|
||||
$AdherentsAValider=array();
|
||||
$MemberUpToDate=array();
|
||||
@ -255,7 +252,6 @@ print '<th align="right">'.$langs->trans("AmountTotal").'</th>';
|
||||
print '<th align="right">'.$langs->trans("AmountAverage").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
krsort($Total);
|
||||
foreach ($Total as $key=>$value)
|
||||
{
|
||||
|
||||
@ -345,6 +345,12 @@ if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs-
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/card.php?action=create">'.$langs->trans('NewMember').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -355,7 +361,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="Information";
|
||||
$modelmail="member";
|
||||
|
||||
@ -181,6 +181,8 @@ if ($result)
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1">'.$langs->trans('NewSubscription').'</a>';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -191,7 +193,7 @@ if ($result)
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="Information";
|
||||
$modelmail="subscription";
|
||||
|
||||
@ -228,6 +228,12 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
|
||||
$param = '';
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->adherent->configurer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type.php?action=create">'.$langs->trans('NewMemberType').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -237,7 +243,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
@ -79,9 +79,10 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR"),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY"),'chaine',0,'',$conf->entity);
|
||||
// Content parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity);
|
||||
@ -151,6 +152,7 @@ if ($action == 'edit')
|
||||
{
|
||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\')
|
||||
{
|
||||
console.log("I choose php mail mode");
|
||||
jQuery(".drag").hide();
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val(0);
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").prop("disabled", true);
|
||||
@ -161,9 +163,7 @@ if ($action == 'edit')
|
||||
jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN").prop("disabled", true);
|
||||
jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR").prop("disabled", true);
|
||||
jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").prop("disabled", true);
|
||||
jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN").hide();
|
||||
jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR").hide();
|
||||
jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").hide();
|
||||
jQuery(".dkim").hide();
|
||||
';
|
||||
if ($linuxlike)
|
||||
{
|
||||
@ -185,6 +185,7 @@ if ($action == 'edit')
|
||||
}
|
||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\')
|
||||
{
|
||||
console.log("I choose smtps mode");
|
||||
jQuery(".drag").show();
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
|
||||
@ -204,9 +205,11 @@ if ($action == 'edit')
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").show();
|
||||
jQuery("#smtp_server_mess").hide();
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
jQuery(".dkim").hide();
|
||||
}
|
||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
|
||||
{
|
||||
console.log("I choose swiftmailer mode");
|
||||
jQuery(".drag").show();
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
|
||||
@ -226,6 +229,7 @@ if ($action == 'edit')
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").show();
|
||||
jQuery("#smtp_server_mess").hide();
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
jQuery(".dkim").show();
|
||||
}
|
||||
}
|
||||
initfields();
|
||||
@ -295,13 +299,12 @@ if ($action == 'edit')
|
||||
print '</td></tr>';
|
||||
|
||||
// Host server
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
print $langs->trans("SeeLocalSendMailSetup");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -315,7 +318,7 @@ if ($action == 'edit')
|
||||
{
|
||||
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '">';
|
||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">';
|
||||
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -334,7 +337,7 @@ if ($action == 'edit')
|
||||
{
|
||||
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
print $langs->trans("SeeLocalSendMailSetup");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -348,7 +351,7 @@ if ($action == 'edit')
|
||||
{
|
||||
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">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -428,7 +431,7 @@ if ($action == 'edit')
|
||||
print '</td></tr>';
|
||||
|
||||
// DKIM
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
@ -440,18 +443,18 @@ if ($action == 'edit')
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '</td></tr>';
|
||||
|
||||
// Domain
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
|
||||
// DKIM Domain
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
|
||||
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN)?$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN:'');
|
||||
print '"></td></tr>';
|
||||
|
||||
// Selector
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
|
||||
// DKIM Selector
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
|
||||
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR)?$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR:'');
|
||||
print '"></td></tr>';
|
||||
|
||||
// PRIVATE KEY
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
|
||||
// DKIM PRIVATE KEY
|
||||
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
|
||||
print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY)?$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY:'').'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -557,7 +560,7 @@ else
|
||||
|
||||
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -568,7 +571,7 @@ else
|
||||
|
||||
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -600,7 +603,7 @@ else
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
else print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
// STARTTLS
|
||||
@ -614,37 +617,41 @@ else
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
else print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
// DKIM
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer')))
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
// DKIM
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer')))
|
||||
{
|
||||
print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED);
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED);
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '</td></tr>';
|
||||
|
||||
// Domain
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
|
||||
print '</td></tr>';
|
||||
|
||||
// Selector
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
|
||||
print '</td></tr>';
|
||||
|
||||
// PRIVATE KEY
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
|
||||
print '</td></tr>';
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '</td></tr>';
|
||||
|
||||
// Domain
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
|
||||
print '</td></tr>';
|
||||
|
||||
// Selector
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
|
||||
print '</td></tr>';
|
||||
|
||||
// PRIVATE KEY
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
|
||||
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
|
||||
@ -745,7 +752,7 @@ else
|
||||
{
|
||||
if (function_exists('fsockopen') && $port && $server)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect#formmailbeforetitle">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -753,11 +760,11 @@ else
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
if (! empty($conf->fckeditor->enabled))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -834,7 +841,7 @@ else
|
||||
$formmail->fromalsorobot=1;
|
||||
$formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
$formmail->withfromreadonly=1;
|
||||
$formmail->withsubstit=0;
|
||||
$formmail->withsubstit=1;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->witherrorsto=1;
|
||||
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
|
||||
|
||||
@ -55,8 +55,7 @@ $search_lang=GETPOST('search_lang','alpha');
|
||||
$search_fk_user=GETPOST('search_fk_user','intcomma');
|
||||
$search_topic=GETPOST('search_topic','alpha');
|
||||
|
||||
$allowed=1;
|
||||
if (! $allowed) accessforbidden();
|
||||
if (! empty($user->socid)) accessforbidden();
|
||||
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
@ -168,6 +167,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la
|
||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||
if ($conf->projet->enabled) $elementList['project']=$langs->trans('MailToProject');
|
||||
$elementList['user']=$langs->trans('MailToUser');
|
||||
$elementList['all'] =$langs->trans('VisibleEverywhere');
|
||||
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||
@ -521,7 +521,7 @@ $parameters = array(
|
||||
'fieldlist' => $fieldlist,
|
||||
'tabname' => $tabname[$id]
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
@ -732,7 +732,7 @@ if ($resql)
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('editEmailTemplateFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
@ -776,6 +776,7 @@ if ($resql)
|
||||
}
|
||||
if ($tmpfieldlist == 'content')
|
||||
{
|
||||
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
@ -791,7 +792,7 @@ if ($resql)
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('viewEmailTemplateFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
|
||||
@ -79,9 +79,9 @@ $familyinfo=array(
|
||||
|
||||
$param='';
|
||||
if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword);
|
||||
if ($search_status > -1) $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_nature > -1) $param.='&search_nature='.urlencode($search_nature);
|
||||
if ($search_version > -1) $param.='&search_version='.urlencode($search_version);
|
||||
if ($search_status && $search_status != '-1') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_nature && $search_nature != '-1') $param.='&search_nature='.urlencode($search_nature);
|
||||
if ($search_version && $search_version != '-1') $param.='&search_version='.urlencode($search_version);
|
||||
|
||||
$dirins=DOL_DOCUMENT_ROOT.'/custom';
|
||||
$urldolibarrmodules='https://www.dolistore.com/';
|
||||
@ -462,7 +462,7 @@ if ($mode == 'common')
|
||||
{
|
||||
dol_set_focus('#search_keyword');
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
|
||||
@ -257,17 +257,6 @@ print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$con
|
||||
print '</td><td align="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Add js auto fill amount on paiement form
|
||||
/* always on now
|
||||
$var=! $var;
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("JSOnPaimentBill");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1);
|
||||
print '</td><td align="right">';
|
||||
print "</td></tr>\n";
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<center>';
|
||||
|
||||
@ -64,7 +64,7 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admin'));
|
||||
$hookmanager->initHooks(array('website'));
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -514,15 +514,7 @@ if ($id)
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
|
||||
|
||||
print '<td colspan="3" align="right">';
|
||||
if ($action != 'edit')
|
||||
@ -602,7 +594,7 @@ if ($id)
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('editWebsiteFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist,$obj,$tabname[$id],'edit');
|
||||
@ -614,7 +606,7 @@ if ($id)
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('viewWebsiteFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
|
||||
113
htdocs/assets/admin/assets_extrafields.php
Normal file
113
htdocs/assets/admin/assets_extrafields.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/assets/admin/assets_extrafields.php
|
||||
* \ingroup assets
|
||||
* \brief Page to setup extra fields of assets
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
$langs->loadLangs(array("assets","admin","companies"));
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='don'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Assets");
|
||||
|
||||
llxHeader('',$langs->trans("AssetsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AssetsSetup"),$linkback,'title_setup');
|
||||
|
||||
|
||||
$head = AssetsAdminPrepareHead();
|
||||
|
||||
dol_fiche_head($head, 'attributes', $langs->trans("Assets"), 0, 'generic');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Create optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edit optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
113
htdocs/assets/admin/assets_type_extrafields.php
Normal file
113
htdocs/assets/admin/assets_type_extrafields.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* \file htdocs/assets/admin/assets_type_extrafields.php
|
||||
* \ingroup assets
|
||||
* \brief Page to setup extra fields type of assets
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("assets");
|
||||
$langs->load("admin");
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='adherent_type'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("AssetsTypes");
|
||||
|
||||
llxHeader('',$langs->trans("AssetsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AssetsSetup"),$linkback,'title_setup');
|
||||
|
||||
|
||||
$head = AssetsAdminPrepareHead();
|
||||
|
||||
dol_fiche_head($head, 'attributes_type', $langs->trans("Assets"), 0, 'generic');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
118
htdocs/assets/admin/setup.php
Normal file
118
htdocs/assets/admin/setup.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/assets/admin/setup.php
|
||||
* \ingroup assets
|
||||
* \brief Assets setup page.
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
|
||||
|
||||
global $langs, $user;
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "assets"));
|
||||
|
||||
// Access control
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$arrayofparameters=array('FIXEDASSETS_MYPARAM1'=>array('css'=>'minwidth200'), 'FIXEDASSETS_MYPARAM2'=>array('css'=>'minwidth500'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("AssetsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AssetsSetup"),$linkback,'title_setup');
|
||||
|
||||
|
||||
$head = AssetsAdminPrepareHead();
|
||||
|
||||
dol_fiche_head($head, 'settings', $langs->trans("Assets"), 0, 'generic');
|
||||
|
||||
// Setup page goes here
|
||||
echo $langs->trans("AssetsSetupPage");
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
|
||||
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
|
||||
print '</td><td>' . $conf->global->$key . '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
// Page end
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
372
htdocs/assets/card.php
Normal file
372
htdocs/assets/card.php
Normal file
@ -0,0 +1,372 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file card.php
|
||||
* \ingroup assets
|
||||
* \brief Page to create/edit/view assets
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/assets/class/assets.class.php';
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("assets"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new Assets($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->assets->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('assetscard')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('assets');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all=trim(GETPOST("search_all",'alpha'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||
}
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) $action='view';
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->societe_id > 0) access_forbidden();
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
//$result = restrictedArea($user, 'assets', $id);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $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 // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$permissiontoadd = $user->rights->assets->create;
|
||||
$permissiontodelete = $user->rights->assets->delete;
|
||||
$backurlforlist = dol_buildpath('/assets/list.php',1);
|
||||
|
||||
// Actions cancel, add, update or delete
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='MYOBJECT_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||
$trackid='assets'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*
|
||||
* Put here all code to build page
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formfile=new FormFile($db);
|
||||
|
||||
$title=$langs->trans("Assets").' - '.$langs->trans("Card");
|
||||
$help_url='';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
// Part to create
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewAsset"));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
|
||||
dol_fiche_head(array(), '');
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||
print ' ';
|
||||
print '<input type="'.($backtopage?"submit":"button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage?'':' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
// Part to edit record
|
||||
if (($id || $ref) && $action == 'edit')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("Assets"));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
// Part to show record
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||
{
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
|
||||
$head = AssetsPrepareHead($object);
|
||||
dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, 'generic');
|
||||
|
||||
$formconfirm = '';
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAssets'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of action xxxx
|
||||
if ($action == 'xxx')
|
||||
{
|
||||
$formquestion=array();
|
||||
/*
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
}*/
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
if (! $formconfirm) {
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/assets/list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
/*
|
||||
// Ref bis
|
||||
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->assets->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->assets->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
*/
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
// Common attributes
|
||||
//$keyforbreak='fieldkeytoswithonsecondcolumn';
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons for actions
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Send
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
|
||||
|
||||
if ($user->rights->assets->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->assets->delete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
}
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents
|
||||
/*$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
$filedir = $conf->assets->dir_output . '/' . $objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->assets->read; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->rights->assets->create; // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('assets', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
*/
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('assets'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlright = '<a href="'.dol_buildpath('/assets/assets_info.php', 1).'?id='.$object->id.'">';
|
||||
$morehtmlright.= $langs->trans("SeeAll");
|
||||
$morehtmlright.= '</a>';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'assets', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
//Select mail models is same action as presend
|
||||
/*
|
||||
if (GETPOST('modelselected')) $action = 'presend';
|
||||
|
||||
// Presend form
|
||||
$modelmail='inventory';
|
||||
$defaulttopic='InformationMessage';
|
||||
$diroutput = $conf->product->dir_output.'/inventory';
|
||||
$trackid = 'stockinv'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
463
htdocs/assets/class/asset.class.php
Normal file
463
htdocs/assets/class/asset.class.php
Normal file
@ -0,0 +1,463 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file assets/class/assets.class.php
|
||||
* \ingroup assets
|
||||
* \brief This file is a CRUD class file for assets (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class for Assets
|
||||
*/
|
||||
class Assets extends CommonObject
|
||||
{
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
public $element = 'assets';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'assets';
|
||||
/**
|
||||
* @var int Does assets support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
public $ismultientitymanaged = 0;
|
||||
/**
|
||||
* @var int Does assets support extrafields ? 0=No, 1=Yes
|
||||
*/
|
||||
public $isextrafieldmanaged = 1;
|
||||
/**
|
||||
* @var string String with name of icon for assets. Must be the part after the 'object_' into object_assets.png
|
||||
*/
|
||||
public $picto = 'assets';
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format.
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
* 'showoncombobox' if field must be shown into the label of combobox
|
||||
*/
|
||||
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",),
|
||||
'amount' => array('type'=>'double(24,8)', 'label'=>'Amount', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1,),
|
||||
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>510, 'notnull'=>1,),
|
||||
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>511, 'notnull'=>-1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1,),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Active', '-1'=>'Cancel')),
|
||||
);
|
||||
public $rowid;
|
||||
public $ref;
|
||||
public $entity;
|
||||
public $label;
|
||||
public $amount;
|
||||
public $fk_soc;
|
||||
public $description;
|
||||
public $note_public;
|
||||
public $note_private;
|
||||
public $date_creation;
|
||||
public $tms;
|
||||
public $fk_user_creat;
|
||||
public $fk_user_modif;
|
||||
public $import_key;
|
||||
public $status;
|
||||
|
||||
// If this object has a subtable with lines
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
*/
|
||||
//public $table_element_line = 'assetsdet';
|
||||
/**
|
||||
* @var int Field with ID of parent key if this field has a parent
|
||||
*/
|
||||
//public $fk_element = 'fk_assets';
|
||||
/**
|
||||
* @var int Name of subtable class that manage subtable lines
|
||||
*/
|
||||
//public $class_element_line = 'Assetsline';
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
*/
|
||||
//protected $childtables=array('assetsdet');
|
||||
/**
|
||||
* @var AssetsLine[] Array of subtable lines
|
||||
*/
|
||||
//public $lines = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
|
||||
if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->createCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone and object into another one
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return mixed New object created, <0 if KO
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
global $hookmanager, $langs;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$object = new self($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetchCommon($fromid);
|
||||
// Reset some properties
|
||||
unset($object->id);
|
||||
unset($object->fk_user_creat);
|
||||
unset($object->import_key);
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->createCommon($user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return $object;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object lines in memory from the database
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
/*public function fetchLines()
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
// Load lines with object AssetsLine
|
||||
|
||||
return count($this->lines)?1:0;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->deleteCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param string $option On what the link point to ('nolink', ...)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("Asset") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
|
||||
$url = dol_buildpath('/assets/card.php',1).'?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$linkclose='';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowAssets");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le libelle du status d'un user (actif, inactif)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status
|
||||
*
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
static function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge les informations d'ordre info dans l'objet commande
|
||||
*
|
||||
* @param int $id Id of order
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
|
||||
$sql.= ' fk_user_creat, fk_user_modif';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql.= ' WHERE t.rowid = '.$id;
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid)
|
||||
{
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture)
|
||||
{
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->initAsSpecimenCommon();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action executed by scheduler
|
||||
* 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)
|
||||
*/
|
||||
public function doScheduledJob()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->output = '';
|
||||
$this->error='';
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
421
htdocs/assets/class/asset_type.class.php
Normal file
421
htdocs/assets/class/asset_type.class.php
Normal file
@ -0,0 +1,421 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/assets/class/asset_type.class.php
|
||||
* \ingroup assets
|
||||
* \brief File of class to manage asset types
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage asset type
|
||||
*/
|
||||
class AssetType extends CommonObject
|
||||
{
|
||||
public $table_element = 'asset_type';
|
||||
public $element = 'asset_type';
|
||||
public $picto = 'group';
|
||||
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
/** @var string Label */
|
||||
public $label;
|
||||
/** @var string Accountancy code asset */
|
||||
public $accountancy_code_asset;
|
||||
/** @var string Accountancy code depreciation asset */
|
||||
public $accountancy_code_depreciation_asset;
|
||||
/** @var string Accountancy code depreciation expense */
|
||||
public $accountancy_code_depreciation_expense;
|
||||
/** @var string Public note */
|
||||
public $note;
|
||||
/** @var array Array of asset */
|
||||
public $asset=array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fonction qui permet de creer le type d'immobilisation
|
||||
*
|
||||
* @param User $user User making creation
|
||||
* @param int $notrigger 1=do not execute triggers, 0 otherwise
|
||||
* @return int >0 if OK, < 0 if KO
|
||||
*/
|
||||
function create($user,$notrigger=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->label=trim($this->label);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_type (";
|
||||
$sql.= "label";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->label)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Asset_type::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."asset_type");
|
||||
|
||||
$result = $this->update($user,1);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ASSET_TYPE_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Met a jour en base donnees du type
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @param int $notrigger 1=do not execute triggers, 0 otherwise
|
||||
* @return int >0 if OK, < 0 if KO
|
||||
*/
|
||||
function update($user,$notrigger=0)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->label=trim($this->label);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."asset_type ";
|
||||
$sql.= "SET ";
|
||||
$sql.= "label = '".$this->db->escape($this->label) ."',";
|
||||
$sql.= "accountancy_code_asset = '".$this->db->escape($this->accountancy_code_asset)."',";
|
||||
$sql.= "accountancy_code_depreciation_asset = '".$this->db->escape($this->accountancy_code_depreciation_asset)."',";
|
||||
$sql.= "accountancy_code_depreciation_expense = '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
|
||||
$sql.= " WHERE rowid =".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$action='update';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$hookmanager->initHooks(array('assettypedao'));
|
||||
$parameters=array('assettype'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ASSET_TYPE_MODIFY',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction qui permet de supprimer le status de l'adherent
|
||||
*
|
||||
* @return int >0 if OK, 0 if not found, < 0 if KO
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_type";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ASSET_TYPE_DELETE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -2; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction qui permet de recuperer le status de l'immobilisation
|
||||
*
|
||||
* @param int $rowid Id of member type to load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d";
|
||||
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
||||
|
||||
dol_syslog("Asset_type::fetch", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->label = $obj->label;
|
||||
$this->accountancy_code_asset = $obj->accountancy_code_asset;
|
||||
$this->accountancy_code_depreciation_asset = $obj->accountancy_code_depreciation_asset;
|
||||
$this->accountancy_code_depreciation_expense = $obj->accountancy_code_depreciation_expense;
|
||||
$this->note = $obj->note;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of asset's type
|
||||
*
|
||||
* @return array List of types of members
|
||||
*/
|
||||
function liste_array()
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$assettypes = array();
|
||||
|
||||
$sql = "SELECT rowid, label as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."asset_type";
|
||||
$sql.= " WHERE entity IN (".getEntity('asset_type').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$assettypes[$obj->rowid] = $langs->trans($obj->label);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
return $assettypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of Asset objects for asset type this->id (or all if this->id not defined)
|
||||
*
|
||||
* @param string $excludefilter Filter to exclude
|
||||
* @param int $mode 0=Return array of asset instance
|
||||
* 1=Return array of asset instance without extra data
|
||||
* 2=Return array of asset id only
|
||||
* @return mixed Array of asset or -1 on error
|
||||
*/
|
||||
function listAssetForAssetType($excludefilter='', $mode=0)
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT a.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."asset as a";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('asset').")";
|
||||
$sql.= " AND a.fk_asset_type = ".$this->id;
|
||||
if (! empty($excludefilter)) $sql.=' AND ('.$excludefilter.')';
|
||||
|
||||
dol_syslog(get_class($this)."::listAssetsForGroup", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if (! array_key_exists($obj->rowid, $ret))
|
||||
{
|
||||
if ($mode < 2)
|
||||
{
|
||||
$assetstatic=new Asset($this->db);
|
||||
if ($mode == 1) {
|
||||
$assetstatic->fetch($obj->rowid,'','','',false, false);
|
||||
} else {
|
||||
$assetstatic->fetch($obj->rowid);
|
||||
}
|
||||
$ret[$obj->rowid]=$assetstatic;
|
||||
}
|
||||
else $ret[$obj->rowid]=$obj->rowid;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
$this->asset=$ret;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param int $maxlen length max label
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowTypeCard",$this->label);
|
||||
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/assets/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label,$maxlen):$this->label);
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
// Initialize parameters
|
||||
$this->id = 0;
|
||||
$this->ref = 'ATSPEC';
|
||||
$this->specimen=1;
|
||||
|
||||
$this->label='ASSET TYPE SPECIMEN';
|
||||
$this->note='This is a note';
|
||||
|
||||
// Assets of this asset type is just me
|
||||
$this->asset=array(
|
||||
$user->id => $user
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
153
htdocs/assets/document.php
Normal file
153
htdocs/assets/document.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file document.php
|
||||
* \ingroup assets
|
||||
* \brief Tab for documents linked to Assets
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/assets/class/assets.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("assets","companies"));
|
||||
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->societe_id > 0) access_forbidden();
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
//$result = restrictedArea($user, 'assets', $id);
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new Assets($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->assets->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('assetsdocument')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('assets');
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
|
||||
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->ref);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title=$langs->trans("Assets").' - '.$langs->trans("Files");
|
||||
$help_url='';
|
||||
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
/*
|
||||
* Show tabs
|
||||
*/
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = AssetsPrepareHead($object);
|
||||
|
||||
dol_fiche_head($head, 'document', $langs->trans("Asset"), -1, 'generic');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/assets/list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Number of files
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
|
||||
// Total size
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'assets';
|
||||
//$permission = $user->rights->assets->create;
|
||||
$permission = 1;
|
||||
//$permtoedit = $user->rights->assets->create;
|
||||
$permtoedit = 1;
|
||||
$param = '&id=' . $object->id;
|
||||
|
||||
//$relativepathwithnofile='assets/' . dol_sanitizeFileName($object->id).'/';
|
||||
$relativepathwithnofile='assets/' . dol_sanitizeFileName($object->ref).'/';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('',0,0);
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
82
htdocs/assets/info.php
Normal file
82
htdocs/assets/info.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file info.php
|
||||
* \ingroup assets
|
||||
* \brief Page to show an asset information
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/assets/class/assets.class.php';
|
||||
|
||||
$langs->loadLangs(array("assets"));
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'assets', $id, '');
|
||||
|
||||
$object = new Assets($db);
|
||||
$object->fetch($id);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$title = $langs->trans('Asset') . " - " . $langs->trans('Info');
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$object->info($id);
|
||||
|
||||
$head = AssetsPrepareHead($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Asset"), -1, 'generic');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
540
htdocs/assets/list.php
Normal file
540
htdocs/assets/list.php
Normal file
@ -0,0 +1,540 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file list.php
|
||||
* \ingroup assets
|
||||
* \brief List page for assets
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test done when option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/assets/class/assets.class.php';
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("assets"));
|
||||
|
||||
$action = GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm','alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'assetslist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new Assets($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->assets->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('assetslist')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('assets');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
// Protection if external user
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
//$socid = $user->societe_id;
|
||||
accessforbidden();
|
||||
}
|
||||
//$result = restrictedArea($user, 'assets', $id,'');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all=trim(GETPOST("search_all",'alpha'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
|
||||
}
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*
|
||||
* Put here all code to do according to value of "$action" parameter
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$search[$key]='';
|
||||
}
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||
{
|
||||
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Assets';
|
||||
$objectlabel='Assets';
|
||||
$permtoread = $user->rights->assets->read;
|
||||
$permtodelete = $user->rights->assets->delete;
|
||||
$uploaddir = $conf->assets->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*
|
||||
* Put here all code to render page
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
//$help_url="EN:Module_Assets|FR:Module_Assets_FR|ES:Módulo_Assets";
|
||||
$help_url='';
|
||||
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Assets"));
|
||||
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."assets_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('assets').")";
|
||||
else $sql.=" WHERE 1 = 1";
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
||||
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
|
||||
}
|
||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY "
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
*/
|
||||
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/assets/card.php?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->assets->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
|
||||
// Add code for pre mass action (confirmation or email presend form)
|
||||
$topicmail="SendAssetsRef";
|
||||
$modelmail="assets";
|
||||
$objecttmp=new Assets($db);
|
||||
$trackid='xxxx'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
/*$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||
$moreforfilter.= '</div>';*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine=0;
|
||||
foreach ($extrafields->attribute_computed as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
}
|
||||
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->id = $obj->rowid;
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (isset($obj->$key)) $object->$key = $obj->$key;
|
||||
}
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
if ($align) print ' class="'.$align.'"';
|
||||
print '>';
|
||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
{
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['pos']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
||||
else
|
||||
{
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
else print '<td></td>';
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
$colspan=1;
|
||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
{
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
// Show list of available documents
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->assets->read;
|
||||
$delallowed=$user->rights->assets->create;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_assets','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
149
htdocs/assets/note.php
Normal file
149
htdocs/assets/note.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file note.php
|
||||
* \ingroup assets
|
||||
* \brief Card with notes on Assets
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/assets/class/assets.class.php';
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("assets","companies"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new Assets($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->assets->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('assetsnote')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('assets');
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->societe_id > 0) access_forbidden();
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
//$result = restrictedArea($user, 'assets', $id);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->assets->multidir_output[$object->entity] . "/" . $object->id;
|
||||
|
||||
$permissionnote=1;
|
||||
//$permissionnote=$user->rights->assets->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
|
||||
$help_url='';
|
||||
llxHeader('',$langs->trans('Assets'),$help_url);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = AssetsPrepareHead($object);
|
||||
|
||||
dol_fiche_head($head, 'note', $langs->trans("Asset"), -1, 'generic');
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/assets/list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
/*
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->assets->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
$cssclass="titlefield";
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
763
htdocs/assets/type.php
Normal file
763
htdocs/assets/type.php
Normal file
@ -0,0 +1,763 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/assets/type.php
|
||||
* \ingroup assets
|
||||
* \brief Asset's type setup
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/assets/class/asset.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/assets/class/asset_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("assets");
|
||||
|
||||
$rowid = GETPOST('rowid','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$backtopage = GETPOST('backtopage','alpha');
|
||||
|
||||
$type = GETPOST('type','alpha');
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) { $sortorder="DESC"; }
|
||||
if (! $sortfield) { $sortfield="d.lastname"; }
|
||||
|
||||
$label=GETPOST("label","alpha");
|
||||
$comment=GETPOST("comment");
|
||||
|
||||
// Security check
|
||||
$result=restrictedArea($user,'assets',$rowid,'asset_type');
|
||||
|
||||
$object = new AssetType($db);
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('asset_type');
|
||||
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$type="";
|
||||
$sall="";
|
||||
}
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('assettypecard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel) {
|
||||
|
||||
$action='';
|
||||
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'add' && $user->rights->assets->write)
|
||||
{
|
||||
$object->label = trim($label);
|
||||
$object->accountancy_code_asset = trim($accountancy_code_asset);
|
||||
$object->accountancy_code_depreciation_asset = trim($accountancy_code_depreciation_asset);
|
||||
$object->accountancy_code_depreciation_expense = trim($accountancy_code_depreciation_expense);
|
||||
$object->note = trim($comment);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (empty($object->label)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), null, 'errors');
|
||||
}
|
||||
else {
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."asset_type WHERE label='".$db->escape($object->label)."'";
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
if ($num) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorLabelAlreadyExists",$login), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$id=$object->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update' && $user->rights->assets->write)
|
||||
{
|
||||
$object->fetch($rowid);
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->label = trim($label);
|
||||
$object->accountancy_code_asset = trim($accountancy_code_asset);
|
||||
$object->accountancy_code_depreciation_asset = trim($accountancy_code_depreciation_asset);
|
||||
$object->accountancy_code_depreciation_expense = trim($accountancy_code_depreciation_expense);
|
||||
$object->note = trim($comment);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
$ret=$object->update($user);
|
||||
|
||||
if ($ret >= 0 && ! count($object->errors))
|
||||
{
|
||||
setEventMessages($langs->trans("AssetsTypeModified"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $user->rights->assets->write)
|
||||
{
|
||||
$object->fetch($rowid);
|
||||
$res=$object->delete();
|
||||
|
||||
if ($res > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("AssetsTypeDeleted"), null, 'mesgs');
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("AssetsTypeCanNotBeDeleted"), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$helpurl='';
|
||||
llxHeader('',$langs->trans("AssetsTypeSetup"),$helpurl);
|
||||
|
||||
|
||||
// List of asset type
|
||||
if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
{
|
||||
//dol_fiche_head('');
|
||||
|
||||
$sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."asset_type as d";
|
||||
$sql.= " WHERE d.entity IN (".getEntity('asset_type').")";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$nbtotalofrecords = $num;
|
||||
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans("AssetsTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Ref").'</th>';
|
||||
print '<th>'.$langs->trans("Label").'</th>';
|
||||
print '<th align="center">'.$langs->trans("SubscriptionRequired").'</th>';
|
||||
print '<th align="center">'.$langs->trans("VoteAllowed").'</th>';
|
||||
print '<th> </th>';
|
||||
print "</tr>\n";
|
||||
|
||||
$assettype = new AssetType($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$assettype->id = $objp->rowid;
|
||||
$assettype->ref = $objp->rowid;
|
||||
$assettype->label = $objp->rowid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $assettype->getNomUrl(1);
|
||||
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||
print '</td>';
|
||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||
print '<td align="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td align="center">'.yn($objp->vote).'</td>';
|
||||
if ($user->rights->adherent->configurer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
else
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'create')
|
||||
{
|
||||
$object = new AdherentType($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("NewMemberType"));
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription",1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote",0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
}
|
||||
print '<tbody>';
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Add").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* View mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($rowid > 0)
|
||||
{
|
||||
if ($action != 'edit')
|
||||
{
|
||||
$object = new AdherentType($db);
|
||||
$object->fetch($rowid);
|
||||
$object->fetch_optionals();
|
||||
|
||||
/*
|
||||
* Confirmation suppression
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id,$langs->trans("DeleteAMemberType"),$langs->trans("ConfirmDeleteMemberType",$object->label),"confirm_delete", '',0,1);
|
||||
}
|
||||
|
||||
$head = member_type_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print yn($object->subscription);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print yn($object->vote);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print nl2br($object->note)."</td></tr>";
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
print nl2br($object->mail_valid)."</td></tr>";
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
if ($user->rights->adherent->configurer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
// Add
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->configurer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
// Show list of members (nearly same code than in page list.php)
|
||||
|
||||
$assettypestatic=new AssetType($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT a.rowid, d.login, d.firstname, d.lastname, d.societe, ";
|
||||
$sql.= " d.datefin,";
|
||||
$sql.= " a.fk_asset_type as type_id,";
|
||||
$sql.= " t.label as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."asset as a, ".MAIN_DB_PREFIX."asset_type as t";
|
||||
$sql.= " WHERE a.fk_asset_type = t.rowid ";
|
||||
$sql.= " AND a.entity IN (".getEntity('asset').")";
|
||||
$sql.= " AND t.rowid = ".$object->id;
|
||||
if ($sall)
|
||||
{
|
||||
$sql.=natural_search(array("f.firstname","d.lastname","d.societe","d.email","d.login","d.address","d.town","d.note_public","d.note_private"), $sall);
|
||||
}
|
||||
if ($status != '')
|
||||
{
|
||||
$sql.= natural_search('d.statut', $status, 2);
|
||||
}
|
||||
if ($action == 'search')
|
||||
{
|
||||
if (GETPOST('search','alpha'))
|
||||
{
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||
}
|
||||
}
|
||||
if (! empty($search_lastname))
|
||||
{
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), $search_lastname);
|
||||
}
|
||||
if (! empty($search_login))
|
||||
{
|
||||
$sql.= natural_search("d.login", $search_login);
|
||||
}
|
||||
if (! empty($search_email))
|
||||
{
|
||||
$sql.= natural_search("d.email", $search_email);
|
||||
}
|
||||
if ($filter == 'uptodate')
|
||||
{
|
||||
$sql.=" AND datefin >= '".$db->idate($now)."'";
|
||||
}
|
||||
if ($filter == 'outofdate')
|
||||
{
|
||||
$sql.=" AND datefin < '".$db->idate($now)."'";
|
||||
}
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) $nbtotalofrecords = $db->num_rows($result);
|
||||
else dol_print_error($db);
|
||||
}
|
||||
// Add order and limit
|
||||
$sql.= " ".$db->order($sortfield,$sortorder);
|
||||
$sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$titre=$langs->trans("AssetsList");
|
||||
if ($status != '')
|
||||
{
|
||||
if ($status == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
|
||||
else if ($status == '-1') { $titre=$langs->trans("MembersListToValid"); }
|
||||
else if ($status == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); }
|
||||
else if ($status == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); }
|
||||
else if ($status == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
|
||||
else if ($status == '0') { $titre=$langs->trans("MembersListResiliated"); }
|
||||
}
|
||||
elseif ($action == 'search')
|
||||
{
|
||||
$titre=$langs->trans("MembersListQualified");
|
||||
}
|
||||
|
||||
if ($type > 0)
|
||||
{
|
||||
$assettype=new AssetType($db);
|
||||
$result=$assettype->fetch($type);
|
||||
$titre.=" (".$assettype->label.")";
|
||||
}
|
||||
|
||||
$param="&rowid=".$object->id;
|
||||
if (! empty($status)) $param.="&status=".$status;
|
||||
if (! empty($search_lastname)) $param.="&search_lastname=".$search_lastname;
|
||||
if (! empty($search_firstname)) $param.="&search_firstname=".$search_firstname;
|
||||
if (! empty($search_login)) $param.="&search_login=".$search_login;
|
||||
if (! empty($search_email)) $param.="&search_email=".$search_email;
|
||||
if (! empty($filter)) $param.="&filter=".$filter;
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'" size="12"></td>';
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'" size="7"></td>';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'" size="12"></td>';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre( $langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Nature",$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("EndSubscription",$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$datefin=$db->jdate($objp->datefin);
|
||||
|
||||
$adh=new Adherent($db);
|
||||
$adh->lastname=$objp->lastname;
|
||||
$adh->firstname=$objp->firstname;
|
||||
|
||||
// Lastname
|
||||
print '<tr class="oddeven">';
|
||||
if ($objp->societe != '')
|
||||
{
|
||||
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).'</a></td>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,32).'</a></td>'."\n";
|
||||
}
|
||||
|
||||
// Login
|
||||
print "<td>".$objp->login."</td>\n";
|
||||
|
||||
// Type
|
||||
/*print '<td class="nowrap">';
|
||||
$assettypestatic->id=$objp->type_id;
|
||||
$assettypestatic->label=$objp->type;
|
||||
print $assettypestatic->getNomUrl(1,12);
|
||||
print '</td>';
|
||||
*/
|
||||
|
||||
// Moral/Physique
|
||||
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
|
||||
|
||||
// EMail
|
||||
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
|
||||
|
||||
// Statut
|
||||
print '<td class="nowrap">';
|
||||
print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2);
|
||||
print "</td>";
|
||||
|
||||
// Date end subscription
|
||||
if ($datefin)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($datefin < dol_now() && $objp->statut > 0)
|
||||
{
|
||||
print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($datefin,'day');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="left" class="nowrap">';
|
||||
if ($objp->subscription == 'yes')
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($objp->statut > 0) print " ".img_warning();
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Actions
|
||||
print '<td align="center">';
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
print '<a href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
|
||||
}
|
||||
print ' ';
|
||||
if ($user->rights->adherent->supprimer)
|
||||
{
|
||||
print '<a href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"),'disable.png').'</a>';
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
if ($num > $conf->liste_limit)
|
||||
{
|
||||
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$object = new AdherentType($db);
|
||||
$object->fetch($rowid);
|
||||
$object->fetch_optionals();
|
||||
|
||||
$head = member_type_prepare_head($object);
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription",$object->subscription,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote",$object->vote,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Extra field
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print '<br><br><table class="border" width="100%">';
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
if (isset($_POST["options_" . $key])) {
|
||||
if (is_array($_POST["options_" . $key])) {
|
||||
// $_POST["options"] is an array but following code expects a comma separated string
|
||||
$value = implode(",", $_POST["options_" . $key]);
|
||||
} else {
|
||||
$value = $_POST["options_" . $key];
|
||||
}
|
||||
} else {
|
||||
$value = $adht->array_options["options_" . $key];
|
||||
}
|
||||
print '<tr><td width="30%">'.$label.'</td><td>';
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '</table><br><br>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -81,7 +81,9 @@ $userstatic=new User($db);
|
||||
|
||||
llxHeader('', $langs->trans("ListOfBookmarks"));
|
||||
|
||||
print load_fiche_titre($langs->trans("ListOfBookmarks"));
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create">'.$langs->trans('NewBookmark').'</a>';
|
||||
|
||||
print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton);
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateb, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,";
|
||||
$sql.= " u.login, u.lastname, u.firstname";
|
||||
@ -204,16 +206,6 @@ else
|
||||
}
|
||||
|
||||
|
||||
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=create">'.$langs->trans("NewBookmark").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
|
||||
@ -103,7 +103,10 @@ if ($result)
|
||||
|
||||
$title=$langs->trans("ListOfEMailings");
|
||||
if ($filteremail) $title.=' ('.$langs->trans("SentTo",$filteremail).')';
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,"",$num);
|
||||
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/mailing/card.php?action=create">'.$langs->trans('NewMailing').'</a>';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '',$num, '', 'title_generic.png', 0, $newcardbutton);
|
||||
|
||||
$i = 0;
|
||||
|
||||
|
||||
@ -394,6 +394,12 @@ if ($resql)
|
||||
if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->propal->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create">'.$langs->trans('NewPropal').'</a>';
|
||||
}
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -405,7 +411,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="SendPropalRef";
|
||||
$modelmail="proposal_send";
|
||||
|
||||
@ -52,18 +52,18 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Proposal"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?></td>
|
||||
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td class="linkedcol-amount" align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action" align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@ -2451,7 +2451,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
/*
|
||||
* Form to add new line
|
||||
*/
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer)
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
|
||||
@ -419,6 +419,12 @@ if ($resql)
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($contextpage == 'orderlist' && $user->rights->commande->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create">'.$langs->trans('NewOrder').'</a>';
|
||||
}
|
||||
|
||||
// Lines of title fields
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -431,7 +437,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
|
||||
@ -47,18 +47,20 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("CustomerOrder"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerOrder"); ?>
|
||||
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0,'',0,1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
|
||||
</td>
|
||||
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td class="linkedcol-amount" align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right">
|
||||
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action" align="right">
|
||||
<?php
|
||||
// For now, shipments must stay linked to order, so link is not deletable
|
||||
if($object->element != 'shipping') {
|
||||
|
||||
@ -153,6 +153,8 @@ if ($result)
|
||||
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create">'.$langs->trans('MenuNewVariousPayment').'</a>';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -163,7 +165,7 @@ if ($result)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("VariousPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
@ -913,7 +913,7 @@ if (empty($reshook))
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
||||
$object->type = Facture::TYPE_CREDIT_NOTE;
|
||||
|
||||
|
||||
$facture_source = new Facture($db); // fetch origin object
|
||||
if ($facture_source->fetch($object->fk_facture_source)>0)
|
||||
{
|
||||
@ -924,12 +924,11 @@ if (empty($reshook))
|
||||
$facture_source->fetchPreviousNextSituationInvoice();
|
||||
}
|
||||
}
|
||||
|
||||
$id = $object->create($user);
|
||||
|
||||
if ((GETPOST('invoiceAvoirWithLines', 'int')==1 || $object->situation_cycle_ref>0 ) && $id>0)
|
||||
$facture_source = new Facture($db); // fetch origin object
|
||||
if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0)
|
||||
{
|
||||
|
||||
if (!empty($facture_source->lines))
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
@ -1000,12 +999,11 @@ if (empty($reshook))
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$line->fk_facture = $object->id;
|
||||
$line->fk_parent_line = $fk_parent_line;
|
||||
|
||||
|
||||
$line->subprice = -$line->subprice; // invert price for object
|
||||
$line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here
|
||||
$line->total_ht = -$line->total_ht;
|
||||
@ -1013,7 +1011,7 @@ if (empty($reshook))
|
||||
$line->total_ttc = -$line->total_ttc;
|
||||
$line->total_localtax1 = -$line->total_localtax1;
|
||||
$line->total_localtax2 = -$line->total_localtax2;
|
||||
|
||||
|
||||
$line->multicurrency_subprice = -$line->multicurrency_subprice;
|
||||
$line->multicurrency_total_ht = -$line->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
||||
@ -1036,7 +1034,6 @@ if (empty($reshook))
|
||||
|
||||
if(GETPOST('invoiceAvoirWithPaymentRestAmount', 'int')==1 && $id>0)
|
||||
{
|
||||
$facture_source = new Facture($db); // fetch origin object if not previously defined
|
||||
if ($facture_source->fetch($object->fk_facture_source)>0)
|
||||
{
|
||||
$totalpaye = $facture_source->getSommePaiement();
|
||||
@ -1047,6 +1044,20 @@ if (empty($reshook))
|
||||
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'),$remain_to_pay,1,0,0,0,0,0,'','','TTC');
|
||||
}
|
||||
}
|
||||
|
||||
// Add link between credit note and origin
|
||||
if(! empty($object->fk_facture_source)) {
|
||||
$facture_source->fetch($object->fk_facture_source);
|
||||
}
|
||||
$facture_source->fetchObjectLinked();
|
||||
|
||||
if(! empty($facture_source->linkedObjectsIds)) {
|
||||
$linkedObjectIds = $facture_source->linkedObjectsIds;
|
||||
$sourcetype = key($linkedObjectIds);
|
||||
$fk_origin = current($facture_source->linkedObjectsIds[$sourcetype]);
|
||||
|
||||
$object->add_object_linked($sourcetype, $fk_origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2300,6 +2311,82 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// add lines from objectlinked
|
||||
elseif($action == 'import_lines_from_object'
|
||||
&& $user->rights->facture->creer
|
||||
&& $object->statut == Facture::STATUS_DRAFT
|
||||
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION))
|
||||
{
|
||||
$fromElement = GETPOST('fromelement');
|
||||
$fromElementid = GETPOST('fromelementid');
|
||||
$importLines = GETPOST('line_checkbox');
|
||||
|
||||
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
|
||||
{
|
||||
if($fromElement == 'commande')
|
||||
{
|
||||
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class');
|
||||
$lineClassName = 'OrderLine';
|
||||
}
|
||||
$nextRang = count($object->lines) + 1;
|
||||
$importCount = 0;
|
||||
$error = 0;
|
||||
foreach($importLines as $lineId)
|
||||
{
|
||||
$lineId = intval($lineId);
|
||||
$originLine = new $lineClassName($db);
|
||||
if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0)
|
||||
{
|
||||
$originLine->fetch_optionals($lineId);
|
||||
$desc = $originLine->desc;
|
||||
$pu_ht = $originLine->subprice;
|
||||
$qty = $originLine->qty;
|
||||
$txtva = $originLine->tva_tx;
|
||||
$txlocaltax1 = $originLine->localtax1_tx;
|
||||
$txlocaltax2 = $originLine->localtax2_tx;
|
||||
$fk_product = $originLine->fk_product;
|
||||
$remise_percent = $originLine->remise_percent;
|
||||
$date_start = $originLine->date_start;
|
||||
$date_end = $originLine->date_end;
|
||||
$ventil = 0;
|
||||
$info_bits = $originLine->info_bits;
|
||||
$fk_remise_except = $originLine->fk_remise_except;
|
||||
$price_base_type='HT';
|
||||
$pu_ttc=0;
|
||||
$type = $originLine->product_type;
|
||||
$rang=$nextRang++;
|
||||
$special_code = $originLine->special_code;
|
||||
$origin = $originLine->element;
|
||||
$origin_id = $originLine->id;
|
||||
$fk_parent_line=0;
|
||||
$fk_fournprice=$originLine->fk_fournprice;
|
||||
$pa_ht = $originLine->pa_ht;
|
||||
$label = $originLine->label;
|
||||
$array_options = $originLine->array_options;
|
||||
$situation_percent = 100;
|
||||
$fk_prev_id = '';
|
||||
$fk_unit = $originLine->fk_unit;
|
||||
$pu_ht_devise = $originLine->multicurrency_subprice;
|
||||
|
||||
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise);
|
||||
if($res > 0){
|
||||
$importCount++;
|
||||
}else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if($error)
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
@ -3276,7 +3363,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
)
|
||||
{
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $label, $text, 'confirm_situationout', $formquestion, "yes", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation of validation
|
||||
@ -3849,8 +3936,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
|
||||
print '<td align="right">' . $prev_invoice->getLibStatut(3, $totalpaye) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3935,8 +4021,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
@ -4071,6 +4156,8 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '</table>';
|
||||
|
||||
|
||||
// List of previous situation invoices
|
||||
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1;
|
||||
$nbrows = 8;
|
||||
@ -4092,6 +4179,90 @@ else if ($id > 0 || ! empty($ref))
|
||||
if (! empty($conf->incoterm->enabled))
|
||||
$nbrows += 1;
|
||||
|
||||
if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
|
||||
print '<table class="noborder situationstable" width="100%">';
|
||||
|
||||
if (count($object->tab_previous_situation_invoice) > 0) {
|
||||
// List of previous invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('ListOfPreviousSituationInvoices') . '</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
|
||||
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_prev_ht = $total_prev_ttc = 0;
|
||||
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
|
||||
$totalpaye = $prev_invoice->getSommePaiement();
|
||||
$total_prev_ht += $prev_invoice->total_ht;
|
||||
$total_prev_ttc += $prev_invoice->total_ttc;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $prev_invoice->getNomUrl(1) . '</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
|
||||
print '<td align="right">' . price($prev_invoice->total_ht) . '</td>';
|
||||
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
|
||||
print '<td align="right">' . $prev_invoice->getLibStatut(3, $totalpaye) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td></td>';
|
||||
print '<td align="right"><b>' . price($total_prev_ht) . '</b></td>';
|
||||
print '<td align="right"><b>' . price($total_prev_ttc) . '</b></td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($object->tab_next_situation_invoice) > 0) {
|
||||
// List of next invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
|
||||
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_next_ht = $total_next_ttc = 0;
|
||||
|
||||
foreach ($object->tab_next_situation_invoice as $next_invoice) {
|
||||
$totalpaye = $next_invoice->getSommePaiement();
|
||||
$total_next_ht += $next_invoice->total_ht;
|
||||
$total_next_ttc += $next_invoice->total_ttc;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $next_invoice->getNomUrl(1) . '</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
|
||||
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
|
||||
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
|
||||
print '<td align="right">' . $next_invoice->getLibStatut(3, $totalpaye) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2" align="right"></td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
|
||||
|
||||
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
|
||||
print '<td align="right"><b>' . price($total_next_ttc) . '</b></td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
// List of payments already done
|
||||
|
||||
@ -4421,7 +4592,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Form to add new line
|
||||
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref))
|
||||
{
|
||||
if ($action != 'editline')
|
||||
if ($action != 'editline' && $action != 'selectlines')
|
||||
{
|
||||
// Add free products/services
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
@ -4635,7 +4806,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer)
|
||||
{
|
||||
@ -4682,7 +4853,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a id="butSituationOutRefused" class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotEnouthCreditNote") . '" >' . $langs->trans("RemoveSituationFromCycle") . '</a></div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Create next situation invoice
|
||||
@ -4753,7 +4923,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
$compatibleImportElementsList = false;
|
||||
if($user->rights->facture->creer
|
||||
&& $object->statut == Facture::STATUS_DRAFT
|
||||
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) )
|
||||
{
|
||||
$compatibleImportElementsList = array('commande'); // import from linked elements
|
||||
}
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);
|
||||
|
||||
|
||||
// Show online payment link
|
||||
|
||||
@ -769,10 +769,16 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
else if ($reshook < 0) $error++;*/
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -589,6 +589,12 @@ if ($resql)
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if($user->rights->facture->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create">'.$langs->trans('NewBill').'</a>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
@ -602,7 +608,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="facture_send";
|
||||
|
||||
@ -47,12 +47,12 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
||||
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td class="linkedcol-amount" align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
|
||||
@ -66,8 +66,8 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
}
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
<td class="linkedcol-statut" align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action" align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -87,4 +87,4 @@ if (count($linkedObjectBlock) > 1)
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
@ -131,6 +131,12 @@ if ($resql)
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->banque->cheque)
|
||||
{
|
||||
$newcardbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new">'.$langs->trans('NewCheckDeposit').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -140,7 +146,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', '', '', $limit);
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
|
||||
@ -101,6 +101,8 @@ if ($result)
|
||||
|
||||
$selectedfields='';
|
||||
|
||||
$newcardbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/prelevement/create.php">'.$langs->trans('NewStandingOrder').'</a>';
|
||||
|
||||
// Lines of title fields
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -112,7 +114,7 @@ if ($result)
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
|
||||
@ -150,6 +150,8 @@ if ($result)
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/salaries/card.php?action=create">'.$langs->trans('NewSalaryPayment').'</a>';
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -159,7 +161,7 @@ if ($result)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
@ -146,6 +146,12 @@ if ($resql)
|
||||
if ($year) $param.='&year='.$year;
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
|
||||
$newcardbutton='';
|
||||
if($user->rights->tax->charges->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?action=create">'.$langs->trans('MenuNewSocialContribution').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -158,11 +164,11 @@ if ($resql)
|
||||
if ($year)
|
||||
{
|
||||
$center=($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":"");
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
}
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
|
||||
@ -148,6 +148,11 @@ if ($result)
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?action=create">'.$langs->trans('NewVATPayment').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -157,7 +162,7 @@ if ($result)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -530,7 +530,7 @@ class Contact extends CommonObject
|
||||
if ($this->phone_mobile && ! empty($conf->global->LDAP_CONTACT_FIELD_MOBILE)) $info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile;
|
||||
if ($this->fax && ! empty($conf->global->LDAP_CONTACT_FIELD_FAX)) $info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax;
|
||||
if ($this->skype && ! empty($conf->global->LDAP_CONTACT_FIELD_SKYPE)) $info[$conf->global->LDAP_CONTACT_FIELD_SKYPE] = $this->skype;
|
||||
if ($this->note_private && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = $this->note_private;
|
||||
if ($this->note_private && ! empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_private, 2);
|
||||
if ($this->email && ! empty($conf->global->LDAP_CONTACT_FIELD_MAIL)) $info[$conf->global->LDAP_CONTACT_FIELD_MAIL] = $this->email;
|
||||
|
||||
if ($conf->global->LDAP_SERVER_TYPE == 'egroupware')
|
||||
|
||||
@ -412,6 +412,12 @@ if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/card.php?action=create">'.$langs->trans('NewContactAddress').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -421,7 +427,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit);
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="Information";
|
||||
$modelmail="contact";
|
||||
|
||||
@ -369,6 +369,12 @@ if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create">'.$langs->trans('NewContractSubscription').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -378,7 +384,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="SendContractRef";
|
||||
$modelmail="contract";
|
||||
|
||||
@ -126,7 +126,7 @@ if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_
|
||||
// HR
|
||||
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
|
||||
{
|
||||
$arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
|
||||
$arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
|
||||
}
|
||||
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
|
||||
{
|
||||
|
||||
@ -776,7 +776,8 @@ class CMailFile
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
$res=false;
|
||||
} else {
|
||||
$this->error = sprintf ("Sent %d messages\n", $result);
|
||||
$this->error = $langs->trans("SentXXXmessages", $result);
|
||||
$this->errors[] = $langs->trans("SentXXXmessages", $result);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -1428,19 +1428,24 @@ abstract class CommonObject
|
||||
if (empty($format)) $format='text';
|
||||
if (empty($id_field)) $id_field='rowid';
|
||||
|
||||
$fk_user_field = 'fk_user_modif';
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Special case
|
||||
if ($table == 'product' && $field == 'note_private') $field='note';
|
||||
if (in_array($table, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
|
||||
$fk_user_field = 'fk_user_mod';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||
if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'";
|
||||
else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value);
|
||||
else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null");
|
||||
if (! empty($fuser) && is_object($fuser)) $sql.=", fk_user_modif = ".$fuser->id;
|
||||
elseif (empty($fuser) || $fuser != 'none') $sql.=", fk_user_modif = ".$user->id;
|
||||
if (! empty($fuser) && is_object($fuser)) $sql.=", ".$fk_user_field." = ".$fuser->id;
|
||||
elseif (empty($fuser) || $fuser != 'none') $sql.=", ".$fk_user_field." = ".$user->id;
|
||||
$sql.= " WHERE ".$id_field." = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
|
||||
@ -2437,11 +2442,13 @@ abstract class CommonObject
|
||||
|
||||
if (! $this->table_element)
|
||||
{
|
||||
$this->error='update_note was called on objet with property table_element not defined';
|
||||
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (! in_array($suffix,array('','_public','_private')))
|
||||
{
|
||||
$this->error='update_note Parameter suffix must be empty, \'_private\' or \'_public\'';
|
||||
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
@ -3728,6 +3735,14 @@ abstract class CommonObject
|
||||
|
||||
print '<td class="linecolmove" width="10"></td>';
|
||||
|
||||
if($action == 'selectlines')
|
||||
{
|
||||
print '<td class="linecolcheckall" align="center">';
|
||||
print '<input type="checkbox" class="linecheckboxtoggle" />';
|
||||
print '<script type="text/javascript">$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -4991,6 +5006,7 @@ abstract class CommonObject
|
||||
|
||||
if ($error)
|
||||
{
|
||||
dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -5978,19 +5994,29 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$csstyle='';
|
||||
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : '');
|
||||
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'hideobject ' : '');
|
||||
if (is_array($params) && count($params)>0) {
|
||||
if (array_key_exists('style',$params)) {
|
||||
$csstyle=$params['style'];
|
||||
}
|
||||
}
|
||||
|
||||
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
|
||||
if (empty($onetrtd))
|
||||
// add html5 elements
|
||||
$domData = ' data-element="extrafield"';
|
||||
$domData .= ' data-targetelement="'.$this->element.'"';
|
||||
$domData .= ' data-targetid="'.$this->id.'"';
|
||||
|
||||
$html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : '';
|
||||
|
||||
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.'" '.$domData.' >';
|
||||
|
||||
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
|
||||
}
|
||||
|
||||
if($action == 'selectlines'){ $colspan++; }
|
||||
|
||||
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||
{
|
||||
@ -6009,16 +6035,10 @@ abstract class CommonObject
|
||||
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
|
||||
}
|
||||
|
||||
if (empty($onetrtd)) $out .= '<td>';
|
||||
else $out .= '<td'.($colspan?' colspan="'.($colspan+1).'"':'').'>';
|
||||
|
||||
$out .= $labeltoshow;
|
||||
|
||||
if (empty($onetrtd)) $out .= '</td><td'.($colspan?' colspan="'.($colspan).'"':'').'>';
|
||||
else $out.=' ';
|
||||
$out .= '<td>'.$labeltoshow.'</td>';
|
||||
|
||||
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
|
||||
$out .='<span id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'">';
|
||||
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
|
||||
|
||||
switch($mode) {
|
||||
case "view":
|
||||
@ -6030,8 +6050,9 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
|
||||
else $out .= '</tr>';
|
||||
$e++;
|
||||
}
|
||||
}
|
||||
@ -6043,7 +6064,7 @@ abstract class CommonObject
|
||||
jQuery(document).ready(function() {
|
||||
function showOptions(child_list, parent_list)
|
||||
{
|
||||
var val = $("select[name="+parent_list+"]").val();
|
||||
var val = $("select[name=\"options_"+parent_list+"\"]").val();
|
||||
var parentVal = parent_list + ":" + val;
|
||||
if(val > 0) {
|
||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
||||
|
||||
@ -485,7 +485,7 @@ class Conf
|
||||
|
||||
// Default pdf option
|
||||
if (! isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES=1; // use dash between lines
|
||||
if (! isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT=1; // allow html content into free footer text
|
||||
if (! isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT=1; // allow html content into free footer text
|
||||
|
||||
// Set default value to MAIN_SHOW_LOGO
|
||||
if (! isset($this->global->MAIN_SHOW_LOGO)) $this->global->MAIN_SHOW_LOGO=1;
|
||||
@ -505,6 +505,10 @@ class Conf
|
||||
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
|
||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
|
||||
// Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
|
||||
if (! empty($this->modules_parts['moduleforexternal']))
|
||||
foreach($this->modules_parts['moduleforexternal'] as $key=>$value) $this->global->MAIN_MODULES_FOR_EXTERNAL.=",$key";
|
||||
|
||||
// Enable select2
|
||||
if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT='select2';
|
||||
|
||||
|
||||
@ -740,6 +740,7 @@ class ExtraFields
|
||||
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
|
||||
|
||||
// Set array of label of entity
|
||||
// TODO Remove completely loading of label. This should be done by presentation.
|
||||
$labelmulticompany=array();
|
||||
if (!empty($conf->multicompany->enabled))
|
||||
{
|
||||
@ -757,8 +758,7 @@ class ExtraFields
|
||||
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
|
||||
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
|
||||
|
||||
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed";
|
||||
$sql.= ",entity";
|
||||
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
||||
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
|
||||
|
||||
@ -134,28 +134,29 @@ class HookManager
|
||||
if (in_array(
|
||||
$method,
|
||||
array(
|
||||
'addCalendarChoice',
|
||||
'addMoreActionsButtons',
|
||||
'addMoreMassActions',
|
||||
'addSearchEntry',
|
||||
'addCalendarChoice',
|
||||
'addMoreActionsButtons',
|
||||
'addMoreMassActions',
|
||||
'addSearchEntry',
|
||||
'addStatisticLine',
|
||||
'createDictionaryFieldList',
|
||||
'createDictionaryFieldlist',
|
||||
'editDictionaryFieldlist',
|
||||
'getFormMail',
|
||||
'deleteFile',
|
||||
'deleteFile',
|
||||
'doActions',
|
||||
'doMassActions',
|
||||
'doMassActions',
|
||||
'formatEvent',
|
||||
'formCreateThirdpartyOptions',
|
||||
'formObjectOptions',
|
||||
'formattachOptions',
|
||||
'formBuilddocLineOptions',
|
||||
'formatNotificationMessage',
|
||||
'getFormMail',
|
||||
'getIdProfUrl',
|
||||
'getDirList',
|
||||
'formatNotificationMessage',
|
||||
'getFormMail',
|
||||
'getIdProfUrl',
|
||||
'getDirList',
|
||||
'moveUploadedFile',
|
||||
'moreHtmlStatus',
|
||||
'pdf_build_address',
|
||||
'pdf_build_address',
|
||||
'pdf_writelinedesc',
|
||||
'pdf_getlinenum',
|
||||
'pdf_getlineref',
|
||||
@ -176,12 +177,11 @@ class HookManager
|
||||
'printAddress',
|
||||
'printSearchForm',
|
||||
'printTabsHead',
|
||||
'formatEvent',
|
||||
'printObjectLine',
|
||||
'printObjectSubLine',
|
||||
'showLinkToObjectBlock',
|
||||
'printObjectLine',
|
||||
'printObjectSubLine',
|
||||
'sendMail',
|
||||
'sendMailAfter'
|
||||
'sendMailAfter',
|
||||
'showLinkToObjectBlock'
|
||||
)
|
||||
)) $hooktype='addreplace';
|
||||
|
||||
|
||||
@ -1703,7 +1703,10 @@ class Form
|
||||
$userstatic->fetch($value['id']);
|
||||
$out.= $userstatic->getNomUrl(-1);
|
||||
if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; }
|
||||
if ($nbassignetouser > 1 && $action != 'view') $out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
|
||||
if ($nbassignetouser > 1 && $action != 'view')
|
||||
{
|
||||
$out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
|
||||
}
|
||||
// Show my availability
|
||||
if ($showproperties)
|
||||
{
|
||||
@ -5985,9 +5988,10 @@ class Form
|
||||
*
|
||||
* @param CommonObject $object Object we want to show links to
|
||||
* @param string $morehtmlright More html to show on right of title
|
||||
* @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showLinkedObjectBlock($object, $morehtmlright='')
|
||||
function showLinkedObjectBlock($object, $morehtmlright='',$compatibleImportElementsList=false)
|
||||
{
|
||||
global $conf,$langs,$hookmanager;
|
||||
global $bc;
|
||||
@ -5996,7 +6000,9 @@ class Form
|
||||
|
||||
// Bypass the default method
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
$parameters=array();
|
||||
$parameters=array(
|
||||
'compatibleImportElementsList' =>& $compatibleImportElementsList,
|
||||
);
|
||||
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if (empty($reshook))
|
||||
@ -6008,7 +6014,7 @@ class Form
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder allwidth">';
|
||||
print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
@ -6025,7 +6031,13 @@ class Form
|
||||
foreach($object->linkedObjects as $objecttype => $objects)
|
||||
{
|
||||
$tplpath = $element = $subelement = $objecttype;
|
||||
|
||||
|
||||
// to display inport button on tpl
|
||||
$showImportButton=false;
|
||||
if(!empty($compatibleImportElementsList) && in_array($element,$compatibleImportElementsList)){
|
||||
$showImportButton=true;
|
||||
}
|
||||
|
||||
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||
{
|
||||
$element = $regs[1];
|
||||
@ -6085,7 +6097,7 @@ class Form
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
$noMoreLinkedObjectBlockAfter=1;
|
||||
}
|
||||
|
||||
|
||||
$res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
|
||||
if ($res)
|
||||
{
|
||||
@ -6101,6 +6113,13 @@ class Form
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
if(!empty($compatibleImportElementsList))
|
||||
{
|
||||
$res=@include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
return $nbofdifferenttypes;
|
||||
|
||||
@ -240,13 +240,13 @@ class FormMail extends Form
|
||||
* Get the form to input an email
|
||||
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
* this->withfile
|
||||
* this->param: Contains more parameteres like email templates info
|
||||
* this->param: Contains more parameters like email templates info
|
||||
*
|
||||
* @param string $addfileaction Name of action when posting file attachments
|
||||
* @param string $removefileaction Name of action when removing file attachments
|
||||
* @return string Form to show
|
||||
*/
|
||||
function get_form($addfileaction='addfile',$removefileaction='removefile')
|
||||
function get_form($addfileaction='addfile', $removefileaction='removefile')
|
||||
{
|
||||
global $conf, $langs, $user, $hookmanager, $form;
|
||||
|
||||
@ -409,18 +409,19 @@ class FormMail extends Form
|
||||
|
||||
$out.= '<table class="tableforemailform boxtablenotop" width="100%">'."\n";
|
||||
|
||||
// Substitution array
|
||||
// Substitution array/string
|
||||
$helpforsubstitution='';
|
||||
if (is_array($this->substit) && count($this->substit)) $helpforsubstitution.=$langs->trans('AvailableVariables').' :<br>'."\n";
|
||||
foreach($this->substit as $key => $val)
|
||||
{
|
||||
$helpforsubstitution.=$key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
|
||||
}
|
||||
if (! empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
|
||||
{
|
||||
$out.= '<tr><td colspan="2" align="right">';
|
||||
//$out.='<div class="floatright">';
|
||||
$help="";
|
||||
foreach($this->substit as $key => $val)
|
||||
{
|
||||
$help.=$key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
|
||||
}
|
||||
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
|
||||
else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
|
||||
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
|
||||
else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
|
||||
$out.= "</td></tr>\n";
|
||||
//$out.='</div>';
|
||||
}
|
||||
@ -773,7 +774,9 @@ class FormMail extends Form
|
||||
$defaulttopic=make_substitutions($defaulttopic,$this->substit);
|
||||
|
||||
$out.= '<tr>';
|
||||
$out.= '<td class="fieldrequired">'.$langs->trans("MailTopic").'</td>';
|
||||
$out.= '<td class="fieldrequired">';
|
||||
$out.=$form->textwithpicto($langs->trans('MailTopic'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfromtopic');
|
||||
$out.='</td>';
|
||||
$out.= '<td>';
|
||||
if ($this->withtopicreadonly)
|
||||
{
|
||||
@ -917,7 +920,9 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
$out.= '<tr>';
|
||||
$out.= '<td valign="top">'.$langs->trans("MailText").'</td>';
|
||||
$out.= '<td valign="top">';
|
||||
$out.=$form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
||||
$out.='</td>';
|
||||
$out.= '<td>';
|
||||
if ($this->withbodyreadonly)
|
||||
{
|
||||
|
||||
120
htdocs/core/lib/assets.lib.php
Normal file
120
htdocs/core/lib/assets.lib.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file core/lib/assets.lib.php
|
||||
* \ingroup assets
|
||||
* \brief Library files with common functions for Assets
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare admin pages header
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function AssetsAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$langs->load("assets");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/assets/admin/setup.php';
|
||||
$head[$h][1] = $langs->trans("Settings");
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
//$this->tabs = array(
|
||||
// 'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__'
|
||||
//); // to add new tab
|
||||
//$this->tabs = array(
|
||||
// 'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__'
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/assets/admin/assets_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/assets/admin/assets_type_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsAssetsType");
|
||||
$head[$h][2] = 'attributes_type';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
function AssetsPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$langs->load("assets");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/assets/card.php';
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
//$this->tabs = array(
|
||||
// 'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__'
|
||||
//); // to add new tab
|
||||
//$this->tabs = array(
|
||||
// 'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__'
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/assets/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$nbNote = 0;
|
||||
if(!empty($object->note_private)) $nbNote++;
|
||||
if(!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/assets/note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Notes");
|
||||
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/assets/info.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@ -835,6 +835,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST('page','int');
|
||||
@ -886,7 +887,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
{
|
||||
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||
}
|
||||
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
@ -933,9 +934,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print "\n".'<table class="tagtable liste">'."\n";
|
||||
|
||||
$param="socid=".$object->id;
|
||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
|
||||
$param="socid=".urlencode($object->id);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
|
||||
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
|
||||
@ -943,7 +947,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
$sql .= " WHERE t.fk_soc = ".$object->id;
|
||||
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
|
||||
if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')";
|
||||
if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name);
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder";
|
||||
else $sql.= " ORDER BY $sortfield $sortorder";
|
||||
|
||||
@ -1107,7 +1113,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
// Edit
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
@ -3059,7 +3059,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
||||
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @param int $pictoisfullpath If 1, image path is a full path
|
||||
* @param boolean|int $pictoisfullpath If true or 1, image path is a full path
|
||||
* @param int $srconly Return only content of the src attribute of img.
|
||||
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
||||
* @param string $alt Force alt for bind peoplae
|
||||
@ -3071,68 +3071,124 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||
$url = DOL_URL_ROOT;
|
||||
$theme = $conf->theme;
|
||||
$path = 'theme/'.$theme;
|
||||
|
||||
// Define fullpathpicto to use into src
|
||||
if ($pictoisfullpath)
|
||||
{
|
||||
if ($pictoisfullpath) {
|
||||
// Clean parameters
|
||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
|
||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) {
|
||||
$picto .= '.png';
|
||||
}
|
||||
$fullpathpicto = $picto;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
|
||||
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow')))
|
||||
{
|
||||
$fakey = $pictowithoutext; $facolor=''; $fasize='';
|
||||
if ($pictowithoutext == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; }
|
||||
elseif ($pictowithoutext == 'switch_on') { $fakey = 'fa-toggle-on'; $facolor='#227722'; $fasize='2em'; }
|
||||
elseif ($pictowithoutext == 'off') { $fakey = 'fa-square-o'; $fasize='1.3em'; }
|
||||
elseif ($pictowithoutext == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; }
|
||||
elseif ($pictowithoutext == 'bank') { $fakey = 'fa-bank'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'delete') { $fakey = 'fa-trash'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'edit') { $fakey = 'fa-pencil'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'printer') { $fakey = 'fa-print'; $fasize='1.2em'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'resize') { $fakey = 'fa-crop'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'uparrow') { $fakey = 'fa-mail-forward'; $facolor='#555'; }
|
||||
elseif ($pictowithoutext == 'unlink') { $fakey = 'fa-chain-broken'; $facolor='#555'; }
|
||||
elseif ($pictowithoutext == 'playdisabled') { $fakey = 'fa-play'; $facolor='#ccc'; }
|
||||
else { $fakey = 'fa-'.$pictowithoutext; $facolor='#444'; }
|
||||
if (empty($srconly) && in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) {
|
||||
$fakey = $pictowithoutext;
|
||||
$facolor = '';
|
||||
$fasize = '';
|
||||
if ($pictowithoutext == 'switch_off') {
|
||||
$fakey = 'fa-toggle-off';
|
||||
$facolor = '#999';
|
||||
$fasize = '2em';
|
||||
}
|
||||
elseif ($pictowithoutext == 'switch_on') {
|
||||
$fakey = 'fa-toggle-on';
|
||||
$facolor = '#227722';
|
||||
$fasize = '2em';
|
||||
}
|
||||
elseif ($pictowithoutext == 'off') {
|
||||
$fakey = 'fa-square-o';
|
||||
$fasize = '1.3em';
|
||||
}
|
||||
elseif ($pictowithoutext == 'on') {
|
||||
$fakey = 'fa-check-square-o';
|
||||
$fasize = '1.3em';
|
||||
}
|
||||
elseif ($pictowithoutext == 'bank') {
|
||||
$fakey = 'fa-bank';
|
||||
$facolor = '#444';
|
||||
}
|
||||
elseif ($pictowithoutext == 'delete') {
|
||||
$fakey = 'fa-trash';
|
||||
$facolor = '#444';
|
||||
}
|
||||
elseif ($pictowithoutext == 'edit') {
|
||||
$fakey = 'fa-pencil';
|
||||
$facolor = '#444';
|
||||
}
|
||||
elseif ($pictowithoutext == 'printer') {
|
||||
$fakey = 'fa-print';
|
||||
$fasize = '1.2em';
|
||||
$facolor = '#444';
|
||||
}
|
||||
elseif ($pictowithoutext == 'resize') {
|
||||
$fakey = 'fa-crop';
|
||||
$facolor = '#444';
|
||||
}
|
||||
elseif ($pictowithoutext == 'uparrow') {
|
||||
$fakey = 'fa-mail-forward';
|
||||
$facolor = '#555';
|
||||
}
|
||||
elseif ($pictowithoutext == 'unlink') {
|
||||
$fakey = 'fa-chain-broken';
|
||||
$facolor = '#555';
|
||||
}
|
||||
elseif ($pictowithoutext == 'playdisabled') {
|
||||
$fakey = 'fa-play';
|
||||
$facolor = '#ccc';
|
||||
}
|
||||
else {
|
||||
$fakey = 'fa-'.$pictowithoutext;
|
||||
$facolor = '#444';
|
||||
}
|
||||
|
||||
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { $morecss.=($morecss?' ':'').$reg[1]; }
|
||||
$enabledisablehtml ='<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$titlealt;
|
||||
$enabledisablehtml.='</span>';
|
||||
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
|
||||
$morecss.= ($morecss?' ':'').$reg[1];
|
||||
}
|
||||
$enabledisablehtml = '<span class="fa '.$fakey.' marginleftonly valignmiddle'.($morecss?' '.$morecss:'').'" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'"'.($moreatt?' '.$moreatt:'').'>';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$enabledisablehtml.= $titlealt;
|
||||
}
|
||||
$enabledisablehtml.= '</span>';
|
||||
|
||||
return $enabledisablehtml;
|
||||
}
|
||||
|
||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||
$url = DOL_URL_ROOT;
|
||||
$theme = $conf->theme;
|
||||
|
||||
$path = 'theme/'.$theme;
|
||||
if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
|
||||
else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
|
||||
else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
|
||||
if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) {
|
||||
$path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
|
||||
}
|
||||
else if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
|
||||
$path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
|
||||
}
|
||||
else if (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) {
|
||||
$path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
|
||||
}
|
||||
|
||||
// If we ask an image into $url/$mymodule/img (instead of default path)
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs))
|
||||
{
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) {
|
||||
$picto = $regs[1];
|
||||
$path = $regs[2]; // $path is $mymodule
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) $picto .= '.png';
|
||||
if (! preg_match('/(\.png|\.gif|\.svg)$/i',$picto)) {
|
||||
$picto .= '.png';
|
||||
}
|
||||
// If alt path are defined, define url where img file is, according to physical path
|
||||
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
|
||||
{
|
||||
if ($type == 'main') continue;
|
||||
if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded
|
||||
{
|
||||
$url=DOL_URL_ROOT.$conf->file->dol_url_root[$type];
|
||||
// ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir0/htdocs", ...)
|
||||
foreach ($conf->file->dol_document_root as $type => $dirroot) {
|
||||
if ($type == 'main') {
|
||||
continue;
|
||||
}
|
||||
// This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded
|
||||
if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) {
|
||||
$url = DOL_URL_ROOT.$conf->file->dol_url_root[$type];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3141,15 +3197,16 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;
|
||||
}
|
||||
|
||||
if ($srconly) return $fullpathpicto;
|
||||
else
|
||||
{
|
||||
if ($srconly) {
|
||||
return $fullpathpicto;
|
||||
}
|
||||
else {
|
||||
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people
|
||||
//$tmparray=array(0=>$titlealt);
|
||||
//if (empty($notitle) && preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
|
||||
//$title=$tmparray[0];
|
||||
//$alt=empty($tmparray[1])?'':$tmparray[1];
|
||||
$title=$titlealt;
|
||||
$title = $titlealt;
|
||||
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($title))?'':' title="'.dol_escape_htmltag($title).'"').($moreatt?' '.$moreatt:' class="inline-block"').'>'; // Alt is used for accessibility, title for popup
|
||||
}
|
||||
}
|
||||
@ -5351,35 +5408,41 @@ function picto_required()
|
||||
/**
|
||||
* Clean a string from all HTML tags and entities.
|
||||
* This function differs from strip_tags because:
|
||||
* - <br> are replace with \n
|
||||
* - if entities are found, they are decoded before the strip
|
||||
* - you can decide to convert line feed into spaces
|
||||
* - <br> are replaced with \n if removelinefeed=0 or 1
|
||||
* - if entities are found, they are decoded BEFORE the strip
|
||||
* - you can decide to convert line feed into a space
|
||||
*
|
||||
* @param string $stringtoclean String to clean
|
||||
* @param integer $removelinefeed 1=Replace also new lines by a space, 0=Only last one are removed
|
||||
* @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of <br> when there is both "...<br>\n..."
|
||||
* @param string $pagecodeto Encoding of input/output string
|
||||
* @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag)
|
||||
* @return string String cleaned
|
||||
*
|
||||
* @see dol_escape_htmltag strip_tags
|
||||
*/
|
||||
function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
function dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0)
|
||||
{
|
||||
// TODO Try to replace with strip_tags($stringtoclean)
|
||||
$pattern = "/<[^<>]+>/";
|
||||
$stringtoclean = preg_replace('/<br[^>]*>/', "\n", $stringtoclean);
|
||||
$temp = dol_html_entity_decode($stringtoclean,ENT_COMPAT,$pagecodeto);
|
||||
if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>\n+/ims', '<br>', $stringtoclean);
|
||||
$temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean);
|
||||
|
||||
// Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
|
||||
$temp = preg_replace($pattern,"",$temp); // pass 1
|
||||
// $temp after pass 1: <a href="/myurl" title="A title">0000-021
|
||||
$temp = preg_replace($pattern,"",$temp); // pass 2
|
||||
// $temp after pass 2: 0000-021
|
||||
if ($strip_tags) {
|
||||
$temp = strip_tags($temp);
|
||||
} else {
|
||||
$pattern = "/<[^<>]+>/";
|
||||
// Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
|
||||
$temp = preg_replace($pattern,"",$temp); // pass 1
|
||||
// $temp after pass 1: <a href="/myurl" title="A title">0000-021
|
||||
$temp = preg_replace($pattern,"",$temp); // pass 2
|
||||
// $temp after pass 2: 0000-021
|
||||
}
|
||||
|
||||
$temp = dol_html_entity_decode($temp,ENT_COMPAT,$pagecodeto);
|
||||
|
||||
// Supprime aussi les retours
|
||||
if ($removelinefeed) $temp=str_replace(array("\r\n","\r","\n")," ",$temp);
|
||||
if ($removelinefeed == 1) $temp=str_replace(array("\r\n","\r","\n")," ",$temp);
|
||||
|
||||
// et les espaces doubles
|
||||
while(strpos($temp," "))
|
||||
while (strpos($temp," "))
|
||||
{
|
||||
$temp = str_replace(" "," ",$temp);
|
||||
}
|
||||
@ -6466,27 +6529,30 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
|
||||
// Clean parameters
|
||||
$order=strtolower($order);
|
||||
|
||||
$sizearray=count($array);
|
||||
if (is_array($array) && $sizearray>0)
|
||||
if (is_array($array))
|
||||
{
|
||||
$temp = array();
|
||||
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
|
||||
|
||||
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
|
||||
else
|
||||
$sizearray=count($array);
|
||||
if ($sizearray>0)
|
||||
{
|
||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
||||
$temp = array();
|
||||
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
|
||||
|
||||
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
|
||||
else
|
||||
{
|
||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
||||
}
|
||||
|
||||
$sorted = array();
|
||||
|
||||
foreach(array_keys($temp) as $key)
|
||||
{
|
||||
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
|
||||
}
|
||||
|
||||
return $sorted;
|
||||
}
|
||||
|
||||
$sorted = array();
|
||||
|
||||
foreach(array_keys($temp) as $key)
|
||||
{
|
||||
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
|
||||
}
|
||||
|
||||
return $sorted;
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 54, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|assets', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->assets->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->assets->read', '', 2, 54, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
|
||||
@ -63,9 +63,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 320__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools', 'ProductVatMassChange', 1, 'products', '', '', 2, 15, __ENTITY__);
|
||||
-- Home - Menu users and groups
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/list.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/card.php?leftmenu=users&action=create', 'NewUser', 2, 'users', '($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/index.php?leftmenu=users', 'Groups', 1, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/list.php?leftmenu=users', 'Groups', 1, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/card.php?leftmenu=users&action=create', 'NewGroup', 2, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__);
|
||||
-- Third parties
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
|
||||
@ -275,6 +275,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2714__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2715__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2716__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||
-- Assets
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'accountancy', 'assets', 10__+MAX_llx_menu__, '/assets/list.php?leftmenu=assets&mainmenu=accountancy', 'MenuAssets', 0, 'assets', '$user->rights->assets->read', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'accountancy', '', 2800__+MAX_llx_menu__, '/assets/card.php?leftmenu=assets&mainmenu=accountancy&action=create', 'MenuNewAsset', 1, 'assets', '$user->rights->assets->write', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'accountancy', '', 2800__+MAX_llx_menu__, '/assets/type.php?leftmenu=assets&mainmenu=accountancy&action=create', 'MenuTypeAssets', 1, 'assets', '$user->rights->assets->write', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'accountancy', '', 2800__+MAX_llx_menu__, '/assets/list.php?leftmenu=assets&mainmenu=accountancy', 'MenuListAssets', 1, 'assets', '$user->rights->assets->read', '', 2, 1, __ENTITY__);
|
||||
-- Check deposit
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__);
|
||||
@ -313,7 +318,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
|
||||
-- Tools
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__);
|
||||
@ -345,9 +350,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5200__+MAX_llx_menu__, 'members', 'cat', 13__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=3', 'MembersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 5201__+MAX_llx_menu__, 'members', '', 5200__+MAX_llx_menu__, '/categories/card.php?action=create&type=3', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
|
||||
-- HRM - Employee
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/index.php?leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->hrm->employee->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->hrm->employee->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->hrm->employee->write', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/index.php?$leftmenu=hrm&mode=employee&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->hrm->employee->read', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/list.php?$leftmenu=hrm&mode=employee&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->hrm->employee->read', '', 0, 2, __ENTITY__);
|
||||
-- HRM - Holiday
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
|
||||
|
||||
@ -380,12 +380,13 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
if ($objp->nature == 4 && ! empty($conf->banque->enabled)) $nature="bank";
|
||||
if ($objp->nature == 5 && ! empty($conf->expensereport->enabled)) $nature="expensereports";
|
||||
if ($objp->nature == 1) $nature="various";
|
||||
if ($objp->nature == 8) $nature="inventory";
|
||||
if ($objp->nature == 9) $nature="hasnew";
|
||||
|
||||
// To enable when page exists
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2)
|
||||
{
|
||||
if ($nature == 'various' || $nature == 'hasnew') $nature='';
|
||||
if ($nature == 'various' || $nature == 'hasnew' || $nature == 'inventory') $nature='';
|
||||
}
|
||||
|
||||
if ($nature)
|
||||
@ -464,6 +465,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
if (! is_array($menu_array)) return 0;
|
||||
|
||||
// Show menu
|
||||
$invert=empty($conf->global->MAIN_MENU_INVERT)?"":"invert";
|
||||
if (empty($noout))
|
||||
{
|
||||
$altok=0; $blockvmenuopened=false; $lastlevel0='';
|
||||
@ -485,11 +487,11 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
}
|
||||
if ($altok % 2 == 0)
|
||||
{
|
||||
print '<div class="blockvmenuimpair'.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
print '<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="blockvmenupair'.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
print '<div class="blockvmenu blockvmenupair'.$invert.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,24 +511,43 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||
$menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
|
||||
|
||||
// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
|
||||
$url=dol_buildpath($menu_array[$i]['url'],1);
|
||||
|
||||
if (! preg_match('/mainmenu=/i',$menu_array[$i]['url']))
|
||||
$url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$menu_array[$i]['url']))
|
||||
{
|
||||
if (! preg_match('/\?/',$url)) $url.='?';
|
||||
else $url.='&';
|
||||
$url.='mainmenu='.$mainmenu;
|
||||
$tmp=explode('?',$menu_array[$i]['url'],2);
|
||||
$url = $shorturl = $tmp[0];
|
||||
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link
|
||||
|
||||
// Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
|
||||
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
|
||||
{
|
||||
$param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
|
||||
}
|
||||
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($menu_array[$i]['mainmenu']))
|
||||
{
|
||||
$param.=($param?'&':'').'leftmenu=';
|
||||
}
|
||||
//$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad
|
||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||
$shorturlwithoutparam = $shorturl;
|
||||
$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
}
|
||||
|
||||
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].' -->'."\n";
|
||||
|
||||
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
|
||||
|
||||
// Menu level 0
|
||||
if ($menu_array[$i]['level'] == 0)
|
||||
{
|
||||
if ($menu_array[$i]['enabled']) // Enabled so visible
|
||||
{
|
||||
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
|
||||
print '<div class="menu_titre">'.$tabstring;
|
||||
if ($shorturlwithoutparam) print '<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
|
||||
else print '<span class="vmenu">';
|
||||
print ($menu_array[$i]['prefix']?$menu_array[$i]['prefix']:'').$menu_array[$i]['titre'];
|
||||
if ($shorturlwithoutparam) print '</a>';
|
||||
else print '</span>';
|
||||
print '</div>'."\n";
|
||||
$lastlevel0='enabled';
|
||||
}
|
||||
else if ($showmenu) // Not enabled but visible (so greyed)
|
||||
@ -543,6 +564,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
print '<div class="menu_top"></div>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Menu level > 0
|
||||
if ($menu_array[$i]['level'] > 0)
|
||||
{
|
||||
@ -552,10 +574,10 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
|
||||
{
|
||||
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
|
||||
if ($menu_array[$i]['url']) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
|
||||
if ($shorturlwithoutparam) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
|
||||
else print '<span class="vsmenu">';
|
||||
print $menu_array[$i]['titre'];
|
||||
if ($menu_array[$i]['url']) print '</a>';
|
||||
if ($shorturlwithoutparam) print '</a>';
|
||||
else print '</span>';
|
||||
// If title is not pure text and contains a table, no carriage return added
|
||||
if (! strstr($menu_array[$i]['titre'],'<table')) print '<br>';
|
||||
|
||||
@ -188,9 +188,10 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
$menuqualified=0;
|
||||
if (! empty($conf->comptabilite->enabled)) $menuqualified++;
|
||||
if (! empty($conf->accounting->enabled)) $menuqualified++;
|
||||
if (! empty($conf->assets->enabled)) $menuqualified++;
|
||||
$tmpentry=array(
|
||||
'enabled'=>$menuqualified,
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire)),
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->assets->read)),
|
||||
'module'=>'comptabilite|accounting');
|
||||
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
@ -599,11 +600,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, ($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home');
|
||||
$newmenu->add("/user/index.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
|
||||
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
|
||||
$newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
|
||||
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -986,15 +987,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 52);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 52);
|
||||
}
|
||||
if (! empty($conf->tax->enabled))
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 53);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 53);
|
||||
}
|
||||
if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 54);
|
||||
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 54);
|
||||
}
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 55);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 60);
|
||||
@ -1002,14 +1003,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
// Fiscal year
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) // Not yet used. In a future will lock some periods.
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
|
||||
}
|
||||
|
||||
// Binding
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
$newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("Binded"),2,$user->rights->accounting->bind->write);
|
||||
}
|
||||
if (! empty($conf->supplier_invoice->enabled))
|
||||
@ -1075,8 +1076,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happend. Entries are added
|
||||
$newmenu->add('',$langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire);
|
||||
// Should not happend. Entries are added
|
||||
$newmenu->add('',$langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire);
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
@ -1135,6 +1136,18 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire, '', '', '', 50);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire, '', '', '', 51);
|
||||
}
|
||||
|
||||
// Assets
|
||||
if (! empty($conf->assets->enabled))
|
||||
{
|
||||
$langs->load("assets");
|
||||
$newmenu->add("/assets/list.php?leftmenu=assets&mainmenu=accountancy",$langs->trans("MenuAssets"), 0, $user->rights->assets->read, '', $mainmenu, 'assets');
|
||||
$newmenu->add("/assets/card.php?leftmenu=assets&action=create",$langs->trans("MenuNewAsset"), 1, $user->rights->assets->write);
|
||||
$newmenu->add("/assets/type.php?leftmenu=assets",$langs->trans("MenuTypeAssets"), 1, $user->rights->assets->read, '', $mainmenu, 'assets_type');
|
||||
$newmenu->add("/assets/type.php?leftmenu=assets_type&action=create",$langs->trans("MenuNewTypeAssets"), 1, $user->rights->assets->write);
|
||||
$newmenu->add("/assets/type.php?leftmenu=assets_type",$langs->trans("MenuListTypeAssets"), 1, $user->rights->assets->read);
|
||||
$newmenu->add("/assets/list.php?leftmenu=assets",$langs->trans("MenuListAssets"), 1, $user->rights->assets->read);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1357,9 +1370,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
$langs->load("hrm");
|
||||
|
||||
$newmenu->add("/user/index.php?leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/user/list.php?leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/user/card.php?action=create&employee=1", $langs->trans("NewEmployee"), 1,$user->rights->hrm->employee->write);
|
||||
$newmenu->add("/user/index.php?leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1,$user->rights->hrm->employee->read);
|
||||
$newmenu->add("/user/list.php?leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1,$user->rights->hrm->employee->read);
|
||||
}
|
||||
|
||||
// Leave/Holiday/Vacation module
|
||||
@ -1426,8 +1439,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
*/
|
||||
if ($mainmenu == 'tools')
|
||||
{
|
||||
$langs->load("mails");
|
||||
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates');
|
||||
if (empty($user->socid)) // limit to internal users
|
||||
{
|
||||
$langs->load("mails");
|
||||
$newmenu->add("/admin/mails_templates.php?leftmenu=email_templates", $langs->trans("EMailTemplates"), 0, 1, '', $mainmenu, 'email_templates');
|
||||
}
|
||||
|
||||
if (! empty($conf->mailing->enabled))
|
||||
{
|
||||
@ -1594,7 +1610,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
// Begin of new left menu block
|
||||
if (empty($menu_array[$i]['level']) && $showmenu)
|
||||
{
|
||||
$altok++;
|
||||
$altok++;
|
||||
$blockvmenuopened=true;
|
||||
$lastopened=true;
|
||||
for($j = ($i + 1); $j < $num; $j++)
|
||||
@ -1627,8 +1643,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||
$menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
|
||||
|
||||
$url = $shorturl = $menu_array[$i]['url'];
|
||||
|
||||
$url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$menu_array[$i]['url']))
|
||||
{
|
||||
$tmp=explode('?',$menu_array[$i]['url'],2);
|
||||
@ -1646,9 +1661,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
//$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad
|
||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||
$shorturlwithoutparam = $shorturl;
|
||||
$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
}
|
||||
//var_dump($url);
|
||||
|
||||
|
||||
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
|
||||
@ -1658,7 +1673,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
if ($menu_array[$i]['enabled']) // Enabled so visible
|
||||
{
|
||||
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.($menu_array[$i]['prefix']?$menu_array[$i]['prefix']:'').$menu_array[$i]['titre'].'</a></div>'."\n";
|
||||
print '<div class="menu_titre">'.$tabstring;
|
||||
if ($shorturlwithoutparam) print '<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
|
||||
else print '<span class="vmenu">';
|
||||
print ($menu_array[$i]['prefix']?$menu_array[$i]['prefix']:'').$menu_array[$i]['titre'];
|
||||
if ($shorturlwithoutparam) print '</a>';
|
||||
else print '</span>';
|
||||
print '</div>'."\n";
|
||||
$lastlevel0='enabled';
|
||||
}
|
||||
else if ($showmenu) // Not enabled but visible (so greyed)
|
||||
@ -1685,10 +1706,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
|
||||
{
|
||||
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
|
||||
if ($menu_array[$i]['url']) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
|
||||
if ($shorturlwithoutparam) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
|
||||
else print '<span class="vsmenu">';
|
||||
print $menu_array[$i]['titre'];
|
||||
if ($menu_array[$i]['url']) print '</a>';
|
||||
if ($shorturlwithoutparam) print '</a>';
|
||||
else print '</span>';
|
||||
// If title is not pure text and contains a table, no carriage return added
|
||||
if (! strstr($menu_array[$i]['titre'],'<table')) print '<br>';
|
||||
|
||||
@ -1313,6 +1313,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
{
|
||||
foreach ($this->cronjobs as $key => $value)
|
||||
{
|
||||
$entity = isset($this->cronjobs[$key]['entity'])?$this->cronjobs[$key]['entity']:$conf->entity;
|
||||
$label = isset($this->cronjobs[$key]['label'])?$this->cronjobs[$key]['label']:'';
|
||||
$jobtype = isset($this->cronjobs[$key]['jobtype'])?$this->cronjobs[$key]['jobtype']:'';
|
||||
$class = isset($this->cronjobs[$key]['class'])?$this->cronjobs[$key]['class']:'';
|
||||
@ -1334,7 +1335,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
|
||||
if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'";
|
||||
if ($command) $sql.= " AND command = '".$this->db->escape($command)."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND entity = ".$entity; // Must be exact entity
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
@ -1371,7 +1372,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if(is_int($unitfrequency)){ $sql.= "'".$this->db->escape($unitfrequency)."', "; }
|
||||
if(is_int($priority)) {$sql.= "'".$this->db->escape($priority)."', ";}
|
||||
if(is_int($status)){ $sql.= "'".$this->db->escape($status)."', "; }
|
||||
$sql.= $conf->entity.",";
|
||||
$sql.= $entity.",";
|
||||
$sql.= "'".$this->db->escape($test)."'";
|
||||
$sql.= ")";
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ class CommActionRapport
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,9 @@ class CommActionRapport
|
||||
if ($code == 'AC_OTH_AUTO') $code='AC_AUTO';
|
||||
}
|
||||
$pdf->SetXY(60,$y);
|
||||
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Action".$code)),32), 0, 'L', 0);
|
||||
$labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code);
|
||||
$labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short');
|
||||
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort),32), 0, 'L', 0);
|
||||
$y2 = $pdf->GetY();
|
||||
|
||||
// Description of event
|
||||
|
||||
261
htdocs/core/modules/modAssets.class.php
Normal file
261
htdocs/core/modules/modAssets.class.php
Normal file
@ -0,0 +1,261 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup assets Module Assets
|
||||
* \brief Assets module descriptor.
|
||||
*
|
||||
* \file htdocs/core/modules/modAssets.class.php
|
||||
* \ingroup assets
|
||||
* \brief Description and activation file for module Assets
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
// The class name should start with a lower case mod for Dolibarr to pick it up
|
||||
// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule.
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* Description and activation class for module FixedAssets
|
||||
*/
|
||||
class modAssets extends DolibarrModules
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 51000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'assets';
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "financial";
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '90';
|
||||
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
|
||||
|
||||
// Module label (no space allowed), used if translation string 'ModuleAssetsName' not found (MyModue is name of module).
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleAssetsDesc' not found (MyModue is name of module).
|
||||
$this->description = "Assets module";
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "Assets module to manage assets module and depreciation charge on Dolibarr";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'development';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where ASSETS is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='generic';
|
||||
|
||||
// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
|
||||
// for default path (eg: /assets/core/xxxxx) (0=disable, 1=enable)
|
||||
// for specific path of parts (eg: /assets/core/modules/barcode)
|
||||
// for specific css file (eg: /assets/css/assets.css.php)
|
||||
$this->module_parts = array();
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/assets/temp","/assets/subdir");
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages. Put here list of php page, stored into assets/admin directory, to use to setup module.
|
||||
$this->config_page_url = array("setup.php@assets");
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->langfiles = array("assets");
|
||||
$this->phpmin = array(5,3); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
//$this->automatic_activation = array('FR'=>'AssetsWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$this->always_enabled = true; // If true, can't be disabled
|
||||
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example: $this->const=array(0=>array('ASSETS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
|
||||
// 1=>array('ASSETS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
|
||||
// );
|
||||
$this->const = array(
|
||||
1=>array('ASSETS_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
|
||||
);
|
||||
|
||||
|
||||
if (! isset($conf->assets) || ! isset($conf->assets->enabled))
|
||||
{
|
||||
$conf->assets=new stdClass();
|
||||
$conf->assets->enabled=0;
|
||||
}
|
||||
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array();
|
||||
// Example:
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@assets:$user->rights->assets->read:/assets/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@assets:$user->rights->othermodule->read:/assets/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
||||
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
|
||||
//
|
||||
// Where objecttype can be
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'group' to add a tab in group view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'payment' to add a tab in payment view
|
||||
// 'payment_supplier' to add a tab in supplier payment view
|
||||
// 'product' to add a tab in product view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'project' to add a tab in project view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'user' to add a tab in user view
|
||||
|
||||
|
||||
// Dictionaries
|
||||
$this->dictionaries=array();
|
||||
/* Example:
|
||||
$this->dictionaries=array(
|
||||
'langs'=>'mylangfile@assets',
|
||||
'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor
|
||||
'tablib'=>array("Table1","Table2","Table3"), // Label of tables
|
||||
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields
|
||||
'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order
|
||||
'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary)
|
||||
'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record)
|
||||
'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert)
|
||||
'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid')
|
||||
'tabcond'=>array($conf->assets->enabled,$conf->assets->enabled,$conf->assets->enabled) // Condition to show each dictionary
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in assets/core/boxes that contains class to show a widget.
|
||||
$this->boxes = array(
|
||||
//0=>array('file'=>'assetswidget1.php@assets','note'=>'Widget provided by Assets','enabledbydefaulton'=>'Home'),
|
||||
//1=>array('file'=>'assetswidget2.php@assets','note'=>'Widget provided by Assets'),
|
||||
//2=>array('file'=>'assetswidget3.php@assets','note'=>'Widget provided by Assets')
|
||||
);
|
||||
|
||||
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||
$this->cronjobs = array(
|
||||
0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/assets/class/assets.class.php', 'objectname'=>'Assets', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true)
|
||||
);
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true)
|
||||
// );
|
||||
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
|
||||
$r=0;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read assets'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->assets->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->assets->level1->level2)
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/Update assets'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->assets->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->assets->level1->level2)
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Delete assets'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->assets->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->assets->level1->level2)
|
||||
|
||||
|
||||
// Main menu entries
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
|
||||
/*
|
||||
$langs->load("fixedassets@fixedassets");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='FixedAssetsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='fixedassets@fixedassets';
|
||||
$keyforclass = 'FixedAssets'; $keyforclassfile='/mymobule/class/fixedassets.class.php'; $keyforelement='fixedassets';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='fixedassets'; $keyforaliasextra='extra'; $keyforelement='fixedassets';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fixedassets as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('fixedassets').')';
|
||||
$r++; */
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
}
|
||||
@ -95,9 +95,9 @@ class modCron extends DolibarrModules
|
||||
|
||||
// Cronjobs
|
||||
$this->cronjobs = array(
|
||||
0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
|
||||
1=>array('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($db->type, array('mysql', 'mysqli'))),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
|
||||
0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', '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($db->type, array('mysql', 'mysqli'))),
|
||||
// 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
|
||||
);
|
||||
|
||||
// Permissions
|
||||
|
||||
@ -113,10 +113,10 @@ class modStripe extends DolibarrModules
|
||||
'titre'=>'StripeAccount',
|
||||
'mainmenu'=>'bank',
|
||||
'leftmenu'=>'stripe',
|
||||
'url' => '/stripe/charge.php',
|
||||
'url' => '',
|
||||
'langs' => 'stripe',
|
||||
'position' => 100,
|
||||
'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 2',
|
||||
'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 1',
|
||||
'perms' => '$user->rights->banque->configurer',
|
||||
'target' => '',
|
||||
'user' => 0
|
||||
|
||||
@ -132,12 +132,12 @@ if (GETPOST('search_task') != '')
|
||||
|
||||
if (GETPOST('search_user') != '')
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/user/index.php?mode=search&sall='.urlencode(GETPOST('search_user')));
|
||||
header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user')));
|
||||
exit;
|
||||
}
|
||||
if (GETPOST('search_group') != '')
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/user/group/index.php?mode=search&sall='.urlencode(GETPOST('search_group')));
|
||||
header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group')));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
106
htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php
Normal file
106
htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- START TEMPLATE IMPORT OBJECT LINKED LINES -->
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.objectlinked_importbtn').click(function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
var page = $(this).attr("href");
|
||||
|
||||
var fromelement = $(this).attr("data-element");
|
||||
var fromelementid = $(this).attr("data-id");
|
||||
|
||||
if( page != undefined && fromelement != undefined && fromelementid != undefined)
|
||||
{
|
||||
var windowWidth = $(window).width()*0.8; //retrieve current window width
|
||||
var windowHeight = $(window).height()*0.8; //retrieve current window height
|
||||
var htmlLines;
|
||||
var formId = "ajaxloaded_tablelinesform_" + fromelement + "_" + fromelementid;
|
||||
$.get(page, function (data) {
|
||||
htmlLines = $(data).find('#tablelines') ;
|
||||
});
|
||||
|
||||
|
||||
var $dialog = $('<form id="' + formId + '" action="<?php print $object->getNomUrl(0,'',0,1); ?>" method="post" ></form>')
|
||||
.load( page + " #tablelines", function() {
|
||||
|
||||
$("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute
|
||||
|
||||
$("#" + formId + " .linecheckbox,#" + formId + " .linecheckboxtoggle").prop("checked", true); // checked by default
|
||||
|
||||
// reload checkbox toggle function
|
||||
$("#" + formId + " .linecheckboxtoggle").click(function(){
|
||||
var checkBoxes = $("#" + formId + " .linecheckbox");
|
||||
checkBoxes.prop("checked", this.checked);
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
.html(htmlLines)
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: windowHeight,
|
||||
width: windowWidth,
|
||||
title: "<?php echo $langs->trans('LinesToImport'); ?>",
|
||||
buttons: {
|
||||
"<?php echo $langs->trans('Import'); ?>": function() {
|
||||
$( this ).dialog( "close" );
|
||||
$("#" + formId).append('<input type="hidden" name="action" value="import_lines_from_object" />');
|
||||
$("#" + formId).append('<input type="hidden" name="fromelement" value="' + fromelement + '" />');
|
||||
$("#" + formId).append('<input type="hidden" name="fromelementid" value="' + fromelementid + '" />');
|
||||
$("#" + formId).submit();
|
||||
},
|
||||
"<?php echo $langs->trans('Cancel'); ?>": function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
}
|
||||
else
|
||||
{
|
||||
$.jnotify("<?php echo $langs->trans('ErrorNoUrl'); ?>", "error", true);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.objectlinked_importbtn{
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
<!-- END TEMPLATE IMPORT OBJECT LINKED LINES -->
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,6 +23,7 @@
|
||||
* $modelmail
|
||||
* $defaulttopic
|
||||
* $diroutput
|
||||
* $arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...);
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
@ -144,8 +145,11 @@ if ($action == 'presend')
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
if (is_object($object->thirdparty))
|
||||
{
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,8 +162,11 @@ if ($action == 'presend')
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
//$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...);
|
||||
if (! isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude=null;
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
|
||||
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
|
||||
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
|
||||
$substitutionarray['__CONTACTCIVNAME__'] = '';
|
||||
@ -179,8 +186,6 @@ if ($action == 'presend')
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
$formmail->param['fileinit'] = array($file);
|
||||
|
||||
$formmail->withsubstit = 1;
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
|
||||
@ -56,10 +56,17 @@ if (empty($senderissupplier)) $senderissupplier=0;
|
||||
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
|
||||
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
|
||||
// add html5 elements
|
||||
$domData = ' data-element="'.$line->element.'"';
|
||||
$domData .= ' data-id="'.$line->id.'"';
|
||||
$domData .= ' data-qty="'.$line->qty.'"';
|
||||
$domData .= ' data-product_type="'.$line->product_type.'"';
|
||||
|
||||
|
||||
?>
|
||||
<?php $coldisplay=0; ?>
|
||||
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; echo $domData; ?> >
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td class="linecolnum" align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
@ -264,7 +271,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
|
||||
|
||||
<?php
|
||||
if ($this->statut == 0 && ($object_rights->creer)) { ?>
|
||||
if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?>
|
||||
<td class="linecoledit" align="center"><?php $coldisplay++; ?>
|
||||
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?>
|
||||
<?php } else { ?>
|
||||
@ -304,6 +311,9 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
<?php } else { ?>
|
||||
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
|
||||
<?php } ?>
|
||||
<?php if($action == 'selectlines'){ ?>
|
||||
<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
@ -614,6 +614,22 @@ else
|
||||
print $langs->trans($object->note);
|
||||
print "</td></tr>";
|
||||
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('Entity')."</td><td>";
|
||||
if (! $object->entity)
|
||||
{
|
||||
print $langs->trans("AllEntities");
|
||||
}
|
||||
else
|
||||
{
|
||||
$mc->getInfo($obj->entity);
|
||||
print $mc->label;
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ class Cronjob extends CommonObject
|
||||
public $table_element='cronjob'; //!< Name of table without prefix where object is stored
|
||||
public $picto = 'cron';
|
||||
|
||||
public $entity;
|
||||
public $jobtype;
|
||||
public $tms='';
|
||||
public $datec='';
|
||||
@ -158,7 +159,7 @@ class Cronjob extends CommonObject
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob(";
|
||||
|
||||
$sql.= "entity,";
|
||||
$sql.= "datec,";
|
||||
$sql.= "jobtype,";
|
||||
$sql.= "label,";
|
||||
@ -188,6 +189,7 @@ class Cronjob extends CommonObject
|
||||
$sql.= "libname,";
|
||||
$sql.= "test";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " ".(! isset($this->entity)?$conf->entity:$this->db->escape($this->entity)).",";
|
||||
$sql.= " '".$this->db->idate($now)."',";
|
||||
$sql.= " ".(! isset($this->jobtype)?'NULL':"'".$this->db->escape($this->jobtype)."'").",";
|
||||
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
|
||||
@ -270,8 +272,8 @@ class Cronjob extends CommonObject
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.entity,";
|
||||
$sql.= " t.tms,";
|
||||
$sql.= " t.datec,";
|
||||
$sql.= " t.jobtype,";
|
||||
@ -315,7 +317,7 @@ class Cronjob extends CommonObject
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->entity = $obj->entity;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->label = $obj->label;
|
||||
@ -422,7 +424,7 @@ class Cronjob extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
if (!empty($limit) && !empty($offset)) {
|
||||
$sql.= $this->db->plimit($limit + 1,$offset);
|
||||
}
|
||||
@ -450,7 +452,6 @@ class Cronjob extends CommonObject
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->ref = $obj->rowid;
|
||||
|
||||
$line->entity = $obj->entity;
|
||||
$line->tms = $this->db->jdate($obj->tms);
|
||||
$line->datec = $this->db->jdate($obj->datec);
|
||||
@ -580,7 +581,7 @@ class Cronjob extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."cronjob SET";
|
||||
|
||||
$sql.= " entity=".(isset($this->entity)?$this->db->escape($this->entity):$conf->entity).",";
|
||||
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
$sql.= " jobtype=".(isset($this->jobtype)?"'".$this->db->escape($this->jobtype)."'":"null").",";
|
||||
$sql.= " command=".(isset($this->command)?"'".$this->db->escape($this->command)."'":"null").",";
|
||||
@ -778,7 +779,7 @@ class Cronjob extends CommonObject
|
||||
{
|
||||
$this->id=0;
|
||||
$this->ref=0;
|
||||
|
||||
$this->entity=0;
|
||||
$this->tms='';
|
||||
$this->datec='';
|
||||
$this->label='';
|
||||
@ -935,6 +936,16 @@ class Cronjob extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Force the environment of running to the environment declared for job, so jobs launched from command line will run into correct environment
|
||||
// When job is ran from GUI, the environment should already be same, except if job has entity 0 (visible into all environments)
|
||||
if ($conf->entity != $this->entity && $this->entity > 0)
|
||||
{
|
||||
dol_syslog("We try to run a job in entity ".$this->entity." when we are in entity ".$conf->entity, LOG_WARNING);
|
||||
}
|
||||
$savcurrententity = $conf->entity;
|
||||
$conf->entity = $this->entity;
|
||||
dol_syslog(get_class($this)."::run_jobs entity for running job is ".$conf->entity);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$user=new User($this->db);
|
||||
$result=$user->fetch('',$userlogin);
|
||||
@ -942,6 +953,7 @@ class Cronjob extends CommonObject
|
||||
{
|
||||
$this->error="User Error:".$user->error;
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->entity = $savcurrententity;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@ -950,6 +962,7 @@ class Cronjob extends CommonObject
|
||||
{
|
||||
$this->error=" User user login:".$userlogin." do not exists";
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->entity = $savcurrententity;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -981,6 +994,7 @@ class Cronjob extends CommonObject
|
||||
$result = $this->update($user); // This include begin/commit
|
||||
if ($result<0) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->entity = $savcurrententity;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1079,6 +1093,7 @@ class Cronjob extends CommonObject
|
||||
{
|
||||
$this->error = $langs->trans('CronCannotLoadLib') . ': ' . $libpath;
|
||||
dol_syslog(get_class($this) . "::run_jobs " . $this->error, LOG_ERR);
|
||||
$conf->entity = $savcurrententity;
|
||||
return -1;
|
||||
}
|
||||
// Load langs
|
||||
@ -1086,6 +1101,7 @@ class Cronjob extends CommonObject
|
||||
if ($result<0)
|
||||
{
|
||||
dol_syslog(get_class($this) . "::run_jobs Cannot load module langs" . $langs->error, LOG_ERR);
|
||||
$conf->entity = $savcurrententity;
|
||||
return -1;
|
||||
}
|
||||
dol_syslog(get_class($this) . "::run_jobs " . $this->libname . "::" . $this->methodename."(" . $this->params . ");", LOG_DEBUG);
|
||||
@ -1148,13 +1164,12 @@ class Cronjob extends CommonObject
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->entity = $savcurrententity;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $error?-1:1;
|
||||
}
|
||||
|
||||
$conf->entity = $savcurrententity;
|
||||
return $error?-1:1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -245,7 +245,7 @@ $sql.= " t.nbrun,";
|
||||
$sql.= " t.libname,";
|
||||
$sql.= " t.test";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
||||
if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1');
|
||||
if ($search_status == 2) $sql.= " AND t.status = 2";
|
||||
//Manage filter
|
||||
|
||||
@ -131,7 +131,9 @@ if ($resql)
|
||||
//if ($page > 0) $param.= '&page='.$page;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords);
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/don/card.php?action=create">'.$langs->trans('NewDonation').'</a>';
|
||||
|
||||
print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords, 'title_generic.png', 0, $newcardbutton);
|
||||
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
||||
@ -148,12 +148,13 @@ if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
$numtoselect = (is_array($toselect)?count($toselect):0);
|
||||
if (! empty($massaction) && $numtoselect < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
if (! $error && $numtoselect > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
@ -264,6 +265,12 @@ if ($resql)
|
||||
|
||||
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->expedition->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create2">'.$langs->trans('NewSending').'</a>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -274,7 +281,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
@ -541,7 +548,7 @@ if ($resql)
|
||||
{
|
||||
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
|
||||
$receiving='';
|
||||
if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
|
||||
if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
|
||||
|
||||
if (! empty($arrayfields['l.ref']['checked']))
|
||||
{
|
||||
|
||||
@ -2090,7 +2090,7 @@ else
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
$formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1);
|
||||
$formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -1241,7 +1241,7 @@ class ExpenseReport extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
// date approval
|
||||
$this->date_approve = $this->db->idate($now);
|
||||
$this->date_approve = $now;
|
||||
if ($this->fk_statut != 5)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -380,7 +380,7 @@ if ($resql)
|
||||
if ($id > 0) // For user tab
|
||||
{
|
||||
$title = $langs->trans("User");
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$head = user_prepare_head($fuser);
|
||||
|
||||
dol_fiche_head($head, 'expensereport', $title, -1, 'user');
|
||||
@ -465,7 +465,14 @@ if ($resql)
|
||||
else
|
||||
{
|
||||
$title = $langs->trans("ListTripsAndExpenses");
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->expensereport->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create">'.$langs->trans('NewTrip').'</a>';
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
|
||||
}
|
||||
|
||||
$topicmail="SendExpenseReport";
|
||||
|
||||
@ -271,6 +271,12 @@ if ($resql)
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create">'.$langs->trans('NewIntervention').'</a>';
|
||||
}
|
||||
|
||||
// Lines of title fields
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -282,7 +288,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="Information";
|
||||
$modelmail="intervention";
|
||||
|
||||
@ -1948,6 +1948,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
/**
|
||||
* Return array of dispathed lines waiting to be approved for this order
|
||||
*
|
||||
* @since 8.0 Return dispatched quantity (qty).
|
||||
*
|
||||
* @param int $status Filter on stats (-1 = no filter, 0 = lines draft to be approved, 1 = approved lines)
|
||||
* @return array Array of lines
|
||||
@ -1959,7 +1961,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
// List of already dispatched lines
|
||||
$sql = "SELECT p.ref, p.label,";
|
||||
$sql.= " e.rowid as warehouse_id, e.ref as entrepot,";
|
||||
$sql.= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status";
|
||||
$sql.= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid";
|
||||
@ -1977,7 +1979,15 @@ class CommandeFournisseur extends CommonOrder
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resql);
|
||||
if ($objp) $ret[]=array('id'=>$objp->dispatchedlineid, 'productid'=>$objp->fk_product, 'warehouseid'=>$objp->warehouse_id);
|
||||
if ($objp)
|
||||
{
|
||||
$ret[] = array(
|
||||
'id' => $objp->dispatchedlineid,
|
||||
'productid' => $objp->fk_product,
|
||||
'warehouseid' => $objp->warehouse_id,
|
||||
'qty' => $objp->qty,
|
||||
);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -645,6 +645,12 @@ if ($resql)
|
||||
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create">'.$langs->trans('NewOrder').'</a>';
|
||||
}
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -657,8 +663,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_supplier_send";
|
||||
|
||||
@ -471,6 +471,12 @@ if ($resql)
|
||||
if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create">'.$langs->trans('NewBill').'</a>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -483,7 +489,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="supplier_invoice_send";
|
||||
|
||||
@ -342,7 +342,7 @@ if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
if ($id > 0) // For user tab
|
||||
{
|
||||
$title = $langs->trans("User");
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$head = user_prepare_head($fuser);
|
||||
|
||||
dol_fiche_head($head, 'paidholidays', $title, -1, 'user');
|
||||
@ -377,7 +377,10 @@ else
|
||||
$nbtotalofrecords = count($holiday->holiday);
|
||||
//print $num;
|
||||
//print count($holiday->holiday);
|
||||
print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, '', '', $limit);
|
||||
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/holiday/card.php?action=request">'.$langs->trans('MenuAddCP').'</a>';
|
||||
|
||||
print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$topicmail="Information";
|
||||
$modelmail="leaverequest";
|
||||
|
||||
@ -262,7 +262,7 @@ if (empty($user->societe_id))
|
||||
);
|
||||
// Dashboard Link lines
|
||||
$links=array(
|
||||
DOL_URL_ROOT.'/user/index.php',
|
||||
DOL_URL_ROOT.'/user/list.php',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies',
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
||||
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
-- Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
-- Copyright (C) 2011-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
-- Copyright (C) 2015-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
@ -35,6 +35,7 @@ INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES
|
||||
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'Other Journal', 1, 1, 1);
|
||||
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'Has new Journal', 9, 1, 1);
|
||||
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'Expense Report Journal', 5, 1, 1);
|
||||
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'Inventory Journal' , 8, 1, 1);
|
||||
|
||||
|
||||
-- Description of chart of account FR PCG99-ABREGE
|
||||
|
||||
@ -41,6 +41,11 @@ DROP TABLE llx_c_accountingaccount;
|
||||
|
||||
update llx_propal set fk_statut = 1 where fk_statut = -1;
|
||||
|
||||
ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer;
|
||||
ALTER TABLE llx_inventory ADD COLUMN fk_user_modif integer;
|
||||
ALTER TABLE llx_inventory ADD COLUMN fk_user_valid integer;
|
||||
ALTER TABLE llx_inventory ADD COLUMN import_key varchar(14);
|
||||
|
||||
|
||||
-- For 8.0
|
||||
|
||||
@ -335,5 +340,66 @@ INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_u
|
||||
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,1,1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,<br><br>\n\n__(ThisIsContentOfYourCard)__<br>\n__(ID)__ : __ID__<br>\n__(Civiliyty)__ : __MEMBER_CIVILITY__<br>\n__(Firstname)__ : __MEMBER_FIRSTNAME__<br>\n__(Lastname)__ : __MEMBER_LASTNAME__<br>\n__(Fullname)__ : __MEMBER_FULLNAME__<br>\n__(Company)__ : __MEMBER_COMPANY__<br>\n__(Address)__ : __MEMBER_ADDRESS__<br>\n__(Zip)__ : __MEMBER_ZIP__<br>\n__(Town)__ : __MEMBER_TOWN__<br>\n__(Country)__ : __MEMBER_COUNTRY__<br>\n__(Email)__ : __MEMBER_EMAIL__<br>\n__(Birthday)__ : __MEMBER_BIRTH__<br>\n__(Photo)__ : __MEMBER_PHOTO__<br>\n__(Login)__ : __MEMBER_LOGIN__<br>\n__(Password)__ : __MEMBER_PASSWORD__<br>\n__(Phone)__ : __MEMBER_PHONE__<br>\n__(PhonePerso)__ : __MEMBER_PHONEPRO__<br>\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 1);
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN fk_default_warehouse integer DEFAULT NULL;
|
||||
ALTER TABLE llx_product ADD CONSTRAINT fk_product_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid);
|
||||
ALTER TABLE llx_product ADD CONSTRAINT fk_product_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid);
|
||||
|
||||
-- Assets
|
||||
CREATE TABLE llx_asset(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
ref varchar(128) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
label varchar(255),
|
||||
amount double(24,8) DEFAULT NULL,
|
||||
fk_asset_type integer NOT NULL,
|
||||
fk_soc integer,
|
||||
description text,
|
||||
note_public text,
|
||||
note_private text,
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14),
|
||||
status integer NOT NULL
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
|
||||
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
|
||||
ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid);
|
||||
|
||||
create table llx_asset_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14)
|
||||
) ENGINE=innodb;
|
||||
|
||||
create table llx_asset_type
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
tms timestamp,
|
||||
label varchar(50) NOT NULL,
|
||||
accountancy_code_asset varchar(32),
|
||||
accountancy_code_depreciation_asset varchar(32),
|
||||
accountancy_code_depreciation_expense varchar(32),
|
||||
note text
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_asset_type ADD UNIQUE INDEX uk_asset_type_label (label, entity);
|
||||
|
||||
create table llx_asset_type_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_asset_type_extrafields ADD INDEX idx_asset_type_extrafields (fk_object);
|
||||
|
||||
INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (7,'INV', 'Inventory journal', 8, 1);
|
||||
|
||||
24
htdocs/install/mysql/tables/llx_asset.key.sql
Normal file
24
htdocs/install/mysql/tables/llx_asset.key.sql
Normal file
@ -0,0 +1,24 @@
|
||||
-- Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
|
||||
|
||||
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
|
||||
ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid);
|
||||
|
||||
34
htdocs/install/mysql/tables/llx_asset.sql
Normal file
34
htdocs/install/mysql/tables/llx_asset.sql
Normal file
@ -0,0 +1,34 @@
|
||||
-- Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
CREATE TABLE llx_asset(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
ref varchar(128) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
label varchar(255),
|
||||
amount double(24,8) DEFAULT NULL,
|
||||
fk_asset_type integer NOT NULL,
|
||||
fk_soc integer,
|
||||
description text,
|
||||
note_public text,
|
||||
note_private text,
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14),
|
||||
status integer NOT NULL
|
||||
) ENGINE=innodb;
|
||||
23
htdocs/install/mysql/tables/llx_asset_extrafields.sql
Normal file
23
htdocs/install/mysql/tables/llx_asset_extrafields.sql
Normal file
@ -0,0 +1,23 @@
|
||||
-- Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
create table llx_asset_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
16
htdocs/install/mysql/tables/llx_asset_type.key.sql
Normal file
16
htdocs/install/mysql/tables/llx_asset_type.key.sql
Normal file
@ -0,0 +1,16 @@
|
||||
-- Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ALTER TABLE llx_asset_type ADD UNIQUE INDEX uk_asset_type_label (label, entity);
|
||||
26
htdocs/install/mysql/tables/llx_asset_type.sql
Normal file
26
htdocs/install/mysql/tables/llx_asset_type.sql
Normal file
@ -0,0 +1,26 @@
|
||||
-- Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
create table llx_asset_type
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
tms timestamp,
|
||||
label varchar(50) NOT NULL,
|
||||
accountancy_code_asset varchar(32),
|
||||
accountancy_code_depreciation_asset varchar(32),
|
||||
accountancy_code_depreciation_expense varchar(32),
|
||||
note text
|
||||
)ENGINE=innodb;
|
||||
@ -0,0 +1,17 @@
|
||||
-- Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
ALTER TABLE llx_asset_type_extrafields ADD INDEX idx_asset_type_extrafields (fk_object);
|
||||
23
htdocs/install/mysql/tables/llx_asset_type_extrafields.sql
Normal file
23
htdocs/install/mysql/tables/llx_asset_type_extrafields.sql
Normal file
@ -0,0 +1,23 @@
|
||||
-- Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
create table llx_asset_type_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -235,11 +235,12 @@ AccountingJournal=Accounting journal
|
||||
NewAccountingJournal=New accounting journal
|
||||
ShowAccoutingJournal=Show accounting journal
|
||||
Nature=Nature
|
||||
AccountingJournalType1=Miscellaneous operation
|
||||
AccountingJournalType1=Miscellaneous operations
|
||||
AccountingJournalType2=Sales
|
||||
AccountingJournalType3=Purchases
|
||||
AccountingJournalType4=Bank
|
||||
AccountingJournalType5=Expenses report
|
||||
AccountingJournalType8=Inventory
|
||||
AccountingJournalType9=Has-new
|
||||
ErrorAccountingJournalIsAlreadyUse=This journal is already use
|
||||
AccountingAccountForSalesTaxAreDefinedInto=Note: Accounting account for Sales tax are defined into menu <b>%s</b> - <b>%s</b>
|
||||
|
||||
@ -1729,6 +1729,7 @@ MailToSendContract=To send a contract
|
||||
MailToThirdparty=To send email from third party page
|
||||
MailToMember=To send email from member page
|
||||
MailToUser=To send email from user page
|
||||
MailToProject= To send email from project page
|
||||
ByDefaultInList=Show by default on list view
|
||||
YouUseLastStableVersion=You use the latest stable version
|
||||
TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites)
|
||||
|
||||
48
htdocs/langs/en_US/assets.lang
Normal file
48
htdocs/langs/en_US/assets.lang
Normal file
@ -0,0 +1,48 @@
|
||||
# Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# Generic
|
||||
#
|
||||
Assets = Assets
|
||||
NewAsset = New asset
|
||||
AccountancyAccountAsset = Accounting code (asset)
|
||||
AccountancyAccountDepreciationAsset = Accounting code (depreciation asset account)
|
||||
AccountancyAccountDepreciationExpense = Accounting code (depreciation expense account)
|
||||
|
||||
# Module label 'ModuleAssetsName'
|
||||
ModuleAssetsName = Assets
|
||||
# Module description 'ModuleAssetsDesc'
|
||||
ModuleAssetsDesc = Assets description
|
||||
|
||||
#
|
||||
# Admin page
|
||||
#
|
||||
AssetsSetup = Assets setup
|
||||
Settings = Settings
|
||||
AssetsSetupPage = Assets setup page
|
||||
ExtraFieldsAssetsType = Complementary attributes (Assets type)
|
||||
AssetsType=Asset type
|
||||
AssetsTypeId=Asset type id
|
||||
AssetsTypeLabel=Asset type label
|
||||
AssetsTypes=Assets types
|
||||
|
||||
#
|
||||
# Menu
|
||||
#
|
||||
MenuAssets = Assets
|
||||
MenuNewAsset = New asset
|
||||
MenuTypeAssets = Type
|
||||
MenuListAssets = List
|
||||
@ -103,6 +103,7 @@ LT2PaymentsES=IRPF Payments
|
||||
VATPayment=Sales tax payment
|
||||
VATPayments=Sales tax payments
|
||||
VATRefund=Sales tax refund
|
||||
NewVATPayment=New sales tax payment
|
||||
Refund=Refund
|
||||
SocialContributionsPayments=Social/fiscal taxes payments
|
||||
ShowVatPayment=Show VAT payment
|
||||
|
||||
@ -78,6 +78,7 @@ ResultOfMailSending=Result of mass EMail sending
|
||||
NbSelected=Nb selected
|
||||
NbIgnored=Nb ignored
|
||||
NbSent=Nb sent
|
||||
SentXXXmessages=%s message(s) sent.
|
||||
ConfirmUnvalidateEmailing=Are you sure you want to change email <b>%s</b> to draft status?
|
||||
MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters
|
||||
MailingModuleDescContactsByCompanyCategory=Contacts by third party category
|
||||
|
||||
@ -246,3 +246,4 @@ WEBSITE_PAGEURL=URL of page
|
||||
WEBSITE_TITLE=Title
|
||||
WEBSITE_DESCRIPTION=Description
|
||||
WEBSITE_KEYWORDS=Keywords
|
||||
LinesToImport=Lines to import
|
||||
|
||||
@ -226,3 +226,4 @@ AllowCommentOnProject=Allow user comments on projects
|
||||
DontHavePermissionForCloseProject=You do not have permissions to close the project %s
|
||||
DontHaveTheValidateStatus=The project %s must be open to be closed
|
||||
RecordsClosed=%s project(s) closed
|
||||
SendProjectRef=About project %s
|
||||
|
||||
@ -49,6 +49,7 @@ OAUTH_STRIPE_LIVE_ID=Stripe Connect Client ID (ca_...)
|
||||
BankAccountForBankTransfer=Bank account for fund payouts
|
||||
StripeAccount=Stripe account
|
||||
StripeChargeList=List of Stripe charges
|
||||
StripeTransactionList=List of Stripe transactions
|
||||
StripeCustomerId=Stripe customer id
|
||||
StripePaymentModes=Stripe payment modes
|
||||
LocalID=Local ID
|
||||
|
||||
@ -111,6 +111,12 @@ if ($resql)
|
||||
if ($search_amount) $param.="&search_amount=".urlencode($search_amount_ht);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
$newcardbutton='<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?action=create">'.$langs->trans('NewLoan').'</a>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -120,7 +126,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user