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

This commit is contained in:
Frédéric FRANCE 2019-11-03 21:48:24 +01:00
commit 872f58f261
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
673 changed files with 6221 additions and 4587 deletions

View File

@ -25,7 +25,10 @@ Following changes may create regressions for some external modules, but were nec
* The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE.
* The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS.
* If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu.
* All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'.
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
* All properties 'type_libelle' were renamed into 'type_label'.
* Renamed property of thirdparty "statut_commercial" into "status_prospect_label"
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
@ -47,7 +50,6 @@ FIX: Clean the + of categories on the product view only in POS module
FIX: access to public interface when origin email has an alias.
FIX: Alias name is not into the email recipient label.
FIX: allow standalone credit note even if no invoice
FIX: an admin can not access his own permissions after enabling advanced
FIX: an admin can not access his own permissions after enabling advanced permissions
FIX: Attachement of linked files on ticket when sending a message
FIX: avoid non numeric warning
@ -116,17 +118,17 @@ FIX: #11752
FIX: #11789 FIX: #11790
FIX: #11804 list of tickets from a customer card display ALL tickets
FIX: #11834
FIX: Add char $ and ; in sanitizing of filenames.
FIX: Add comment before protected functions
FIX: Add log and type of content in dolWebsiteOutput and
FIX: Add repair.php option 'restore' to restore user picture after v10
FIX: add char $ and ; in sanitizing of filenames
FIX: add comment before protected functions
FIX: add log and type of content in dolWebsiteOutput and
FIX: add repair.php option 'restore' to restore user picture after v10
FIX: amount opened on thirdparty card dont care of credit note not converted
FIX: Api of documents work with value 'thirdparty'
FIX: API of documents work with value 'thirdparty'
FIX: author in message / ticket API
FIX: avoid sql error if fk_project is empty during update
FIX: avoid SQL error if fk_project is empty during update
FIX: avoid Warning: A non-numeric value encountered
FIX: bad consistency in list of invoice for direct debit order.
FIX: Bad error management in zip compress and web site export
FIX: bad consistency in list of invoice for direct debit order
FIX: bad error management in zip compress and web site export
FIX: bad substitution for extrafields type checkbox
FIX: better help message with multicompany
FIX: calculation of $products_dispatched
@ -135,11 +137,11 @@ FIX: Can't delete a draft leave even if it should
FIX: Can't save setup of mailman module
FIX: column jabberid missing
FIX: Confirmation of deletion
FIX: Consistency in direct debit order lists.
FIX: Consistency in direct debit order lists
FIX: Content send before header warning
FIX: credit note can be split
FIX: credit note used on list
FIX: Css was saved on wrong website.
FIX: CSS was saved on wrong website
FIX: delivery extrafields
FIX: Disabling a website does not put it offline
FIX: display only stripe sources for customer
@ -156,13 +158,13 @@ FIX: Fatal situation if payment removed on expense report. Action
FIX: filepath of generated documents doesn't handle products with special characters
FIX: for MAIN_MAXTABS_IN_CARD = $i card
FIX: gzip and bzip2 must use option -f
FIX: It was possible to create cashfence without entering data.
FIX: it was possible to create cashfence without entering data
FIX: javascript error when using dol_use_jmobile=1
FIX: logout redirect to takepos.php
FIX: Look and feel v10
FIX: Make protected all pfd models functions
FIX: management of extrafields in modulebuilder
FIX: Missing div for buttons in tax, loan, various payment modules
FIX: missing div for buttons in tax, loan, various payment modules
FIX: missing include (dol_convert_file not found)
FIX: Missing some replacements in website module
FIX: missing test on permission on button to delete ledger record
@ -186,13 +188,13 @@ FIX: Return code of pdf_einstein.modules.php and proformat
FIX: round for application fee in stripe
FIX: Sens of the balance (Debit - Credit in accountancy not contrary)
FIX: Several pb in export of documents
FIX: SQL syntax error and CSRF check on vat reports
FIX: SQL syntax error and CSRF check on VAT reports
FIX: takepos layout clear or focus search
FIX: too many record in sql request. Whena criteria is a filter, we must
FIX: too many record in sql request. When a criteria is a filter, we must
FIX: Translation of month
FIX: USEDOLIBARREDITOR not always set
FIX: VAT number for Monaco (it uses FR)
FIX: vulenrability in uploading file found by 美创科技安全实验室
FIX: vulnerability in uploading file found by 美创科技安全实验室
FIX: wrong display (and hidden input) for already dispatched quantity
FIX: wrong parameters (same error in branch 9, 10, develop)
FIX: Wrong variable. Must be PROJECT_HIDE_UNSELECTABLES

View File

@ -46,7 +46,7 @@ $search_pcgtype = GETPOST('search_pcgtype', 'alpha');
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
// Security check
if ($user->societe_id > 0) accessforbidden();
if ($user->socid > 0) accessforbidden();
if (! $user->rights->accounting->chartofaccount) accessforbidden();
// Load variable for pagination

View File

@ -71,7 +71,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
// Security check
if ($user->societe_id > 0) accessforbidden();
if ($user->socid > 0) accessforbidden();
if (! $user->rights->accounting->chartofaccount) accessforbidden();

View File

@ -43,7 +43,7 @@ if (! $sortorder) $sortorder="ASC";
$langs->loadLangs(array("admin","compta"));
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear->write) // If we can read accounting records, we should be able to see fiscal year.
accessforbidden();

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
$langs->loadLangs(array("admin","compta"));
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (empty($user->rights->accounting->fiscalyear->write))
accessforbidden();

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
$langs->loadLangs(array("admin","compta"));
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear->write)
accessforbidden();

View File

@ -45,7 +45,7 @@ $mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
$piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id)
// Security check
if ($user->societe_id > 0) {
if ($user->socid > 0) {
accessforbidden();
}

View File

@ -83,7 +83,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
// Security check
$socid = GETPOST("socid", 'int');
// if ($user->societe_id) $socid=$user->societe_id;
// if ($user->socid) $socid=$user->socid;
$lettering = new Lettering($db);
$object = new Societe($db);
@ -139,7 +139,7 @@ dol_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'com
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_fiche_end();

View File

@ -83,7 +83,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
// Security check
$socid = GETPOST("socid", 'int');
// if ($user->societe_id) $socid=$user->societe_id;
// if ($user->socid) $socid=$user->socid;
$lettering = new Lettering($db);
$object = new Societe($db);
@ -138,7 +138,7 @@ dol_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'com
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_fiche_end();

View File

@ -638,11 +638,11 @@ class AccountingAccount extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $status Id status
* @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
*/
public function LibStatut($statut, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
@ -650,34 +650,33 @@ class AccountingAccount extends CommonObject
if ($mode == 0)
{
$prefix='';
if ($statut == 1) return $langs->trans('Enabled');
elseif ($statut == 0) return $langs->trans('Disabled');
if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled');
}
elseif ($mode == 1)
{
if ($statut == 1) return $langs->trans('Enabled');
elseif ($statut == 0) return $langs->trans('Disabled');
if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled');
}
elseif ($mode == 2)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 3)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5');
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 4)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 5)
{
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
}
}
}

View File

@ -1975,7 +1975,12 @@ class BookKeepingLine
public $code_journal;
public $journal_label;
public $piece_num;
/**
* @var integer|string date_creation
*/
public $date_creation;
public $date_modification;
public $date_export;
}

View File

@ -34,7 +34,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear->write)
accessforbidden();

View File

@ -34,7 +34,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear->write)
accessforbidden();

View File

@ -38,7 +38,7 @@ $codeventil = GETPOST('codeventil');
$id = GETPOST('id');
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();

View File

@ -39,7 +39,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -72,7 +72,7 @@ if (! $sortorder) {
}
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -83,7 +83,7 @@ if (! $sortorder) {
}
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil');
$id = GETPOST('id');
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();

View File

@ -36,7 +36,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -67,7 +67,7 @@ if (! $sortorder) {
}
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -77,7 +77,7 @@ if (! $sortorder) {
}
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
$langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict"));
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks

View File

@ -80,7 +80,7 @@ $now = dol_now();
$action = GETPOST('action', 'aZ09');
// Security check
if ($user->societe_id > 0 && empty($id_journal))
if ($user->socid > 0 && empty($id_journal))
accessforbidden();
@ -323,11 +323,11 @@ if ($result) {
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
$chargestatic->label = $langs->trans($reg[1]);
} else {
$chargestatic->lib = $links[$key]['label'];
$chargestatic->label = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->lib;
$chargestatic->ref = $chargestatic->label;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;

View File

@ -56,7 +56,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
$now = dol_now();
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
/*

View File

@ -56,7 +56,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
$now = dol_now();
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
$hookmanager->initHooks(array('purchasesjournal'));

View File

@ -58,7 +58,7 @@ if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
$now = dol_now();
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
$hookmanager->initHooks(array('sellsjournal'));

View File

@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil');
$id = GETPOST('id');
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();

View File

@ -37,7 +37,7 @@ $langs->loadLangs(array("compta","bills","other","main","accountancy"));
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -74,7 +74,7 @@ if (! $sortorder) {
}
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -83,7 +83,7 @@ if (! $sortorder) {
}
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
accessforbidden();
if (! $user->rights->accounting->bind->write)
accessforbidden();

View File

@ -118,7 +118,7 @@ if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['act
<?php echo $this->control->tpl['showend'];
if (empty($user->societe_id)) {
if (empty($user->socid)) {
echo '<div class="tabsAction">';
if ($user->rights->adherent->creer) {

View File

@ -1867,7 +1867,7 @@ else
}
// Create user
if (! $user->societe_id && ! $object->user_id)
if (! $user->socid && ! $object->user_id)
{
if ($user->rights->user->user->creer)
{

View File

@ -183,7 +183,7 @@ class Adherent extends CommonObject
// -1:brouillon, 0:resilie, >=1:valide,paye
// def in common object
//public $statut;
//public $status;
public $photo;
@ -2165,61 +2165,61 @@ class Adherent extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $status Id status
* @param int $need_subscription 1 if member type need subscription, 0 otherwise
* @param int $date_end_subscription Date fin adhesion
* @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
*/
public function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0)
public function LibStatut($status, $need_subscription, $date_end_subscription, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->load("members");
$statusType = '';
$labelstatut = '';
$labelstatutShort = '';
$labelStatus = '';
$labelStatusShort = '';
if ($statut == -1)
if ($status == -1)
{
$statusType = 'status0';
$labelstatut = $langs->trans("MemberStatusDraft");
$labelstatutShort = $langs->trans("MemberStatusDraftShort");
$labelStatus = $langs->trans("MemberStatusDraft");
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
}
elseif ($statut >= 1) {
elseif ($status >= 1) {
if ($need_subscription == 0)
{
$statusType = 'status4';
$labelstatut = $langs->trans("MemberStatusNoSubscription");
$labelstatutShort = $langs->trans("MemberStatusNoSubscriptionShort");
$labelStatus = $langs->trans("MemberStatusNoSubscription");
$labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort");
}
elseif (! $date_end_subscription)
{
$statusType = 'status1';
$labelstatut = $langs->trans("MemberStatusActive");
$labelstatutShort = $langs->trans("MemberStatusActiveShort");
$labelStatus = $langs->trans("MemberStatusActive");
$labelStatusShort = $langs->trans("MemberStatusActiveShort");
}
elseif ($date_end_subscription < time())
{
$statusType = 'status3';
$labelstatut = $langs->trans("MemberStatusActiveLate");
$labelstatutShort = $langs->trans("MemberStatusActiveLateShort");
$labelStatus = $langs->trans("MemberStatusActiveLate");
$labelStatusShort = $langs->trans("MemberStatusActiveLateShort");
}
else {
$statusType = 'status4';
$labelstatut = $langs->trans("MemberStatusPaid");
$labelstatutShort = $langs->trans("MemberStatusPaidShort");
$labelStatus = $langs->trans("MemberStatusPaid");
$labelStatusShort = $langs->trans("MemberStatusPaidShort");
}
}
elseif ($statut == 0)
elseif ($status == 0)
{
$statusType = 'status6';
$labelstatut = $langs->trans("MemberStatusResiliated");
$labelstatutShort = $langs->trans("MemberStatusResiliatedShort");
$labelStatus = $langs->trans("MemberStatusResiliated");
$labelStatusShort = $langs->trans("MemberStatusResiliatedShort");
}
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}

View File

@ -70,7 +70,7 @@ class AdherentStats extends Stats
$this->where.= " m.statut != 0";
$this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if($this->memberid)
{
$this->where .= " AND m.rowid = ".$this->memberid;
@ -92,7 +92,7 @@ class AdherentStats extends Stats
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
$sql.= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
@ -112,7 +112,7 @@ class AdherentStats extends Stats
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
$sql.= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
@ -133,7 +133,7 @@ class AdherentStats extends Stats
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
$sql.= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";

View File

@ -431,10 +431,10 @@ class Subscription extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $status Id status
* @return string Label
*/
public function LibStatut($statut)
public function LibStatut($status)
{
// phpcs:enable
global $langs;

View File

@ -42,7 +42,7 @@ if (empty($sortorder)) { $sortorder="ASC"; }
if (empty($sortfield)) { $sortfield="d.login"; }
if (! isset($statut))
{
$statut = 1 ;
$statut = 1;
}
if (! isset($cotis))
@ -54,7 +54,7 @@ if (! isset($cotis))
$sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = $statut ";
$sql .= " WHERE d.statut = ".$statut;
if ($cotis==1)
{
$sql .= " AND datefin > '".$db->idate($now)."'";

View File

@ -61,7 +61,7 @@ $AdherentsResilies=array();
$AdherentType=array();
// Members list
// Type of membership
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
$sql.= " d.statut, count(d.rowid) as somme";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
@ -71,7 +71,7 @@ $sql.= " AND d.entity IN (".getEntity('adherent').")";
$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members by type", LOG_DEBUG);
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{
@ -294,7 +294,7 @@ print "<br>\n";
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Last modified members
* Latest modified members
*/
$max=5;
@ -342,7 +342,7 @@ if ($resql)
print '<td>'.$staticmember->getNomUrl(1, 32).'</td>';
print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 5).'</td>';
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 3).'</td>';
print '</tr>';
$i++;
}

View File

@ -37,9 +37,9 @@ $action = GETPOST('action', 'aZ09');
// Protection
$socid=0;
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$socid = $user->societe_id;
$socid = $user->socid;
}
$object = new Adherent($db);

View File

@ -33,10 +33,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):'';
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');

View File

@ -34,10 +34,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):'';
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');

View File

@ -35,10 +35,10 @@ $userid=GETPOST('userid', 'int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');

View File

@ -41,7 +41,7 @@ $cancel=GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
// Security check
$result=restrictedArea($user, 'adherent', $id, 'adherent_type');

View File

@ -208,7 +208,7 @@ print '<td width="200" class="center">'.$langs->trans("Example").'</td>';
print '<td class="center" width="60">'.$langs->trans("CodeBarGenerator").'</td>';
print "</tr>\n";
$sql = "SELECT rowid, code as encoding, libelle, coder, example";
$sql = "SELECT rowid, code as encoding, libelle as label, coder, example";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code";
@ -225,7 +225,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td width="100">';
print $obj->libelle;
print $obj->label;
print "</td><td>\n";
print $langs->trans('BarcodeDesc'.$obj->encoding);
//print "L'EAN se compose de 8 caracteres, 7 chiffres plus une cle de controle.<br>";

View File

@ -183,16 +183,6 @@ elseif ($action == 'set_BOM_FREE_TEXT')
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action=="setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_BOM_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -314,244 +304,217 @@ foreach ($dirmodels as $reldir)
print "</table><br>\n";
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
/*
* Document templates generators
*/
print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
/*
* Document templates generators
*/
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
if (is_dir($dir))
{
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
if (is_dir($dir))
$handle=opendir($dir);
if (is_resource($handle))
{
$handle=opendir($dir);
if (is_resource($handle))
while (($file = readdir($handle))!==false)
{
while (($file = readdir($handle))!==false)
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
}
else
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
}
else
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->BOM_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Default
print '<td class="center">';
if ($conf->global->BOM_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
print '</table>';
print "<br>";
/*
* Other options
*/
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='BOM_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
//Use draft Watermark
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_BOM_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="BOM_DRAFT_WATERMARK" value="'.$conf->global->BOM_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</table>';
print '<br>';
}
print '</table>';
print "<br>";
/*
* Notifications
* Other options
*/
/*
print load_fiche_titre($langs->trans("Notifications"), '', '');
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='BOM_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
//Use draft Watermark
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_BOM_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="BOM_DRAFT_WATERMARK" value="'.$conf->global->BOM_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</table>';
*/
print '<br>';
// End of page
llxFooter();

View File

@ -75,8 +75,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@ -260,7 +260,7 @@ if ($action == 'create') {
dol_fiche_head(array(), '');
print '<table class="border centpercent">'."\n";
print '<table class="border centpercent tableforfield">'."\n";
//unset($fields[]);
@ -296,7 +296,7 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
print '<table class="border centpercent">' . "\n";
print '<table class="border centpercent tableforfield">' . "\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
@ -448,7 +448,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'."\n";
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswithonsecondcolumn';

View File

@ -78,9 +78,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
$socid=0;
if ($user->societe_id > 0) // Protection if external user
if ($user->socid > 0) // Protection if external user
{
//$socid = $user->societe_id;
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'emailcollector', $id, '');

View File

@ -71,9 +71,9 @@ if (! $sortorder) $sortorder="ASC";
// Protection if external user
$socid=0;
if ($user->societe_id > 0)
if ($user->socid > 0)
{
//$socid = $user->societe_id;
//$socid = $user->socid;
accessforbidden();
}
@ -393,7 +393,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
foreach ($extrafields->attribute_computed as $key => $val)
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}

View File

@ -129,7 +129,7 @@ foreach ($modulesdir as $dir)
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
// We discard modules according to property disabled
if (! empty($objMod->hidden)) $modulequalified=0;
//if (! empty($objMod->hidden)) $modulequalified=0;
if ($modulequalified > 0)
{

522
htdocs/admin/mrp.php Normal file
View File

@ -0,0 +1,522 @@
<?php
/* Copyright (C) 2019 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
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/mrp.php
* \ingroup mrp
* \brief Setup page of module MRP
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php';
require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'mrp';
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconstmrp=GETPOST('maskconstMo', 'alpha');
$maskmrp=GETPOST('maskMo', 'alpha');
if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
elseif ($action == 'specimen')
{
$modele=GETPOST('module', 'alpha');
$mo = new MO($db);
$mrp->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db);
if ($module->write_file($mrp, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf");
return;
}
else
{
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
elseif ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
elseif ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->MRP_MO_ADDON_PDF == "$value") dolibarr_del_const($db, 'MRP_MO_ADDON_PDF', $conf->entity);
}
}
// Set default model
elseif ($action == 'setdoc')
{
if (dolibarr_set_const($db, "MRP_MO_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->MRP_MO_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
elseif ($action == 'setmod')
{
// TODO Check if numbering module chosen can be activated
// by calling method canBeActivated
dolibarr_set_const($db, "MRP_MO_ADDON", $value, 'chaine', 0, '', $conf->entity);
}
elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK')
{
$draft = GETPOST("MRP_MO_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
elseif ($action == 'set_MRP_MO_FREE_TEXT')
{
$freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
$form=new Form($db);
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("", $langs->trans("MrpSetupPage"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("MrpSetupPage"), $linkback, 'title_setup');
$head = mrpAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("MOs"), -1, 'mrp');
/*
* MOs Numbering model
*/
print load_fiche_titre($langs->trans("MOsNumberingModules"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/mrp/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once $dir.$file.'.php';
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->MRP_MO_ADDON == $file)
{
print img_picto($langs->trans("Activated"), 'switch_on');
}
else
{
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
$mrp=new MO($db);
$mrp->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$mrp->type=0;
$nextval=$module->getNextValue($mysoc, $mrp);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>';
} else {
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
}
}
print "</table><br>\n";
/*
* Document templates generators
*/
print load_fiche_titre($langs->trans("MOsModelModule"), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/mrp".$valdir);
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
}
else
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->MRP_MO_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
print "<br>";
/*
* Other options
*/
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MRP_MO_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnMOs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='MRP_MO_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
//Use draft Watermark
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_MRP_MO_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftMOs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="MRP_MO_DRAFT_WATERMARK" value="'.$conf->global->MRP_MO_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</table>';
print '<br>';
// End of page
llxFooter();
$db->close();

View File

@ -236,7 +236,7 @@ foreach($listofnotifiedevents as $notifiedevent)
$s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail=explode(',', $value);
$showwarning=0;
foreach($arrayemail as $key=>$valuedet)
foreach($arrayemail as $keydet => $valuedet)
{
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet, 1)) $showwarning++;

View File

@ -35,10 +35,10 @@ $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
// Load translation files required by the page

View File

@ -35,10 +35,10 @@ $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
$sortfield = GETPOST("sortfield", 'alpha');

View File

@ -458,7 +458,7 @@ if ($mode == 'searchkey')
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
$title = $langs->trans("TranslationKeySearch");
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')';
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit);
print '<input type="hidden" id="action" name="action" value="search">';
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
@ -466,7 +466,7 @@ if ($mode == 'searchkey')
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder).'</td>';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);

View File

@ -421,7 +421,7 @@ $h++;
dol_fiche_head($head, 'website', '', -1);
print $langs->trans("WebsiteSetupDesc").'<br>';
print '<span class="opacitymedium">'.$langs->trans("WebsiteSetupDesc").'</span><br>';
print "<br>\n";

View File

@ -102,6 +102,7 @@ class DolibarrApi
unset($object->isextrafieldmanaged);
unset($object->ismultientitymanaged);
unset($object->restrictiononfksoc);
unset($object->table_rowid);
// Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses
unset($object->linkedObjects);
@ -127,13 +128,14 @@ class DolibarrApi
unset($object->timespent_withhour);
unset($object->timespent_fk_user);
unset($object->timespent_note);
unset($object->fk_delivery_address);
unset($object->statuts);
unset($object->statuts_short);
unset($object->statuts_logo);
unset($object->statuts_long);
unset($object->labelstatut);
unset($object->labelstatut_short);
unset($object->labelStatus);
unset($object->labelStatusShort);
unset($object->element);
unset($object->fk_element);
@ -146,6 +148,11 @@ class DolibarrApi
unset($object->skip_update_total);
unset($object->context);
unset($object->next_prev_filter);
if ($object->table_element != 'ticket') {
unset($object->comments);
}
// Remove the $oldcopy property because it is not supported by the JSON
// encoder. The following error is generated when trying to serialize

View File

@ -55,6 +55,12 @@ require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$url = $_SERVER['PHP_SELF'];
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
if (! empty($conf->global->MAIN_NGINX_FIX))
{
$url = (isset($_SERVER['SCRIPT_URI']) && $_SERVER["SCRIPT_URI"] !== null) ? $_SERVER["SCRIPT_URI"] : $_SERVER['PHP_SELF'];
}
// Enable and test if module Api is enabled
if (empty($conf->global->MAIN_MODULE_API))
@ -67,7 +73,7 @@ if (empty($conf->global->MAIN_MODULE_API))
}
// Test if explorer is not disabled
if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($conf->global->API_EXPLORER_DISABLED))
if (preg_match('/api\/index\.php\/explorer/', $url) && ! empty($conf->global->API_EXPLORER_DISABLED))
{
$langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
@ -91,7 +97,7 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
$reg=array();
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg);
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC

View File

@ -60,8 +60,8 @@ foreach($object->fields as $key => $val)
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;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Load object

View File

@ -128,7 +128,13 @@ class Asset extends CommonObject
public $note_public;
public $note_private;
/**
* @var integer|string date_creation
*/
public $date_creation;
public $tms;
/**

View File

@ -40,8 +40,8 @@ $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;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Get parameters

View File

@ -34,7 +34,7 @@ $ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'asset', $id, '');
$object = new Asset($db);

View File

@ -72,9 +72,9 @@ if (! $sortorder) $sortorder="ASC";
// Protection if external user
$socid=0;
if ($user->societe_id > 0)
if ($user->socid > 0)
{
//$socid = $user->societe_id;
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'asset', $id,'');
@ -407,7 +407,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
foreach ($extrafields->attribute_computed as $key => $val)
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}

View File

@ -46,8 +46,8 @@ $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_module
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Load object

View File

@ -100,7 +100,12 @@ class BlockedLog
*/
public $fk_user = 0;
/**
* @var integer|string date_creation
*/
public $date_creation;
public $date_modification;
public $date_object = 0;

View File

@ -53,8 +53,8 @@ else
$search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;

View File

@ -70,8 +70,8 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@ -662,14 +662,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a name="builddoc"></a>'; // ancre
// Documents
/*$objref = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $comref . '.pdf';
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref . '/' . $objref . '.pdf';
$filedir = $conf->bom->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->bom->create; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
@ -693,17 +692,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
//Select mail models is same action as presend
/*
if (GETPOST('modelselected')) $action = 'presend';
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
$modelmail='inventory';
$defaulttopic='InformationMessage';
$diroutput = $conf->product->dir_output.'/inventory';
$trackid = 'stockinv'.$object->id;
// Presend form
$modelmail='bom';
$defaulttopic='InformationMessage';
$diroutput = $conf->bom->dir_output;
$trackid = 'bom'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
}
// End of page

View File

@ -41,8 +41,8 @@ $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;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
// Get parameters

View File

@ -73,9 +73,9 @@ if (! $sortorder) $sortorder="ASC";
// Security check
$socid=0;
if ($user->societe_id > 0) // Protection if external user
if ($user->socid > 0) // Protection if external user
{
//$socid = $user->societe_id;
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'bom', $id, '');

View File

@ -47,8 +47,8 @@ $hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->h
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
//if ($user->societe_id > 0) $socid = $user->societe_id;
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
// Load object

View File

@ -260,7 +260,7 @@ class Boms extends DolibarrApi
throw new RestException(500, 'Error when deleting BOM : '.$this->bom->error);
}
return array(
return array(
'success' => array(
'code' => 200,
'message' => 'BOM deleted'
@ -281,12 +281,53 @@ class Boms extends DolibarrApi
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
/*unset($object->note);
unset($object->address);
unset($object->rowid);
unset($object->canvas);
unset($object->name);
unset($object->lastname);
unset($object->firstname);
unset($object->civility_id);
unset($object->statut);
unset($object->state);
unset($object->state_id);
unset($object->state_code);
unset($object->region);
unset($object->region_code);
unset($object->country);
unset($object->country_id);
unset($object->country_code);
unset($object->barcode_type);
unset($object->barcode_type_code);
unset($object->barcode_type_label);
unset($object->barcode_type_coder);*/
unset($object->barcode_type_coder);
unset($object->total_ht);
unset($object->total_tva);
unset($object->total_localtax1);
unset($object->total_localtax2);
unset($object->total_ttc);
unset($object->fk_account);
unset($object->comments);
unset($object->note);
unset($object->mode_reglement_id);
unset($object->cond_reglement_id);
unset($object->cond_reglement);
unset($object->shipping_method_id);
unset($object->fk_incoterms);
unset($object->label_incoterms);
unset($object->location_incoterms);
// If object has lines, remove $db property
if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
$nboflines = count($object->lines);
for ($i=0; $i < $nboflines; $i++)
{
$this->_cleanObjectDatas($object->lines[$i]);
unset($object->lines[$i]->lines);
unset($object->lines[$i]->note);
}
}
return $object;
}

View File

@ -112,7 +112,13 @@ class BOM extends CommonObject
public $description;
public $note_public;
public $note_private;
/**
* @var integer|string date_creation
*/
public $date_creation;
public $tms;
public $fk_user_creat;
public $fk_user_modif;
@ -809,19 +815,19 @@ class BOM extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
if (empty($this->labelstatus))
if (empty($this->labelStatus))
{
global $langs;
//$langs->load("mrp");
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
}
$statusType = 'status'.$status;
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode);
return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', $statusType, $mode);
}
/**

View File

@ -779,9 +779,9 @@ class Categorie extends CommonObject
$sql .= " AND c.fk_categorie = ".$this->id;
$sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid";
// Protection for external users
if (($type == 'customer' || $type == 'supplier') && $user->societe_id > 0)
if (($type == 'customer' || $type == 'supplier') && $user->socid > 0)
{
$sql.= " AND o.rowid = ".$user->societe_id;
$sql.= " AND o.rowid = ".$user->socid;
}
if ($limit > 0 || $offset > 0) $sql .= $this->db->plimit($limit + 1, $offset);
$sql .= $this->db->order($sortfield, $sortorder);
@ -1018,11 +1018,11 @@ class Categorie extends CommonObject
* fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id
*
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member', ...)
* @param int|string|array $markafterid Keep only or removed all categories including the leaf $markafterid in category tree (exclude) or Keep only of category is inside the leaf starting with this id.
* $markafterid can be an :
* - int (id of category)
* - string (categories ids seprated by comma)
* - string (categories ids separated by comma)
* - array (list of categories ids)
* @param int $include [=0] Removed or 1=Keep only
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error

View File

@ -136,7 +136,7 @@ if ($object->id)
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
/*
* Confirmation de la suppression de photo

View File

@ -207,7 +207,7 @@ foreach ($ways as $way)
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
print '<br>';

View File

@ -226,7 +226,7 @@ foreach ($ways as $way)
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'label', $linkback, ($user->societe_id?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
/*

View File

@ -69,9 +69,9 @@ $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fullda
// Security check
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
if ($user->societe_id && $socid) $result = restrictedArea($user, 'societe', $socid);
if ($user->socid && $socid) $result = restrictedArea($user, 'societe', $socid);
$error=GETPOST("error");
$donotclearsession=GETPOST('donotclearsession')?GETPOST('donotclearsession'):0;
@ -861,11 +861,11 @@ if ($action == 'create')
if (GETPOST('datep', 'int', 1)) $datep=dol_stringtotime(GETPOST('datep', 'int', 1), 0);
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldayend');
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldayend');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart');
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart');
}
print '</td></tr>';
@ -1024,8 +1024,8 @@ if ($action == 'create')
$events=array();
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
//For external user force the company to user company
if (!empty($user->societe_id)) {
print $form->select_company($user->societe_id, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300');
if (!empty($user->socid)) {
print $form->select_company($user->socid, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300');
} else {
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300');
}
@ -1612,7 +1612,7 @@ if ($id > 0)
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref);
print '<div class="fichecenter">';

View File

@ -45,43 +45,67 @@ class ActionComm extends CommonObject
*/
public $table_element = 'actioncomm';
/**
* @var string Name of id column
*/
public $table_rowid = 'id';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
* @var string Name of icon for actioncomm object. Filename of icon is object_action.png
*/
public $picto = 'action';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 1;
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user, 2=Same than 1 but accept record if fksoc is empty
* @var integer
* @var integer 0=Default
* 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* 2=Same than 1 but accept record if fksoc is empty
*/
public $restrictiononfksoc = 2;
/**
* Id of the event
* @var int
* @var int Id of the event
*/
public $id;
/**
* Id of the event. Use $id as possible
* @var int
* @var int Id of the event. Use $id as possible
*/
public $ref;
public $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set)
public $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
/**
* @var int Id into parent table llx_c_actioncomm (used only if option to use type is set)
*/
public $type_id;
/**
* @var string Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
*/
public $type_code;
/**
* @var string Type label
*/
public $type_label;
public $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set)
public $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set)
public $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
/**
* @var string Label into parent table llx_c_actioncomm (used only if option to use type is set)
*/
public $type;
/**
* @var string Color into parent table llx_c_actioncomm (used only if option to use type is set)
*/
public $type_color;
/**
* @var string Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
*/
public $code;
/**
* @var string Agenda event label
@ -89,72 +113,56 @@ class ActionComm extends CommonObject
public $label;
/**
* Date creation record (datec)
*
* @var integer
* @var integer Date creation record (datec)
*/
public $datec;
/**
* Date end record (datef)
*
* @var integer
* @var integer Date end record (datef)
*/
public $datef;
/**
* Duration (duree)
*
* @var integer
* @var integer Duration (duree)
*/
public $duree;
/**
* Date modification record (tms)
*
* @var integer
* @var integer Date modification record (tms)
*/
public $datem;
/**
* Object user that create action
* @var User
* @var User Object user that create action
* @deprecated
* @see $authorid
*/
public $author;
/**
* Object user that modified action
* @var User
* @var User Object user that modified action
* @deprecated
* @see $usermodid
*/
public $usermod;
/**
* Id user that create action
* @var int
* @var int Id user that create action
*/
public $authorid;
/**
* Id user that modified action
* @var int
* @var int Id user that modified action
*/
public $usermodid;
/**
* Date action start (datep)
*
* @var integer
* @var integer Date action start (datep)
*/
public $datep;
/**
* Date action end (datep2)
*
* @var integer
* @var integer Date action end (datep2)
*/
public $datep2;
@ -163,90 +171,178 @@ class ActionComm extends CommonObject
* @deprecated
*/
public $durationp = -1;
public $fulldayevent = 0; // 1=Event on full day
/**
* Milestone
* @var int
* @var int 1=Event on full day
*/
public $fulldayevent = 0;
/**
* @var int Milestone
* @deprecated Milestone is already event with end date = start date
*/
public $punctual = 1;
public $percentage; // Percentage
public $location; // Location
public $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
public $priority; // Small int (0 By default)
/**
* @var integer Percentage
*/
public $percentage;
public $userassigned = array(); // Array of user ids
public $userownerid; // Id of user owner = fk_user_action into table
public $userdoneid; // Id of user done (deprecated)
/**
* @var string Location
*/
public $location;
public $socpeopleassigned = array(); // Array of contact ids
/**
* @var int Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
*/
public $transparency;
public $otherassigned = array(); // Array of other contact emails (not user, not contact)
/**
* @var int (0 By default)
*/
public $priority;
/**
* @var int[] Array of user ids
*/
public $userassigned = array();
/**
* @var int Id of user owner = fk_user_action into table
*/
public $userownerid;
/**
* @var int Id of user done (deprecated)
* @deprecated
*/
public $userdoneid;
/**
* @var int[] Array of contact ids
*/
public $socpeopleassigned = array();
/**
* @var int[] Array of other contact emails (not user, not contact)
*/
public $otherassigned = array();
/**
* Object user of owner
* @var User
/**
* @var User Object user of owner
* @deprecated
* @see userownerid
*/
public $usertodo;
/**
* Object user that did action
* @var User
* @var User Object user that did action
* @deprecated
* @see userdoneid
*/
public $userdone;
/**
* @var int thirdparty id linked to action
*/
public $socid;
/**
* @var int socpeople id linked to action
*/
public $contactid;
/**
* Company linked to action (optional)
* @var Societe|null
* @var Societe|null Company linked to action (optional)
* @deprecated
* @see socid
*/
public $societe;
/**
* Contact linked to action (optional)
* @var Contact|null
* @var Contact|null Contact linked to action (optional)
* @deprecated
* @see contactid
*/
public $contact;
// Properties for links to other objects
/**
* @var int Id of linked object
*/
public $fk_element; // Id of record
public $elementid; // Id of record alternative for API
public $elementtype; // Type of record. This if property ->element of object linked to.
// Ical
/**
* @var int Id of record alternative for API
*/
public $elementid;
/**
* @var string Type of record. This if property ->element of object linked to.
*/
public $elementtype;
/**
* @var string Ical name
*/
public $icalname;
/**
* @var string Ical color
*/
public $icalcolor;
/**
* @var array Actions
*/
public $actions=array();
// Fields for emails
/**
* @var string Email msgid
*/
public $email_msgid;
/**
* @var string Email from
*/
public $email_from;
/**
* @var string Email sender
*/
public $email_sender;
/**
* @var string Email to
*/
public $email_to;
/**
* @var string Email tocc
*/
public $email_tocc;
/**
* @var string Email tobcc
*/
public $email_tobcc;
/**
* @var string Email subject
*/
public $email_subject;
/**
* @var string Email errors to
*/
public $errors_to;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
@ -1067,13 +1163,13 @@ class ActionComm extends CommonObject
$sql = "SELECT count(a.id) as nb";
}
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " WHERE 1 = 1";
if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100";
$sql.= " AND a.entity IN (".getEntity('agenda').")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
if ($user->socid) $sql.=" AND a.fk_soc = ".$user->socid;
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
$resql=$this->db->query($sql);
@ -1344,7 +1440,6 @@ class ActionComm extends CommonObject
$linkstart = '';
$linkend = '';
}
//print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto;
if ($withpicto == 2)
{
@ -1463,7 +1558,7 @@ class ActionComm extends CommonObject
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
$sql.= " u.firstname, u.lastname, u.email,";
$sql.= " s.nom as socname,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle";
$sql.= " c.id as type_id, c.code as type_code, c.libelle as type_label";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
@ -1568,7 +1663,7 @@ class ActionComm extends CommonObject
$event['location']=$obj->location;
$event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy)
$event['punctual']=$obj->punctual;
$event['category']=$obj->libelle; // libelle type action
$event['category']=$obj->type_label;
$event['email']=$obj->email;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
@ -1579,6 +1674,22 @@ class ActionComm extends CommonObject
$event['created']=$this->db->jdate($obj->datec)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
$event['modified']=$this->db->jdate($obj->datem)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
// TODO: find a way to call "$this->fetch_userassigned();" without override "$this" properties
$this->id = $obj->id;
$this->fetch_userassigned();
$assignedUserArray = array();
foreach($this->userassigned as $key => $value)
{
$assignedUser = new User($this->db);
$assignedUser->fetch($value['id']);
$assignedUserArray[$key]=$assignedUser;
}
$event['assignedUsers']=$assignedUserArray;
if ($qualified && $datestart)
{
$eventarray[]=$event;

View File

@ -338,6 +338,7 @@ class AgendaEvents extends DolibarrApi
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->note); // alreaydy into note_private
unset($object->usermod);
unset($object->libelle);
unset($object->context);
@ -350,6 +351,11 @@ class AgendaEvents extends DolibarrApi
unset($object->origin_id);
unset($object->ref_ext);
unset($object->statut);
unset($object->state_code);
unset($object->state_id);
unset($object->state);
unset($object->region);
unset($object->region_code);
unset($object->country);
unset($object->country_id);
unset($object->country_code);
@ -378,6 +384,9 @@ class AgendaEvents extends DolibarrApi
unset($object->contact);
unset($object->societe);
unset($object->actions);
unset($object->lines);
return $object;
}
}

View File

@ -45,8 +45,8 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check
$socid = GETPOST('socid', 'int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->societe_id > 0)
if ($user->socid) $socid=$user->socid;
if ($user->socid > 0)
{
unset($_GET["action"]);
$action='';
@ -159,7 +159,7 @@ if ($object->id > 0)
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref);
print '<div class="fichecenter">';

View File

@ -67,7 +67,7 @@ if (! $sortfield) $sortfield="a.datec";
// Security check
$socid = GETPOST("search_socid", "int")?GETPOST("search_socid", "int"):GETPOST("socid", "int");
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@ -614,7 +614,7 @@ if ($resql)
$event->type_label=$obj->type_label;
$event->type_color=$obj->type_color;
$event->libelle=$obj->label;
$event->libelle=$obj->label; // deprecated
$event->label=$obj->label;
$event->percentage=$obj->percent;
$event->authorid=$obj->fk_user_author; // user id of creator
@ -720,7 +720,7 @@ if ($showbirthday)
$event->datep=dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true); // For full day events, date are also GMT but they wont but converted during output
$event->datef=$event->datep;
$event->type_code='BIRTHDAY';
$event->libelle=$langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname);
$event->label=$langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname);
$event->percentage=100;
$event->fulldayevent=1;
@ -949,9 +949,9 @@ if (count($listofextcals))
$event->datef=$dateend+$usertime;
$event->type_code="ICALEVENT";
if($icalevent['SUMMARY']) $event->libelle=$icalevent['SUMMARY'];
elseif($icalevent['DESCRIPTION']) $event->libelle=dol_nl2br($icalevent['DESCRIPTION'], 1);
else $event->libelle = $langs->trans("ExtSiteNoLabel");
if($icalevent['SUMMARY']) $event->label=$icalevent['SUMMARY'];
elseif($icalevent['DESCRIPTION']) $event->label=dol_nl2br($icalevent['DESCRIPTION'], 1);
else $event->label = $langs->trans("ExtSiteNoLabel");
$event->date_start_in_calendar=$event->datep;
@ -1554,7 +1554,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// Show title
$titletoshow = $daterange;
$titletoshow.=($titletoshow?' ':'').$event->libelle;
$titletoshow.=($titletoshow?' ':'').($event->label?$event->label:$event->libelle);
if ($event->type_code == 'ICALEVENT') print $titletoshow;
else
@ -1735,7 +1735,7 @@ function sort_events_by_date($a, $b)
}
// If both events have the same start time, longest first
if(! is_numeric($b->datef))
{
// when event B have no end timestamp, event B should sort be before event A (All day events on top)

View File

@ -39,10 +39,10 @@ $langs->load("commercial");
$id = GETPOST('id', 'int');
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
@ -102,7 +102,7 @@ if (! empty($conf->projet->enabled))
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, ($user->socid?0:1), 'id', 'ref', $morehtmlref);
print '<div class="underbanner clearboth"></div>';

View File

@ -110,7 +110,7 @@ if (! $sortfield)
// Security check
$socid = GETPOST("search_socid", 'int')?GETPOST("search_socid", 'int'):GETPOST("socid", 'int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@ -488,7 +488,7 @@ if ($resql)
if (! empty($arrayfields['a.tms']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.percent']['checked'])) {
print '<td class="liste_titre center">';
print $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
print ajax_combobox('selectstatus');
print '</td>';
}

View File

@ -65,7 +65,7 @@ if (! $sortfield) $sortfield="a.datec";
// Security check
$socid = GETPOST("socid", "int");
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@ -616,12 +616,12 @@ $typeofevents=array();
// Load array of colors by type
$colorsbytype=array();
$labelbytype=array();
$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm";
$sql="SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position";
$resql=$db->query($sql);
while ($obj = $db->fetch_object($resql))
{
$colorsbytype[$obj->code]=$obj->color;
$labelbytype[$obj->code]=$obj->libelle;
$labelbytype[$obj->code]=$obj->label;
}
// Loop on each user to show calendar

View File

@ -65,7 +65,7 @@ if (! $sortfield) $sortfield="a.datec";
// Security check
$socid = GETPOST("search_socid", "int")?GETPOST("search_socid", "int"):GETPOST("socid", "int");
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid='';
@ -752,12 +752,12 @@ while($currentdaytoshow<$lastdaytoshow) {
// Load array of colors by type
$colorsbytype=array();
$labelbytype=array();
$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position";
$sql="SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX."c_actioncomm ORDER BY position";
$resql=$db->query($sql);
while ($obj = $db->fetch_object($resql))
{
$colorsbytype[$obj->code]=$obj->color;
$labelbytype[$obj->code]=$obj->libelle;
$labelbytype[$obj->code]=$obj->label;
}
// Loop on each user to show calendar

View File

@ -49,7 +49,7 @@ if (! $sortfield) $sortfield="a.datep";
// Security check
$socid = GETPOST('socid', 'int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'agenda', $socid, '', 'myactions');

View File

@ -59,7 +59,7 @@ if (! empty($conf->notification->enabled)) $langs->load("mails");
// Security check
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
if ($user->societe_id > 0) $id=$user->societe_id;
if ($user->socid > 0) $id=$user->socid;
$result = restrictedArea($user, 'societe', $id, '&societe');
$action = GETPOST('action', 'aZ09');
@ -240,7 +240,7 @@ if ($object->id > 0)
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom');
print '<div class="fichecenter"><div class="fichehalfleft">';
@ -387,7 +387,7 @@ if ($object->id > 0)
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans("CustomerRelativeDiscountShort");
print '<td><td class="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0)
if ($user->rights->societe->creer && !$user->socid > 0)
{
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
}
@ -401,7 +401,7 @@ if ($object->id > 0)
print '<tr><td class="nowrap">';
print $langs->trans("CustomerAbsoluteDiscountShort");
print '<td><td class="right">';
if ($user->rights->societe->creer && !$user->societe_id > 0)
if ($user->rights->societe->creer && !$user->socid > 0)
{
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
}
@ -1274,7 +1274,7 @@ if ($object->id > 0)
}
// Add invoice
if ($user->societe_id == 0)
if ($user->socid == 0)
{
if (! empty($conf->deplacement->enabled) && $object->status==1)
{

View File

@ -47,7 +47,7 @@ $begin=GETPOST('begin', 'alpha');
// Security check
$socid = GETPOST('socid', 'int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'societe', $socid, '');

View File

@ -51,10 +51,10 @@ $bid=GETPOST('bid', 'int');
// Securite acces client
$socid=GETPOST('socid', 'int');
if (isset($user->societe_id) && $user->societe_id > 0)
if (isset($user->socid) && $user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
$max=3;
@ -120,6 +120,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
$i=0;
foreach($listofsearchfields as $key => $value)
@ -132,6 +133,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
$i++;
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}
@ -559,10 +561,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm";
$sql.= ", s.code_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if (! $user->rights->societe->client->voir && ! $user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY s.datec DESC";
$sql.= $db->plimit($max, 0);

View File

@ -41,7 +41,7 @@ if (! empty($conf->categorie->enabled)) {
}
// Security check
if (! $user->rights->mailing->lire || $user->societe_id > 0)
if (! $user->rights->mailing->lire || $user->socid > 0)
accessforbidden();
// Load variable for pagination

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->load("mails");
if (! $user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->societe_id > 0)) accessforbidden();
if (! $user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) accessforbidden();
$id=(GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int'));
$action=GETPOST('action', 'alpha');

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("mails");
// Security check
if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden();
if (! $user->rights->mailing->lire || $user->socid > 0) accessforbidden();
// Load variable for pagination
@ -479,14 +479,13 @@ if ($object->fetch($id) >= 0)
{
$num = $db->num_rows($resql);
$param = "&amp;id=".$object->id;
$param = "&id=".$object->id;
//if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname);
if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
if ($search_email) $param.= "&search_email=".urlencode($search_email);
if ($search_other) $param.= "&search_other=".urlencode($search_other);
if ($page) $param.= "&page=".urlencode($page);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -500,6 +499,7 @@ if ($object->fetch($id) >= 0)
$morehtmlcenter='<span class="opacitymedium">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
}
$morehtmlcenter.=' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?exportcsv=1&id='.$object->id.'">'.$langs->trans("Download").'</a>';
print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
print '</form>';
@ -560,6 +560,8 @@ if ($object->fetch($id) >= 0)
print '</td>';
print '</tr>';
if ($page) $param.= "&page=".urlencode($page);
print '<tr class="liste_titre">';
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder);

View File

@ -67,7 +67,12 @@ class Mailing extends CommonObject
public $user_creat;
public $user_valid;
/**
* @var integer|string date_creation
*/
public $date_creat;
public $date_valid;
public $extraparams=array();
@ -618,48 +623,24 @@ class Mailing extends CommonObject
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $status Id status
* @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
*/
public function LibStatut($statut, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->load('mails');
$langs->load("mailing");
if ($mode == 0 || $mode == 1)
{
return $langs->trans($this->statuts[$statut]);
}
elseif ($mode == 2)
{
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
}
elseif ($mode == 3)
{
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0');
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1');
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3');
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6');
}
elseif ($mode == 4)
{
if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]);
elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
}
elseif ($mode == 5)
{
if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0');
elseif ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1');
elseif ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3');
elseif ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6');
}
$labelStatus = $langs->trans($this->statuts[$status]);
$labelStatusShort = $langs->trans($this->statuts[$status]);
$statusType = 'status'.$status;
if ($status == 2) $statusType = 'status3';
if ($status == 3) $statusType = 'status6';
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
@ -667,58 +648,37 @@ class Mailing extends CommonObject
* Renvoi le libelle d'un statut donne
* TODO Add class mailin_target.class.php
*
* @param int $statut Id statut
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param string $desc Desc error
* @return string Label
*/
public static function libStatutDest($statut, $mode = 0, $desc = '')
public static function libStatutDest($status, $mode = 0, $desc = '')
{
global $langs;
$langs->load('mails');
$langs->load("mails");
if ($mode == 0)
{
return $langs->trans('MailingStatusError');
}
elseif ($mode == 1)
{
return $langs->trans('MailingStatusSent');
}
elseif ($mode == 2)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 3)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 4)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 5)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
}
elseif ($mode == 6)
{
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6');
elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4');
elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3');
$labelStatus = array();
$labelStatusShort = array();
$labelStatus[-1] = $langs->trans('MailingStatusError');
$labelStatus[1] = $langs->trans('MailingStatusSent');
$labelStatus[2] = $langs->trans('MailingStatusRead');
$labelStatus[3] = $langs->trans('MailingStatusNotContact');
$labelStatusShort[-1] = $langs->trans('MailingStatusError');
$labelStatusShort[1] = $langs->trans('MailingStatusSent');
$labelStatusShort[2] = $langs->trans('MailingStatusRead');
$labelStatusShort[3] = $langs->trans('MailingStatusNotContact');
$statusType = 'status'.$status;
if ($status == -1) $statusType = 'status8';
if ($status == 1) $statusType = 'status6';
if ($status == 2) $statusType = 'status4';
$param = array();
if ($status == - 1) {
$param = array('badgeParams'=>array('attr'=>array('title'=>$desc)));
}
return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode, '', $param);
}
}

View File

@ -60,6 +60,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Recherche emails
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/mailing/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAMailing").'</td></tr>';
print '<tr class="oddeven"><td class="nowrap">';
@ -68,7 +69,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr class="oddeven"><td class="nowrap">';
print $langs->trans("Other").':</td><td><input type="text" class="flat inputsearch" name="sall"></td>';
print "</table></form><br>\n";
print "</table></div></form><br>\n";
//}
@ -160,6 +161,7 @@ $sql.= " ORDER BY m.date_creat DESC";
$sql.= " LIMIT ".$limit;
$result=$db->query($sql);
if ($result) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("LastMailings", $limit).'</td>';
@ -193,7 +195,7 @@ if ($result) {
{
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print "</table><br>";
print "</table></div><br>";
$db->free($result);
}
else

View File

@ -33,7 +33,7 @@ $id=GETPOST('id');
$langs->load("mails");
// Security check
if (! $user->rights->mailing->lire || $user->societe_id > 0)
if (! $user->rights->mailing->lire || $user->socid > 0)
accessforbidden();
@ -57,7 +57,16 @@ if ($object->fetch($id) >= 0)
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3)
{
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
$morehtmlright.=') &nbsp; ';
}
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);

View File

@ -33,9 +33,9 @@ $langs->loadLangs(array('orders', 'companies'));
$id = GETPOST('id', 'int');
$_socid = GETPOST("id", 'int');
// Security check
if ($user->societe_id > 0)
if ($user->socid > 0)
{
$_socid = $user->societe_id;
$_socid = $user->socid;
}

View File

@ -86,7 +86,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co
$NBLINES = 4;
// Security check
if (! empty($user->societe_id)) $socid = $user->societe_id;
if (! empty($user->socid)) $socid = $user->socid;
$result = restrictedArea($user, 'propal', $id);
$object = new Propal($db);
@ -1717,7 +1717,7 @@ if ($action == 'create')
print $doleditor->Create(1);
// Private note
if (empty($user->societe_id))
if (empty($user->socid))
{
print '<tr>';
print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
@ -2202,11 +2202,11 @@ if ($action == 'create')
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print '</td>';
if ($action != 'editmulticurrencycode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate)
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $usercancreate)
print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>';
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmulticurrencycode' && $usercancreate) {
if ($object->statut == $object::STATUS_DRAFT && $action == 'editmulticurrencycode' && $usercancreate) {
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
} else {
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
@ -2214,29 +2214,33 @@ if ($action == 'create')
print '</td></tr>';
// Multicurrency rate
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print '</td>';
if ($action != 'editmulticurrencyrate' && $object->statut == Propal::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate)
print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>';
if ($object->statut == Propal::STATUS_DRAFT && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) {
if($action == 'actualizemulticurrencyrate') {
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
}
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>';
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
{
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr>';
print '<td>';
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print '</td>';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate)
print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>';
if ($object->statut ==$object::STATUS_DRAFT && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) {
if($action == 'actualizemulticurrencyrate') {
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
}
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>';
}
}
print '</td></tr>';
}
print '</td></tr>';
}
if ($soc->outstanding_limit)

View File

@ -13,7 +13,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -95,8 +95,17 @@ class Propal extends CommonObject
*/
public $socid;
/**
* ID of the contact
* @var int
*/
public $contactid;
public $author;
/**
* Ref from thirdparty
* @var string
*/
public $ref_client;
/**
@ -192,8 +201,8 @@ class Propal extends CommonObject
public $lines = array();
public $line;
public $labelstatut=array();
public $labelstatut_short=array();
public $labelStatus=array();
public $labelStatusShort=array();
public $specimen;
@ -240,7 +249,7 @@ class Propal extends CommonObject
* @param int $socid Id third party
* @param int $propalid Id proposal
*/
public function __construct($db, $socid = "", $propalid = 0)
public function __construct($db, $socid = 0, $propalid = 0)
{
global $conf,$langs;
@ -1686,13 +1695,13 @@ class Propal extends CommonObject
$line->fk_product = $objp->fk_product;
$line->ref = $objp->product_ref; // TODO deprecated
$line->ref = $objp->product_ref; // deprecated
$line->product_ref = $objp->product_ref;
$line->libelle = $objp->product_label; // TODO deprecated
$line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit
$line->product_tobatch = $objp->product_tobatch;
$line->fk_product_type = $objp->fk_product_type; // TODO deprecated
$line->fk_product_type = $objp->fk_product_type; // deprecated
$line->fk_unit = $objp->fk_unit;
$line->weight = $objp->weight;
$line->weight_units = $objp->weight_units;
@ -3200,40 +3209,40 @@ class Propal extends CommonObject
/**
* Return label of a status (draft, validated, ...)
*
* @param int $statut id statut
* @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
*/
public function LibStatut($statut, $mode = 1)
public function LibStatut($status, $mode = 1)
{
// phpcs:enable
global $conf;
// Init/load array of translation of status
if (empty($this->labelstatut) || empty($this->labelstatut_short))
if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
$langs->load("propal");
$this->labelstatut[0]=$langs->trans("PropalStatusDraft");
$this->labelstatut[1]=$langs->trans("PropalStatusValidated");
$this->labelstatut[2]=$langs->trans("PropalStatusSigned");
$this->labelstatut[3]=$langs->trans("PropalStatusNotSigned");
$this->labelstatut[4]=$langs->trans("PropalStatusBilled");
$this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort");
$this->labelstatut_short[1]=$langs->trans("PropalStatusValidatedShort");
$this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort");
$this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort");
$this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort");
$this->labelStatus[0]=$langs->trans("PropalStatusDraft");
$this->labelStatus[1]=$langs->trans("PropalStatusValidated");
$this->labelStatus[2]=$langs->trans("PropalStatusSigned");
$this->labelStatus[3]=$langs->trans("PropalStatusNotSigned");
$this->labelStatus[4]=$langs->trans("PropalStatusBilled");
$this->labelStatusShort[0]=$langs->trans("PropalStatusDraftShort");
$this->labelStatusShort[1]=$langs->trans("PropalStatusValidatedShort");
$this->labelStatusShort[2]=$langs->trans("PropalStatusSignedShort");
$this->labelStatusShort[3]=$langs->trans("PropalStatusNotSignedShort");
$this->labelStatusShort[4]=$langs->trans("PropalStatusBilledShort");
}
$statusType='';
if ($statut==self::STATUS_DRAFT) $statusType='status0';
elseif ($statut==self::STATUS_VALIDATED) $statusType='status1';
elseif ($statut==self::STATUS_SIGNED) $statusType='status3';
elseif ($statut==self::STATUS_NOTSIGNED) $statusType='status5';
elseif ($statut==self::STATUS_BILLED) $statusType='status6';
if ($status==self::STATUS_DRAFT) $statusType='status0';
elseif ($status==self::STATUS_VALIDATED) $statusType='status1';
elseif ($status==self::STATUS_SIGNED) $statusType='status3';
elseif ($status==self::STATUS_NOTSIGNED) $statusType='status5';
elseif ($status==self::STATUS_BILLED) $statusType='status6';
return dolGetStatus($this->labelstatut[$statut], $this->labelstatut_short[$statut], '', $statusType, $mode);
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
@ -3254,7 +3263,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin, p.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id)
if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;
@ -3263,7 +3272,7 @@ class Propal extends CommonObject
$sql.= $clause." p.entity IN (".getEntity('propal').")";
if ($mode == 'opened') $sql.= " AND p.fk_statut = ".self::STATUS_VALIDATED;
if ($mode == 'signed') $sql.= " AND p.fk_statut = ".self::STATUS_SIGNED;
if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id;
if ($user->socid) $sql.= " AND p.fk_soc = ".$user->socid;
$resql=$this->db->query($sql);
if ($resql)
@ -3272,17 +3281,17 @@ class Propal extends CommonObject
$now=dol_now();
$delay_warning = 0;
$statut = 0;
$status = 0;
$label = $labelShort = '';
if ($mode == 'opened') {
$delay_warning=$conf->propal->cloture->warning_delay;
$statut = self::STATUS_VALIDATED;
$status = self::STATUS_VALIDATED;
$label = $langs->trans("PropalsToClose");
$labelShort = $langs->trans("ToAcceptRefuse");
}
if ($mode == 'signed') {
$delay_warning=$conf->propal->facturation->warning_delay;
$statut = self::STATUS_SIGNED;
$status = self::STATUS_SIGNED;
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
$labelShort = $langs->trans("ToBill");
}
@ -3291,8 +3300,8 @@ class Propal extends CommonObject
$response->warning_delay = $delay_warning/60/60/24;
$response->label = $label;
$response->labelShort = $labelShort;
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals';
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
$response->img = img_object('', "propal");
// This assignment in condition is not a bug. It allows walking the results.
@ -3433,7 +3442,7 @@ class Propal extends CommonObject
$sql = "SELECT count(p.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->societe_id)
if (!$user->rights->societe->client->voir && !$user->socid)
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id;

View File

@ -112,7 +112,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";

View File

@ -41,7 +41,7 @@ $lineid=GETPOST('lineid', 'int');
$action=GETPOST('action', 'alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'propal', $id);
$object = new Propal($db);

View File

@ -46,9 +46,9 @@ $ref = GETPOST('ref', 'alpha');
// Security check
$socid='';
if (! empty($user->societe_id))
if (! empty($user->socid))
{
$socid = $user->societe_id;
$socid = $user->socid;
}
$result = restrictedArea($user, 'propal', $id);

View File

@ -38,10 +38,10 @@ $langs->loadLangs(array('propal', 'companies'));
// Security check
$socid=GETPOST('socid', 'int');
if (isset($user->societe_id) && $user->societe_id > 0)
if (isset($user->socid) && $user->socid > 0)
{
$action = '';
$socid = $user->societe_id;
$socid = $user->socid;
}
$result = restrictedArea($user, 'propal');
@ -87,7 +87,7 @@ $sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_soc = s.rowid";
$sql.= " AND p.entity IN (".getEntity('propal').")";
if ($user->societe_id) $sql.=' AND p.fk_soc = '.$user->societe_id;
if ($user->socid) $sql.=' AND p.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " AND p.fk_statut IN (0,1,2,3,4)";
$sql.= " GROUP BY p.fk_statut";

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