Merge remote-tracking branch 'upstream/develop' into socid
This commit is contained in:
commit
dbed10a701
34
ChangeLog
34
ChangeLog
@ -25,7 +25,8 @@ 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'.
|
||||
|
||||
***** 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 +48,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 +116,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 +135,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 +156,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 +186,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
|
||||
|
||||
@ -2181,48 +2181,48 @@ class Adherent extends CommonObject
|
||||
$langs->load("members");
|
||||
|
||||
$statusType = '';
|
||||
$labelstatut = '';
|
||||
$labelstatutShort = '';
|
||||
$labelStatus = '';
|
||||
$labelStatusShort = '';
|
||||
|
||||
if ($statut == -1)
|
||||
{
|
||||
$statusType = 'status0';
|
||||
$labelstatut = $langs->trans("MemberStatusDraft");
|
||||
$labelstatutShort = $langs->trans("MemberStatusDraftShort");
|
||||
$labelStatus = $langs->trans("MemberStatusDraft");
|
||||
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
|
||||
}
|
||||
elseif ($statut >= 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)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
522
htdocs/admin/mrp.php
Normal file
522
htdocs/admin/mrp.php
Normal 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&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.'&scan_dir='.$module->scandir.'&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.'&scan_dir='.$module->scandir.'&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> </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();
|
||||
@ -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";
|
||||
|
||||
|
||||
|
||||
@ -132,8 +132,8 @@ class DolibarrApi
|
||||
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);
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -809,19 +809,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -192,8 +192,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;
|
||||
|
||||
@ -3210,20 +3210,20 @@ class Propal extends CommonObject
|
||||
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='';
|
||||
@ -3233,7 +3233,7 @@ class Propal extends CommonObject
|
||||
elseif ($statut==self::STATUS_NOTSIGNED) $statusType='status5';
|
||||
elseif ($statut==self::STATUS_BILLED) $statusType='status6';
|
||||
|
||||
return dolGetStatus($this->labelstatut[$statut], $this->labelstatut_short[$statut], '', $statusType, $mode);
|
||||
return dolGetStatus($this->labelStatus[$statut], $this->labelStatusShort[$statut], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3484,48 +3484,48 @@ class Commande extends CommonOrder
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
|
||||
|
||||
if ($statut==self::STATUS_CANCELED){
|
||||
$labelstatut = $langs->trans('StatusOrderCanceled');
|
||||
$labelstatutShort = $langs->trans('StatusOrderCanceledShort');
|
||||
$labelStatus = $langs->trans('StatusOrderCanceled');
|
||||
$labelStatusShort = $langs->trans('StatusOrderCanceledShort');
|
||||
$statusType='status5';
|
||||
}
|
||||
elseif ($statut==self::STATUS_DRAFT){
|
||||
$labelstatut = $langs->trans('StatusOrderDraft');
|
||||
$labelstatutShort = $langs->trans('StatusOrderDraftShort');
|
||||
$labelStatus = $langs->trans('StatusOrderDraft');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDraftShort');
|
||||
$statusType='status0';
|
||||
}
|
||||
elseif ($statut==self::STATUS_VALIDATED){
|
||||
$labelstatut = $langs->trans('StatusOrderValidated').$billedtext;
|
||||
$labelstatutShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
$labelStatus = $langs->trans('StatusOrderValidated').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
$statusType='status1';
|
||||
}
|
||||
elseif ($statut==self::STATUS_SHIPMENTONPROCESS){
|
||||
$labelstatut = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelstatutShort = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelStatus = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$statusType='status3';
|
||||
}
|
||||
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelstatut = $langs->trans('StatusOrderToBill');
|
||||
$labelstatutShort = $langs->trans('StatusOrderToBillShort');
|
||||
$labelStatus = $langs->trans('StatusOrderToBill');
|
||||
$labelStatusShort = $langs->trans('StatusOrderToBillShort');
|
||||
$statusType='status4';
|
||||
}
|
||||
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelstatut = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelstatutShort = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelStatus = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$statusType='status6';
|
||||
}
|
||||
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
|
||||
$labelstatut = $langs->trans('StatusOrderDelivered');
|
||||
$labelstatutShort = $langs->trans('StatusOrderDelivered');
|
||||
$labelStatus = $langs->trans('StatusOrderDelivered');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDelivered');
|
||||
$statusType='status6';
|
||||
}
|
||||
else{
|
||||
$labelstatut = $langs->trans('Unknown');
|
||||
$labelstatutShort = '';
|
||||
$labelStatus = $langs->trans('Unknown');
|
||||
$labelStatusShort = '';
|
||||
$statusType='';
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -322,7 +322,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
//if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
@ -336,13 +336,9 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton='';
|
||||
//if ($user->rights->monmodule->creer)
|
||||
//{
|
||||
$newcardbutton='<a class="butActionNew" href="cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
//}
|
||||
$permforcashfence = 1;
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit);
|
||||
|
||||
@ -389,12 +385,18 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$cssforfield='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
|
||||
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||
$cssforfield=(empty($val['css'])?'':$val['css']);
|
||||
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
@ -416,15 +418,15 @@ print '</tr>'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$cssforfield='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
|
||||
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
|
||||
}
|
||||
$cssforfield=(empty($val['css'])?'':$val['css']);
|
||||
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
@ -467,25 +469,21 @@ while ($i < min($num, $limit))
|
||||
print '<tr class="oddeven">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$cssforfield='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
$cssforfield=(empty($val['css'])?'':$val['css']);
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right';
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right';
|
||||
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
if ($cssforfield || $val['css']) print ' class="';
|
||||
print $cssforfield;
|
||||
if ($cssforfield && $val['css']) print ' ';
|
||||
print $val['css'];
|
||||
if ($cssforfield || $val['css']) print '"';
|
||||
print '>';
|
||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') print $object->getLibStatut(5);
|
||||
elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
else print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
|
||||
@ -311,47 +311,20 @@ class CashControl extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelstatus[0] = $langs->trans('Draft');
|
||||
$this->labelstatus[1] = $langs->trans('Closed');
|
||||
$this->labelStatus[0] = $langs->trans('Draft');
|
||||
$this->labelStatus[1] = $langs->trans('Closed');
|
||||
$this->labelStatusShort[0] = $langs->trans('Draft');
|
||||
$this->labelStatusShort[1] = $langs->trans('Closed');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut6', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut0', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
$statusType = 'status0';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -565,7 +565,7 @@ class Invoices extends DolibarrApi
|
||||
throw new RestException(500);
|
||||
}
|
||||
|
||||
return array(
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Invoice deleted'
|
||||
|
||||
@ -69,7 +69,7 @@ class BonPrelevement extends CommonObject
|
||||
public $total;
|
||||
public $fetched;
|
||||
public $statut; // 0-Wait, 1-Trans, 2-Done
|
||||
public $labelstatut=array();
|
||||
public $labelStatus=array();
|
||||
|
||||
public $invoice_in_error=array();
|
||||
public $thirdparty_in_error=array();
|
||||
@ -2002,48 +2002,48 @@ class BonPrelevement extends CommonObject
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatut))
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("withdrawals");
|
||||
$this->labelstatut[0]=$langs->trans("StatusWaiting");
|
||||
$this->labelstatut[1]=$langs->trans("StatusTrans");
|
||||
$this->labelstatut[2]=$langs->trans("StatusCredited");
|
||||
$this->labelStatus[0]=$langs->trans("StatusWaiting");
|
||||
$this->labelStatus[1]=$langs->trans("StatusTrans");
|
||||
$this->labelStatus[2]=$langs->trans("StatusCredited");
|
||||
}
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
{
|
||||
return $this->labelstatut[$statut];
|
||||
return $this->labelStatus[$statut];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
|
||||
if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1').' '.$this->labelStatus[$statut];
|
||||
elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3').' '.$this->labelStatus[$statut];
|
||||
elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6').' '.$this->labelStatus[$statut];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3');
|
||||
elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6');
|
||||
if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1');
|
||||
elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3');
|
||||
elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
|
||||
if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1').' '.$this->labelStatus[$statut];
|
||||
elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3').' '.$this->labelStatus[$statut];
|
||||
elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6').' '.$this->labelStatus[$statut];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
|
||||
elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
|
||||
if ($statut==0) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut1');
|
||||
elseif ($statut==1) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut3');
|
||||
elseif ($statut==2) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3');
|
||||
elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
|
||||
if ($statut==0) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut1');
|
||||
elseif ($statut==1) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut3');
|
||||
elseif ($statut==2) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut6');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1132,11 +1132,11 @@ else
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$amount += $obj->amount;
|
||||
$total_ht += $obj->amount;
|
||||
$total_ttc += $obj->amount;
|
||||
$subtotal_ht += $obj->amount;
|
||||
$subtotal_ttc += $obj->amount;
|
||||
$amount += -$obj->amount;
|
||||
$total_ht += -$obj->amount;
|
||||
$total_ttc += -$obj->amount;
|
||||
$subtotal_ht += -$obj->amount;
|
||||
$subtotal_ttc += -$obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -480,10 +480,10 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss[$obj->dm] += -$obj->amount;
|
||||
|
||||
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
|
||||
$encaiss_ttc[$obj->dm] += $obj->amount;
|
||||
$encaiss_ttc[$obj->dm] += -$obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ if (empty($reshook))
|
||||
$object->socid = GETPOST("socid", 'int');
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->civility_id = GETPOST("civility_id", 'alpha');
|
||||
$object->civility_code = GETPOST("civility_code", 'alpha');
|
||||
$object->poste = GETPOST("poste", 'alpha');
|
||||
$object->address = GETPOST("address", 'alpha');
|
||||
$object->zip = GETPOST("zipcode", 'alpha');
|
||||
@ -367,7 +367,7 @@ if (empty($reshook))
|
||||
$object->socid = GETPOST("socid", 'int');
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->civility_id = GETPOST("civility_id", 'alpha');
|
||||
$object->civility_code = GETPOST("civility_code", 'alpha');
|
||||
$object->poste = GETPOST("poste", 'alpha');
|
||||
|
||||
$object->address = GETPOST("address", 'alpha');
|
||||
@ -621,8 +621,8 @@ else
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOST("civility", 'alpha')?GETPOST("civility", 'alpha'):$object->civility_code);
|
||||
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility_code", 'alpha'):$object->civility_code, 'civility_code');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
|
||||
@ -931,8 +931,8 @@ else
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(isset($_POST["civility"])?GETPOST("civility"):$object->civility_code);
|
||||
print '<tr><td><label for="civility_code">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility", "aZ09"):$object->civility_code, 'civility_code');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
|
||||
|
||||
@ -328,13 +328,13 @@ class Contact extends CommonObject
|
||||
$this->town=(empty($this->town)?'':$this->town);
|
||||
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
|
||||
if (empty($this->statut)) $this->statut = 0;
|
||||
|
||||
if (empty($this->civility_code) && ! is_numeric($this->civility_id)) $this->civility_code = $this->civility_id; // For backward compatibility
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||
if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',";
|
||||
elseif ($this->socid == -1) $sql .= " fk_soc=null,";
|
||||
$sql .= " civility='".$this->db->escape($this->civility_id)."'";
|
||||
$sql .= " civility='".$this->db->escape($this->civility_code)."'";
|
||||
$sql .= ", lastname='".$this->db->escape($this->lastname)."'";
|
||||
$sql .= ", firstname='".$this->db->escape($this->firstname)."'";
|
||||
$sql .= ", address='".$this->db->escape($this->address)."'";
|
||||
@ -1264,13 +1264,13 @@ class Contact extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$labelstatus = array(
|
||||
$labelStatus = array(
|
||||
0 => 'ActivityCeased',
|
||||
1 => 'InActivity',
|
||||
4 => 'InActivity',
|
||||
5 => 'ActivityCeased',
|
||||
);
|
||||
$labelstatusshort = array(
|
||||
$labelStatusShort = array(
|
||||
0 => 'ActivityCeased',
|
||||
1 => 'InActivity',
|
||||
4 => 'InActivity',
|
||||
@ -1280,8 +1280,8 @@ class Contact extends CommonObject
|
||||
$statusType = 'status4';
|
||||
if ($status==0 || $status==5) $statusType = 'status5';
|
||||
|
||||
$label = $langs->trans($labelstatus[$status]);
|
||||
$labelshort = $langs->trans($labelstatusshort[$status]);
|
||||
$label = $langs->trans($labelStatus[$status]);
|
||||
$labelshort = $langs->trans($labelStatusShort[$status]);
|
||||
|
||||
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
@ -189,6 +189,12 @@ class Contrat extends CommonObject
|
||||
protected $lines_id_index_mapper=array();
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
const STATUS_CLOSED = 2;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -1881,40 +1887,31 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
* Renvoi label of a given contrat status
|
||||
*
|
||||
* @param int $statut Status id
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode)
|
||||
public function LibStatut($status, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
if ($mode == 0)
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
|
||||
elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
|
||||
elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
|
||||
$this->labelStatus[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated');
|
||||
$this->labelStatusShort[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
|
||||
elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
|
||||
elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0').' '.$langs->trans("ContractStatusDraft"); }
|
||||
elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4').' '.$langs->trans("ContractStatusValidated"); }
|
||||
elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6').' '.$langs->trans("ContractStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
|
||||
elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
|
||||
elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
|
||||
}
|
||||
elseif ($mode == 4 || $mode == 6 || $mode == 7)
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
|
||||
|
||||
if ($mode == 4 || $mode == 6 || $mode == 7)
|
||||
{
|
||||
$text='';
|
||||
if ($mode == 4) {
|
||||
@ -1924,22 +1921,20 @@ class Contrat extends CommonObject
|
||||
$text.=': ';
|
||||
$text.='</span>';
|
||||
}
|
||||
$text.=($mode == 7?'<div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')) : '';
|
||||
$text.=($mode == 7?'</div>':'');
|
||||
$text.=($mode == 7?'<span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</span><span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</span><span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
|
||||
$text.=($mode == 7?'</span><span class="nowrap">':'');
|
||||
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="marginleft2"')) : '';
|
||||
$text.=($mode == 7?'</span>':'');
|
||||
return $text;
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
else
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'), 'statut0'); }
|
||||
elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'), 'statut4'); }
|
||||
elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'), 'statut6'); }
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2728,65 +2723,34 @@ class ContratLigne extends CommonObjectLine
|
||||
/**
|
||||
* Return label of a contract line status
|
||||
*
|
||||
* @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 int $expired 0=Not expired, 1=Expired, -1=Both or unknown
|
||||
* @param string $moreatt More attribute
|
||||
* @return string Libelle
|
||||
*/
|
||||
public static function LibStatut($statut, $mode, $expired = -1, $moreatt = '')
|
||||
public static function LibStatut($status, $mode, $expired = -1, $moreatt = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
if ($mode == 0)
|
||||
|
||||
if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); }
|
||||
elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); }
|
||||
elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); }
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3';
|
||||
if ($status == self::STATUS_CLOSED) $statusType = 'status6';
|
||||
|
||||
$params = array(); $reg = array();
|
||||
if (preg_match('/class="(.*)"/', $moreatt, $reg))
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0', $moreatt); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4', $moreatt); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4', $moreatt); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3', $moreatt); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6', $moreatt); }
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLate"); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'), 'statut0'); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'), 'statut4'); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'), 'statut4'); }
|
||||
elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'), 'statut3'); }
|
||||
elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'), 'statut6'); }
|
||||
$params = array('badgeParams'=>array('css' => $reg[1]));
|
||||
}
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -138,7 +138,7 @@ class box_ficheinter extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="nowrap right"',
|
||||
'text' => $ficheinterstatic->getLibStatut(6),
|
||||
'text' => $ficheinterstatic->getLibStatut(3),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
|
||||
@ -119,25 +119,25 @@ class box_task extends ModeleBoxes
|
||||
// list the summary of the orders
|
||||
if ($user->rights->projet->lire) {
|
||||
$boxcontent.= '<div id="ancor-idfilter'.$this->boxcode.'" style="display: block; position: absolute; margin-top: -100px"></div>'."\n";
|
||||
$boxcontent.= '<div id="idfilter'.$this->boxcode.'" class="hideobject center" >'."\n";
|
||||
$boxcontent.= '<div id="idfilter'.$this->boxcode.'" class="center" >'."\n";
|
||||
$boxcontent.= '<form class="flat " method="POST" action="'.$_SERVER["PHP_SELF"].'#ancor-idfilter'.$this->boxcode.'">'."\n";
|
||||
$boxcontent.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
$selectArray = array('all' => $langs->trans("NoFilter"), 'im_task_contact' => $langs->trans("WhichIamLinkedTo"), 'im_project_contact' => $langs->trans("WhichIamLinkedToProject"));
|
||||
$boxcontent.= $form->selectArray($cookie_name, $selectArray, $filterValue);
|
||||
$boxcontent.= '<button type="submit" >'.$langs->trans("Change").'</button>';
|
||||
$boxcontent.= '<button type="submit" class="button">'.$langs->trans("Refresh").'</button>';
|
||||
$boxcontent.= '</form>'."\n";
|
||||
$boxcontent.= '</div>'."\n";
|
||||
$boxcontent.= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
jQuery(".showiffilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
// set cookie by js
|
||||
$boxcontent.='<script>date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>';
|
||||
$this->info_box_contents[0][] = array(
|
||||
'tr'=>'class="nohover"',
|
||||
'tr'=>'class="nohover showiffilter'.$this->boxcode.' hideobject"',
|
||||
'td' => 'class="nohover"',
|
||||
'textnoformat' => $boxcontent,
|
||||
);
|
||||
@ -188,7 +188,7 @@ class box_task extends ModeleBoxes
|
||||
|
||||
$label = $projectstatic->getNomUrl(1).' '.$taskstatic->getNomUrl(1).' '.dol_htmlentities($taskstatic->label);
|
||||
|
||||
$boxcontent = getTaskProgressView($taskstatic, $label, true, false, true);
|
||||
$boxcontent = getTaskProgressView($taskstatic, $label, true, false, false);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => '',
|
||||
|
||||
@ -496,27 +496,27 @@ abstract class CommonInvoice extends CommonObject
|
||||
$prefix='Short';
|
||||
if (! $paye){
|
||||
if ($status == 0) {
|
||||
$labelstatut = $langs->trans('BillStatusDraft');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
$labelStatus = $langs->trans('BillStatusDraft');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusDraft');
|
||||
}
|
||||
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
|
||||
$labelstatut = $langs->trans('BillStatusClosedUnpaid');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
|
||||
$labelStatus = $langs->trans('BillStatusClosedUnpaid');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
|
||||
$statusType='status5';
|
||||
}
|
||||
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
|
||||
$labelstatut = $langs->trans('BillStatusClosedPaidPartially');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
|
||||
$labelStatus = $langs->trans('BillStatusClosedPaidPartially');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
|
||||
$statusType='status9';
|
||||
}
|
||||
elseif ($alreadypaid <= 0) {
|
||||
$labelstatut = $langs->trans('BillStatusNotPaid');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusNotPaid');
|
||||
$labelStatus = $langs->trans('BillStatusNotPaid');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusNotPaid');
|
||||
$statusType='status1';
|
||||
}
|
||||
else {
|
||||
$labelstatut = $langs->trans('BillStatusStarted');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
$labelStatus = $langs->trans('BillStatusStarted');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusStarted');
|
||||
$statusType='status3';
|
||||
}
|
||||
}
|
||||
@ -525,20 +525,20 @@ abstract class CommonInvoice extends CommonObject
|
||||
$statusType='status6';
|
||||
|
||||
if ($type == self::TYPE_CREDIT_NOTE){
|
||||
$labelstatut = $langs->trans('BillStatusPaidBackOrConverted'); // credit note
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
|
||||
$labelStatus = $langs->trans('BillStatusPaidBackOrConverted'); // credit note
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
|
||||
}
|
||||
elseif ($type == self::TYPE_DEPOSIT){
|
||||
$labelstatut = $langs->trans('BillStatusConverted'); // deposit invoice
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
|
||||
$labelStatus = $langs->trans('BillStatusConverted'); // deposit invoice
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
|
||||
}
|
||||
else{
|
||||
$labelstatut = $langs->trans('BillStatusPaid');
|
||||
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaid');
|
||||
$labelStatus = $langs->trans('BillStatusPaid');
|
||||
$labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaid');
|
||||
}
|
||||
}
|
||||
|
||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@ -5624,7 +5624,7 @@ abstract class CommonObject
|
||||
{
|
||||
$morecss = 'minwidth100imp';
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
elseif ($type == 'datetime' || $type == 'link')
|
||||
{
|
||||
$morecss = 'minwidth200imp';
|
||||
}
|
||||
@ -6093,7 +6093,7 @@ abstract class CommonObject
|
||||
$param_list_array = explode(':', $param_list[0]);
|
||||
$showempty=(($required && $default != '')?0:1);
|
||||
|
||||
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', '', '', 0, empty($val['disabled'])?0:1);
|
||||
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, empty($val['disabled'])?0:1);
|
||||
|
||||
if (! empty($param_list_array[2])) // If we set to add a create button
|
||||
{
|
||||
|
||||
@ -5865,7 +5865,12 @@ class Form
|
||||
if ($classname && class_exists($classname))
|
||||
{
|
||||
$objecttmp = new $classname($this->db);
|
||||
$objecttmp->filter = $filter;
|
||||
// Make some replacement
|
||||
$sharedentities = getEntity(strtolower($classname));
|
||||
$objecttmp->filter = str_replace(
|
||||
array('__ENTITY__', '__SHARED_ENTITIES__', '__USER_ID__'),
|
||||
array($conf->entity, $sharedentities, $user->id),
|
||||
$filter);
|
||||
}
|
||||
}
|
||||
if (! is_object($objecttmp))
|
||||
@ -5874,6 +5879,7 @@ class Form
|
||||
return 'Error bad setup of type for field '.join(',', $InfoFieldList);
|
||||
}
|
||||
|
||||
//var_dump($objecttmp->filter);
|
||||
$prefixforautocompletemode=$objecttmp->element;
|
||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
|
||||
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
@ -47,7 +47,7 @@ class FormWebsite
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML select list of export models
|
||||
* Return HTML select list of websites
|
||||
*
|
||||
* @param string $selected Id modele pre-selectionne
|
||||
* @param string $htmlname Name of HTML select
|
||||
@ -99,7 +99,7 @@ class FormWebsite
|
||||
|
||||
|
||||
/**
|
||||
* Return a HTML select list of a dictionary
|
||||
* Return a HTML select list of type of containers from the dictionary
|
||||
*
|
||||
* @param string $htmlname Name of select zone
|
||||
* @param string $selected Selected value
|
||||
@ -162,7 +162,7 @@ class FormWebsite
|
||||
|
||||
|
||||
/**
|
||||
* Return a HTML select list of type of containers
|
||||
* Return a HTML select list of samples of containers content
|
||||
*
|
||||
* @param string $htmlname Name of select zone
|
||||
* @param string $selected Selected value
|
||||
@ -217,4 +217,72 @@ class FormWebsite
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a HTML select list of containers of a website.
|
||||
* Note: $website->lines must have been loaded.
|
||||
*
|
||||
* @param Website $website Object Website
|
||||
* @param string $htmlname Name of select zone
|
||||
* @param int $pageid Preselected container ID
|
||||
* @param int $showempty Show empty record
|
||||
* @param string $action Action on page that use this select list
|
||||
* @return string HTML select component with list of type of containers
|
||||
*/
|
||||
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
|
||||
|
||||
$out='';
|
||||
if ($atleastonepage && $action != 'editsource')
|
||||
{
|
||||
$out.='<select name="'.$htmlname.'" id="'.$htmlname.'" class="minwidth200 maxwidth300">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<select name="pageidbis" id="pageid" class="minwidth200 maxwidth300" disabled="disabled">';
|
||||
}
|
||||
|
||||
if ($showempty || ! $atleastonepage) $out.='<option value="-1"> </option>';
|
||||
|
||||
if ($atleastonepage)
|
||||
{
|
||||
if (empty($pageid) && $action != 'createcontainer') // Page id is not defined, we try to take one
|
||||
{
|
||||
$firstpageid=0;$homepageid=0;
|
||||
foreach($website->lines as $key => $valpage)
|
||||
{
|
||||
if (empty($firstpageid)) $firstpageid=$valpage->id;
|
||||
if ($website->fk_default_home && $key == $website->fk_default_home) $homepageid=$valpage->id;
|
||||
}
|
||||
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
|
||||
}
|
||||
|
||||
foreach($website->lines as $key => $valpage)
|
||||
{
|
||||
$out.='<option value="'.$key.'"';
|
||||
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
|
||||
$out.='>';
|
||||
$out.='['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] ';
|
||||
$out.=$valpage->pageurl.' - '.$valpage->title;
|
||||
if ($website->fk_default_home && $key == $website->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
|
||||
$out.='</option>';
|
||||
}
|
||||
}
|
||||
$out.='</select>';
|
||||
|
||||
if ($atleastonepage && $action != 'editsource')
|
||||
{
|
||||
$out.=ajax_combobox($htmlname);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<input type="hidden" name="'.$htmlname.'" value="'.$pageid.'">';
|
||||
$out.=ajax_combobox($htmlname);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1851,7 +1851,7 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
|
||||
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
|
||||
{
|
||||
try {
|
||||
$ret = $image->writeImages($fileoutput, true);
|
||||
$ret = $image->writeImages($fileoutput, true);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
|
||||
@ -2997,7 +2997,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
|
||||
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
||||
* @param string $alt Force alt for bind people
|
||||
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
|
||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left maring on picto, 0 = No margin left. Works for fontawesome picto only.
|
||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only.
|
||||
* @return string Return img tag
|
||||
* @see img_object(), img_picto_common()
|
||||
*/
|
||||
@ -3028,7 +3028,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'address', 'bank', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h', 'bookmark', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note',
|
||||
'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
|
||||
'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
|
||||
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
|
||||
@ -3058,12 +3059,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$morecss .= ($morecss ? ' ' : '').('picto'.$pictowithouttext);
|
||||
} elseif ($pictowithouttext == 'switch_off') {
|
||||
$facolor = '#999';
|
||||
$fasize = '2em';
|
||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
}
|
||||
elseif ($pictowithouttext == 'switch_on') {
|
||||
$facolor = '#227722';
|
||||
$fasize = '2em';
|
||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
}
|
||||
elseif ($pictowithouttext == 'off') {
|
||||
@ -8094,19 +8093,18 @@ function roundUpToNextMultiple($n, $x = 5)
|
||||
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
|
||||
{
|
||||
$attr=array(
|
||||
'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
|
||||
'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'').(empty($params['css'])?'':' '.$params['css'])
|
||||
);
|
||||
|
||||
if(empty($html)){
|
||||
if (empty($html)) {
|
||||
$html = $label;
|
||||
}
|
||||
|
||||
if(!empty($url)){
|
||||
if (!empty($url)) {
|
||||
$attr['href'] = $url;
|
||||
}
|
||||
|
||||
if($mode==='dot')
|
||||
{
|
||||
if ($mode==='dot') {
|
||||
$attr['class'].= ' classfortooltip';
|
||||
$attr['title'] = $html;
|
||||
$attr['aria-label'] = $label;
|
||||
@ -8114,8 +8112,8 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
||||
}
|
||||
|
||||
// Override attr
|
||||
if(!empty($params['attr']) && is_array($params['attr'])){
|
||||
foreach($params['attr']as $key => $value){
|
||||
if (!empty($params['attr']) && is_array($params['attr'])) {
|
||||
foreach($params['attr']as $key => $value) {
|
||||
$attr[$key] = $value;
|
||||
}
|
||||
}
|
||||
@ -8126,7 +8124,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
||||
$attr = array_map('dol_escape_htmltag', $attr);
|
||||
|
||||
$TCompiledAttr = array();
|
||||
foreach($attr as $key => $value){
|
||||
foreach($attr as $key => $value) {
|
||||
$TCompiledAttr[] = $key.'="'.$value.'"';
|
||||
}
|
||||
|
||||
@ -8169,13 +8167,13 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
elseif ($displayMode == 1) {
|
||||
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
|
||||
}
|
||||
// use status with images
|
||||
elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) {
|
||||
// Use status with images (for backward compatibility)
|
||||
elseif (! empty($conf->global->MAIN_STATUS_USES_IMAGES)) {
|
||||
$return = '';
|
||||
$htmlLabel = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
||||
$htmlLabelShort = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
||||
|
||||
// For small screen, we use the short label instead of long label.
|
||||
// For small screen, we always use the short label instead of long label.
|
||||
if (! empty($conf->dol_optimize_smallscreen))
|
||||
{
|
||||
if ($displayMode == 0) $displayMode = 1;
|
||||
@ -8183,7 +8181,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
elseif ($displayMode == 6) $displayMode = 5;
|
||||
}
|
||||
|
||||
// image's filename are still in French, so we use this array to convert
|
||||
// For backward compatibility. Image's filename are still in French, so we use this array to convert
|
||||
$statusImg=array(
|
||||
'status0' => 'statut0'
|
||||
,'status1' => 'statut1'
|
||||
@ -8220,7 +8218,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
}
|
||||
}
|
||||
// Use new badge
|
||||
elseif (!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)) {
|
||||
elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
|
||||
$statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel;
|
||||
|
||||
if ($displayMode == 3) {
|
||||
|
||||
@ -128,17 +128,19 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
$i++;
|
||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||
$texttoinsert.= " 'notnull'=>".(empty($val['notnull'])?0:$val['notnull']).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
if ($val['noteditable']) $texttoinsert.= " 'noteditable'=>'".$val['noteditable']."',";
|
||||
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['css']) $texttoinsert.= " 'css'=>'".$val['css']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\",";
|
||||
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
|
||||
if ($val['disabled']) $texttoinsert.= " 'disabled'=>'".$val['disabled']."',";
|
||||
if ($val['arrayofkeyval'])
|
||||
{
|
||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||
@ -149,8 +151,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
$texttoinsert.="'".$key2."'=>'".$val2."'";
|
||||
$i++;
|
||||
}
|
||||
$texttoinsert.= ")";
|
||||
$texttoinsert.= "),";
|
||||
}
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
|
||||
|
||||
$texttoinsert.= "),\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,8 +670,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
if ($total_projectlinesa_planned) {
|
||||
$totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
|
||||
$totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
|
||||
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
|
||||
|
||||
// define progress color according to time spend vs workload
|
||||
$progressBarClass = 'progress-bar-info';
|
||||
@ -2020,26 +2021,27 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
|
||||
if ($task->planned_workload){
|
||||
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
|
||||
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
|
||||
|
||||
$diffTitle = '<br/>'.$langs->trans('ProgressDeclared').' : '.$task->progress.'%';
|
||||
$diffTitle.= '<br/>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.'%';
|
||||
$diffTitle = '<br/>'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : '');
|
||||
$diffTitle.= '<br/>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : '');
|
||||
|
||||
if($progressCalculated > doubleval($task->progress)){
|
||||
//var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.doubleval($task->progress * $warningRatio));
|
||||
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
|
||||
$progressBarClass = 'progress-bar-danger';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-danger classfortooltip"" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
|
||||
$diff = '<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
|
||||
elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 1%
|
||||
$progressBarClass = 'progress-bar-warning';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-warning classfortooltip" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point"));
|
||||
$diff = '<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
else{
|
||||
$progressBarClass = 'progress-bar-success';
|
||||
$title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-success classfortooltip" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-up"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
$title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).' '.$langs->trans("point"));
|
||||
$diff = '<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-up"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -2062,7 +2064,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
|
||||
if($progressNumber !== false)
|
||||
{
|
||||
$out.= ' <span class="progress-number">';
|
||||
if($progressNumber!==true){
|
||||
if ($progressNumber!==true) {
|
||||
$out.= $progressNumber; // replace label by param
|
||||
}
|
||||
else{
|
||||
@ -2087,8 +2089,21 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
|
||||
|
||||
|
||||
$out.= '</span>';
|
||||
$out.= ' <div class="progress sm '.$spaced.'" title="'.doubleval($task->progress).'%" >';
|
||||
$out.= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.doubleval($task->progress).'%"></div>';
|
||||
$out.= ' <div class="progress sm '.$spaced.'">';
|
||||
$diffval = doubleval($task->progress) - doubleval($progressCalculated);
|
||||
if ($diffval >= 0) {
|
||||
// good
|
||||
$out.= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.doubleval($task->progress).'%" title="'.doubleval($task->progress).'%">';
|
||||
$out.= ' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated / $task->progress * 100).'%" title="'.doubleval($progressCalculated).'%"></div>';
|
||||
$out.= ' </div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// bad
|
||||
$out.= ' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated).'%" title="'.doubleval($progressCalculated).'%">';
|
||||
$out.= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.($task->progress ? doubleval($task->progress / $progressCalculated * 100).'%' : '1px').'" title="'.doubleval($task->progress).'%"></div>';
|
||||
$out.= ' </div>';
|
||||
}
|
||||
$out.= ' </div>';
|
||||
$out.= '</div>';
|
||||
|
||||
@ -2117,8 +2132,8 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '')
|
||||
if ($task->planned_workload){
|
||||
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
|
||||
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
// this conf is actually hidden, by default we use 10% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
|
||||
|
||||
if($progressCalculated > doubleval($task->progress)){
|
||||
$badgeClass.= 'badge-danger';
|
||||
|
||||
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||
/**
|
||||
* Class to build documents using ODF templates generator
|
||||
*/
|
||||
class doc_generic_bom_odt extends ModelePDFBOMs
|
||||
class doc_generic_bom_odt extends ModelePDFBoms
|
||||
{
|
||||
/**
|
||||
* Issuer
|
||||
@ -479,7 +479,7 @@ class doc_generic_bom_odt extends ModelePDFBOMs
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$odfHandler->saveToDisk($file);
|
||||
$odfHandler->saveToDisk($file);
|
||||
} catch (Exception $e) {
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
|
||||
@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
|
||||
/**
|
||||
* Parent class for boms models
|
||||
*/
|
||||
abstract class ModelePDFBom extends CommonDocGenerator
|
||||
abstract class ModelePDFBoms extends CommonDocGenerator
|
||||
{
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@ -189,7 +189,7 @@ class modBom extends DolibarrModules
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in bom/core/boxes that contains class to show a widget.
|
||||
$this->boxes = array(
|
||||
0=>array('file'=>'box_boms.php','note'=>'','enabledbydefaulton'=>'Home')
|
||||
0=>array('file' => 'box_boms.php', 'note' => '', 'enabledbydefaulton' => 'Home')
|
||||
);
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ class modBom extends DolibarrModules
|
||||
// );
|
||||
|
||||
|
||||
// Permissions
|
||||
// Permissions provided by this module
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
|
||||
$r=0;
|
||||
@ -228,7 +228,7 @@ class modBom extends DolibarrModules
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2)
|
||||
|
||||
|
||||
// Main menu entries
|
||||
// Main menu entries to add
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
@ -323,9 +323,8 @@ class modBom extends DolibarrModules
|
||||
if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default')
|
||||
|
||||
// Create extrafields
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
//$extrafields = new ExtraFields($this->db);
|
||||
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
|
||||
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
|
||||
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
|
||||
@ -357,8 +356,8 @@ class modBom extends DolibarrModules
|
||||
}
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('alpha')."' AND type = 'bom' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('alpha')."', 'bom', ".$conf->entity.")"
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'bom' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'bom', ".$conf->entity.")"
|
||||
);
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
|
||||
@ -58,7 +58,7 @@ class modMrp extends DolibarrModules
|
||||
// Module label (no space allowed), used if translation string 'ModuleMrpName' not found (Mrp is name of module).
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
// Module description, used if translation string 'ModuleMrpDesc' not found (Mrp is name of module).
|
||||
$this->description = "MRPDescription";
|
||||
$this->description = "Module to Manage Manufacturing Orders (MO)";
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "Module to Manage Manufacturing Orders (MO)";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
@ -113,7 +113,7 @@ class modMrp extends DolibarrModules
|
||||
// Example: this->dirs = array("/mrp/temp","/mrp/subdir");
|
||||
$this->dirs = array("/mrp/temp");
|
||||
// Config pages. Put here list of php page, stored into mrp/admin directory, to use to setup module.
|
||||
$this->config_page_url = array("setup.php@mrp");
|
||||
$this->config_page_url = array("mrp.php");
|
||||
// Dependencies
|
||||
// A condition to hide module
|
||||
$this->hidden = false;
|
||||
@ -135,7 +135,9 @@ class modMrp extends DolibarrModules
|
||||
// 2 => array('MRP_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
|
||||
// );
|
||||
$this->const = array(
|
||||
// 1 => array('MRP_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
|
||||
1=>array('MRP_MO_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of MO', 0),
|
||||
2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0),
|
||||
3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/mrps', '', 0)
|
||||
);
|
||||
|
||||
// Some keys to add into the overwriting translation tables
|
||||
@ -312,6 +314,8 @@ class modMrp extends DolibarrModules
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$result=$this->_load_tables('/mrp/sql/');
|
||||
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
|
||||
@ -324,7 +328,34 @@ class modMrp extends DolibarrModules
|
||||
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
// ODT template
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt';
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/mrps';
|
||||
$dest=$dirodt.'/template_mo.odt';
|
||||
|
||||
if (file_exists($src) && ! file_exists($dest))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_mkdir($dirodt);
|
||||
$result=dol_copy($src, $dest, 0, 0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'mo' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'mo', ".$conf->entity.")"
|
||||
);
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ class modStripe extends DolibarrModules
|
||||
'target' => '',
|
||||
'user' => 0
|
||||
);
|
||||
$this->menu[$r] = array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe',
|
||||
'type' => 'left',
|
||||
'titre' => 'StripePayoutList',
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
* \brief File of class to build ODT documents for MOs
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/bom/modules_bom.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/mrp/modules_mrp.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||
/**
|
||||
* Class to build documents using ODF templates generator
|
||||
*/
|
||||
class doc_generic_mo_odt extends ModelePDFMOs
|
||||
class doc_generic_mo_odt extends ModelePDFMos
|
||||
{
|
||||
/**
|
||||
* Issuer
|
||||
@ -486,7 +486,7 @@ class doc_generic_mo_odt extends ModelePDFMOs
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$odfHandler->saveToDisk($file);
|
||||
$odfHandler->saveToDisk($file);
|
||||
} catch (Exception $e) {
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/mod_mrp_advanced.php
|
||||
* \file htdocs/core/modules/mrp/mod_mo_advanced.php
|
||||
* \ingroup mrp
|
||||
* \brief File containing class for numbering model of MOs advanced
|
||||
*/
|
||||
@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage customer Bom numbering rules advanced
|
||||
* Class to manage MO numbering rules advanced
|
||||
*/
|
||||
class mod_mrp_advanced extends ModeleNumRefMos
|
||||
class mod_mo_advanced extends ModeleNumRefMos
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
@ -68,7 +68,7 @@ class mod_mrp_advanced extends ModeleNumRefMos
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
||||
$texte.= '<input type="hidden" name="maskconstBom" value="MRP_ADVANCED_MASK">';
|
||||
$texte.= '<input type="hidden" name="maskconstBom" value="MRP_MO_ADVANCED_MASK">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo"));
|
||||
@ -79,7 +79,7 @@ class mod_mrp_advanced extends ModeleNumRefMos
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMo" value="'.$conf->global->MRP_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMo" value="'.$conf->global->MRP_MO_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte.= '<td class="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||
|
||||
@ -129,7 +129,7 @@ class mod_mrp_advanced extends ModeleNumRefMos
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask=$conf->global->MRP_ADVANCED_MASK;
|
||||
$mask=$conf->global->MRP_MO_ADVANCED_MASK;
|
||||
|
||||
if (! $mask)
|
||||
{
|
||||
@ -18,16 +18,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mrp/mod_mrp_standard.php
|
||||
* \file htdocs/core/modules/mrp/mod_mo_standard.php
|
||||
* \ingroup mrp
|
||||
* \brief File of class to manage MO numbering rules standard
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php';
|
||||
|
||||
/**
|
||||
* Class to manage customer order numbering rules standard
|
||||
* Class to manage MO numbering rules standard
|
||||
*/
|
||||
class mod_mrp_standard extends ModeleNumRefMos
|
||||
class mod_mo_standard extends ModeleNumRefMos
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
@ -85,7 +85,7 @@ class mod_mrp_standard extends ModeleNumRefMos
|
||||
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
@ -119,7 +119,7 @@ class mod_mrp_standard extends ModeleNumRefMos
|
||||
// D'abord on recupere la valeur max
|
||||
$posindice=9;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
@ -132,7 +132,7 @@ class mod_mrp_standard extends ModeleNumRefMos
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("mod_mrp_standard::getNextValue", LOG_DEBUG);
|
||||
dol_syslog("mod_mo_standard::getNextValue", LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ class mod_mrp_standard extends ModeleNumRefMos
|
||||
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||
else $num = sprintf("%04s", $max+1);
|
||||
|
||||
dol_syslog("mod_mrp_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||
dol_syslog("mod_mo_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||
return $this->prefix.$yymm."-".$num;
|
||||
}
|
||||
}
|
||||
@ -741,7 +741,7 @@ if (! empty($id) && $action != 'edit')
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0; $total = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder paymenttable centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
|
||||
@ -116,17 +116,18 @@ class Don extends CommonObject
|
||||
/**
|
||||
* @var array Array of status label
|
||||
*/
|
||||
public $labelstatut;
|
||||
public $labelStatus;
|
||||
|
||||
/**
|
||||
* @var array Array of status label short
|
||||
*/
|
||||
public $labelstatutshort;
|
||||
public $labelStatusShort;
|
||||
|
||||
|
||||
/**
|
||||
* Draft
|
||||
*/
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
const STATUS_PAID = 2;
|
||||
const STATUS_CANCELED = -1;
|
||||
|
||||
|
||||
/**
|
||||
@ -155,70 +156,32 @@ class Don extends CommonObject
|
||||
/**
|
||||
* Return the label of a given status
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $status Id statut
|
||||
* @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 Libelle du statut
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatut) || empty($this->labelstatutshort))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("donations");
|
||||
$this->labelstatut[-1]=$langs->trans("Canceled");
|
||||
$this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated");
|
||||
$this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated");
|
||||
$this->labelstatut[2]=$langs->trans("DonationStatusPaid");
|
||||
$this->labelstatutshort[-1]=$langs->trans("Canceled");
|
||||
$this->labelstatutshort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
|
||||
$this->labelstatutshort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
|
||||
$this->labelstatutshort[2]=$langs->trans("DonationStatusPaidShort");
|
||||
$this->labelStatus[-1]=$langs->trans("Canceled");
|
||||
$this->labelStatus[0]=$langs->trans("DonationStatusPromiseNotValidated");
|
||||
$this->labelStatus[1]=$langs->trans("DonationStatusPromiseValidated");
|
||||
$this->labelStatus[2]=$langs->trans("DonationStatusPaid");
|
||||
$this->labelStatusShort[-1]=$langs->trans("Canceled");
|
||||
$this->labelStatusShort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
|
||||
$this->labelStatusShort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
|
||||
$this->labelStatusShort[2]=$langs->trans("DonationStatusPaidShort");
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatut[$statut];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatutshort[$statut];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5').' '.$this->labelstatutshort[$statut];
|
||||
elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0').' '.$this->labelstatutshort[$statut];
|
||||
elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatutshort[$statut];
|
||||
elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatutshort[$statut];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5');
|
||||
elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0');
|
||||
elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut];
|
||||
elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut5');
|
||||
elseif ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut0');
|
||||
elseif ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut5');
|
||||
elseif ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut0');
|
||||
elseif ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1');
|
||||
elseif ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6');
|
||||
}
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_CANCELED) $statusType = 'status5';
|
||||
if ($status == self::STATUS_PAID) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -183,6 +183,10 @@ class EmailCollector extends CommonObject
|
||||
public $debuginfo;
|
||||
|
||||
|
||||
const STATUS_DISABLED = 0;
|
||||
const STATUS_ENABLED = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -506,47 +510,20 @@ class EmailCollector extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled');
|
||||
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_DISABLED] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
$statusType = 'status5';
|
||||
if ($status == self::STATUS_ENABLED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -408,46 +408,46 @@ class EmailCollectorAction extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("emailcollector");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
$this->labelStatus[1] = $langs->trans('Enabled');
|
||||
$this->labelStatus[0] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -383,46 +383,46 @@ class EmailCollectorFilter extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("emailcollector");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
$this->labelStatus[1] = $langs->trans('Enabled');
|
||||
$this->labelStatus[0] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +92,7 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$extrafields->fetch_name_optionals_label(OrderLine::$table_element);
|
||||
|
||||
// Load object. Make an object->fetch
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||
@ -301,12 +302,11 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i);
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline)) {
|
||||
if (is_array($extrafields->attributes[$object->table_element_line]['label'])) {
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
foreach ($extrafields->attributes[$object->table_element_line]['label'] as $key => $value) {
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
@ -627,11 +627,10 @@ if (empty($reshook))
|
||||
$line = new ExpeditionLigne($db);
|
||||
|
||||
// Extrafields Lines
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
|
||||
// Unset extrafield POST Data
|
||||
if (is_array($extralabelsline)) {
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
if (is_array($extrafields->attributes[$object->table_element_line]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element_line]['label'] as $key => $value) {
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1030,6 @@ if ($action == 'create')
|
||||
|
||||
if (empty($reshook)) {
|
||||
// copy from order
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
if ($object->fetch_optionals() > 0) {
|
||||
$expe->array_options = array_merge($expe->array_options, $object->array_options);
|
||||
}
|
||||
@ -1572,11 +1570,9 @@ if ($action == 'create')
|
||||
{
|
||||
//var_dump($line);
|
||||
$colspan=5;
|
||||
$extrafields->fetch_name_optionals_label($expe->table_element_line);
|
||||
$expLine = new ExpeditionLigne($db);
|
||||
|
||||
$srcLine = new OrderLine($db);
|
||||
$extrafields->fetch_name_optionals_label($srcLine->table_element);
|
||||
$srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
|
||||
//$line->fetch_optionals($line->id);
|
||||
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
|
||||
@ -2464,8 +2460,6 @@ elseif ($id || $ref)
|
||||
|
||||
$lines[$i]->fetch_optionals($lines[$i]->id);
|
||||
|
||||
$extrafields->fetch_name_optionals_label($lines[$i]->table_element);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
||||
{
|
||||
|
||||
@ -101,9 +101,6 @@ class ExpenseReport extends CommonObject
|
||||
// Paiement
|
||||
public $user_paid_infos;
|
||||
|
||||
/*
|
||||
END ACTIONS
|
||||
*/
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
@ -198,7 +195,7 @@ class ExpenseReport extends CommonObject
|
||||
// List of language codes for status
|
||||
$this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
|
||||
$this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused');
|
||||
$this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut5');
|
||||
$this->statuts_logo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -683,29 +680,15 @@ class ExpenseReport extends CommonObject
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
return $langs->transnoentities($this->statuts[$status]);
|
||||
$labelStatus = $langs->trans($this->statuts[$status]);
|
||||
$labelStatusShort = $langs->trans($this->statuts_short[$status]);
|
||||
|
||||
elseif ($mode == 1)
|
||||
return $langs->transnoentities($this->statuts_short[$status]);
|
||||
$statusType = $this->statuts_logo[$status];
|
||||
|
||||
elseif ($mode == 2)
|
||||
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]);
|
||||
|
||||
elseif ($mode == 3)
|
||||
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
|
||||
|
||||
elseif ($mode == 4)
|
||||
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]);
|
||||
|
||||
elseif ($mode == 5)
|
||||
return '<span class="hideonsmartphone">'.$langs->transnoentities($this->statuts_short[$status]).' </span>'.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
|
||||
|
||||
elseif ($mode == 6)
|
||||
return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -273,7 +273,7 @@ class SupplierOrders extends DolibarrApi
|
||||
throw new RestException(500);
|
||||
}
|
||||
|
||||
return array(
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Supplier order deleted'
|
||||
|
||||
@ -48,10 +48,6 @@ $id=GETPOST('id', 'int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
|
||||
|
||||
// Protection if external user
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
$result = restrictedArea($user, 'holiday', $id, 'holiday');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("holiday","mails"));
|
||||
|
||||
@ -65,14 +61,15 @@ if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
||||
$error = 0;
|
||||
|
||||
$object = new Holiday($db);
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
if ($id > 0)
|
||||
if (($id > 0) || $ref)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
// Check current user can read this leave request
|
||||
$canread = 0;
|
||||
@ -92,6 +89,10 @@ $candelete = 0;
|
||||
if (! empty($user->rights->holiday->delete)) $candelete=1;
|
||||
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1;
|
||||
|
||||
// Protection if external user
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -1217,68 +1217,40 @@ class Holiday extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Returns the label of a statut
|
||||
* Returns the label of a status
|
||||
*
|
||||
* @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
|
||||
* @param integer $startdate Date holiday should start
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0, $startdate = '')
|
||||
public function LibStatut($status, $mode = 0, $startdate = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
// phpcs:enable
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('DraftCP');
|
||||
elseif ($statut == 2) return $langs->trans('ToReviewCP');
|
||||
elseif ($statut == 3) return $langs->trans('ApprovedCP');
|
||||
elseif ($statut == 4) return $langs->trans('CancelCP');
|
||||
elseif ($statut == 5) return $langs->trans('RefuseCP');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0').' '.$langs->trans('DraftCP'); // Draft
|
||||
elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval
|
||||
elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved).' '.$langs->trans('ApprovedCP');
|
||||
elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5').' '.$langs->trans('CancelCP');
|
||||
elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5').' '.$langs->trans('RefuseCP');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0');
|
||||
elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1');
|
||||
elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved);
|
||||
elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5');
|
||||
elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5');
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft
|
||||
elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval
|
||||
elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved);
|
||||
elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5');
|
||||
elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
$pictoapproved='statut6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft
|
||||
elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval
|
||||
elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved);
|
||||
elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5');
|
||||
elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5');
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('DraftCP');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
|
||||
$this->labelStatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
|
||||
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('CancelCP');
|
||||
$this->labelStatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('DraftCP');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP');
|
||||
$this->labelStatusShort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP');
|
||||
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('CancelCP');
|
||||
$this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
|
||||
}
|
||||
|
||||
else return $statut;
|
||||
$statusType = 'status6';
|
||||
if (! empty($startdate) && $startdate > dol_now()) $statusType = 'status4';
|
||||
if ($status == self::STATUS_DRAFT) $statusType = 'status0';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
|
||||
if ($status == self::STATUS_CANCELED) $statusType = 'status5';
|
||||
if ($status == self::STATUS_REFUSED) $statusType = 'status5';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -121,6 +121,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'cp.ref'=>'Ref',
|
||||
'cp.description'=>'Description',
|
||||
'uu.lastname'=>'EmployeeLastname',
|
||||
'uu.firstname'=>'EmployeeFirstname',
|
||||
@ -289,10 +290,7 @@ $sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pou
|
||||
// Search all
|
||||
if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
// Ref
|
||||
if(!empty($search_ref))
|
||||
{
|
||||
$sql.= " AND cp.rowid = ".(int) $db->escape($search_ref);
|
||||
}
|
||||
if (!empty($search_ref)) $sql.= natural_search("cp.ref", $search_ref);
|
||||
// Start date
|
||||
$sql.= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start);
|
||||
// End date
|
||||
|
||||
@ -248,84 +248,13 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// Last expense report (old module)
|
||||
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = d.fk_user";
|
||||
$sql.= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')';
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid;
|
||||
$sql.= $db->order("d.tms", "DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).'</th>';
|
||||
print '<th class="right">'.$langs->trans("FeesKilometersOrAmout").'</th>';
|
||||
print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
|
||||
print '<th width="16"> </th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
|
||||
$deplacementstatic=new Deplacement($db);
|
||||
$userstatic=new User($db);
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$deplacementstatic->ref=$obj->rowid;
|
||||
$deplacementstatic->id=$obj->rowid;
|
||||
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->statut=$obj->statut;
|
||||
$userstatic->photo=$obj->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$deplacementstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).'</td>';
|
||||
print '<td class="right">'.$obj->km.'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
|
||||
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut, 3).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
// Last expense report (new module)
|
||||
// Latest expense report
|
||||
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
|
||||
@ -342,7 +271,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
|
||||
Binary file not shown.
BIN
htdocs/install/doctemplates/mrps/template_mo.odt
Normal file
BIN
htdocs/install/doctemplates/mrps/template_mo.odt
Normal file
Binary file not shown.
@ -49,6 +49,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
|
||||
|
||||
-- For v11
|
||||
|
||||
ALTER TABLE llx_don ADD COLUMN fk_user_modif integer;
|
||||
|
||||
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_origin_line (fk_origin_line);
|
||||
|
||||
ALTER TABLE llx_rights_def ADD COLUMN module_position INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
@ -47,6 +47,7 @@ create table llx_don
|
||||
fk_projet integer NULL, -- Donation is given for a project ?
|
||||
datec datetime, -- Create date
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
date_valid datetime, -- date de validation
|
||||
fk_user_valid integer NULL,
|
||||
note_private text,
|
||||
|
||||
@ -6,7 +6,7 @@ ModuleBuilderDesc2=Path where modules are generated/edited (first directory for
|
||||
ModuleBuilderDesc3=Generated/editable modules found: <strong>%s</strong>
|
||||
ModuleBuilderDesc4=A module is detected as 'editable' when the file <strong>%s</strong> exists in root of module directory
|
||||
NewModule=New module
|
||||
NewObject=New object
|
||||
NewObjectInModulebuilder=New object
|
||||
ModuleKey=Module key
|
||||
ObjectKey=Object key
|
||||
ModuleInitialized=Module initialized
|
||||
@ -66,8 +66,8 @@ ReadmeFile=Readme file
|
||||
ChangeLog=ChangeLog file
|
||||
TestClassFile=File for PHP Unit Test class
|
||||
SqlFile=Sql file
|
||||
PageForLib=File for PHP library
|
||||
PageForObjLib=File for PHP library dedicated to object
|
||||
PageForLib=File for the common PHP library
|
||||
PageForObjLib=File for the PHP library dedicated to object
|
||||
SqlFileExtraFields=Sql file for complementary attributes
|
||||
SqlFileKey=Sql file for keys
|
||||
SqlFileKeyExtraFields=Sql file for keys of complementary attributes
|
||||
@ -124,4 +124,14 @@ UseSpecificEditorURL = Use a specific editor URL
|
||||
UseSpecificFamily = Use a specific family
|
||||
UseSpecificAuthor = Use a specific author
|
||||
UseSpecificVersion = Use a specific initial version
|
||||
ModuleMustBeEnabled=The module/application must be enabled first
|
||||
ModuleMustBeEnabled=The module/application must be enabled first
|
||||
IncludeRefGeneration=The reference of object must be generated automatically
|
||||
IncludeRefGenerationHelp=Check this if you want to include code to manage the generation automatically of the reference
|
||||
IncludeDocGeneration=I want to generate some documents from the object
|
||||
IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record.
|
||||
ShowOnCombobox=Show value into combobox
|
||||
KeyForTooltip=Key for tooltip
|
||||
CSSClass=CSS Class
|
||||
NotEditable=Not editable
|
||||
ForeignKey=Foreign key
|
||||
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
|
||||
@ -2,7 +2,7 @@ Mrp=Manufacturing Orders
|
||||
MO=Manufacturing Order
|
||||
MRPDescription=Module to manage Manufacturing Orders (MO).
|
||||
MRPArea=MRP Area
|
||||
MrpSetupPage=Setup of module MO
|
||||
MrpSetupPage=Setup of module MRP
|
||||
MenuBOM=Bills of material
|
||||
LatestBOMModified=Latest %s Bills of materials modified
|
||||
LatestMOModified=Latest %s Manufacturing Orders modified
|
||||
@ -14,14 +14,21 @@ ListOfManufacturingOrders=List of Manufacturing Orders
|
||||
NewBOM=New bill of material
|
||||
ProductBOMHelp=Product to create with this BOM
|
||||
BOMsNumberingModules=BOM numbering templates
|
||||
BOMsModelModule=BOMS document templates
|
||||
BOMsModelModule=BOM document templates
|
||||
MOsNumberingModules=MO numbering templates
|
||||
MOsModelModule=MO document templates
|
||||
FreeLegalTextOnBOMs=Free text on document of BOM
|
||||
WatermarkOnDraftBOMs=Watermark on draft BOM
|
||||
ConfirmCloneBillOfMaterials=Are you sure you want to clone this bill of material ?
|
||||
FreeLegalTextOnMOs=Free text on document of MO
|
||||
WatermarkOnDraftMOs=Watermark on draft MO
|
||||
ConfirmCloneBillOfMaterials=Are you sure you want to clone the bill of material %s ?
|
||||
ConfirmCloneMo=Are you sure you want to clone the Manufacturing Order %s ?
|
||||
ManufacturingEfficiency=Manufacturing efficiency
|
||||
ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production
|
||||
DeleteBillOfMaterials=Delete Bill Of Materials
|
||||
DeleteMo=Delete Manufacturing Order
|
||||
ConfirmDeleteBillOfMaterials=Are you sure you want to delete this Bill Of Material?
|
||||
ConfirmDeleteMo=Are you sure you want to delete this Bill Of Material?
|
||||
MenuMRP=Manufacturing Orders
|
||||
NewMO=New Manufacturing Order
|
||||
QtyToProduce=Qty to produce
|
||||
|
||||
@ -117,4 +117,5 @@ ImportSite=Import site
|
||||
EditInLineOnOff=Mode 'Edit inline' is %s
|
||||
ShowSubContainersOnOff=Mode to execute 'dynamic content' is %s
|
||||
GlobalCSSorJS=Global CSS/JS/Header file of web site
|
||||
BackToHomePage=Back to home page...
|
||||
BackToHomePage=Back to home page...
|
||||
TranslationLinks=Translation links
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -480,10 +480,15 @@ if ($dirins && $action == 'initcss' && !empty($module))
|
||||
'Mon module'=>$modulename,
|
||||
'mon module'=>$modulename,
|
||||
'htdocs/modulebuilder/template'=>strtolower($modulename),
|
||||
'---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
|
||||
'---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':''),
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
|
||||
// Update descriptor file to uncomment file
|
||||
$srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
$arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\'');
|
||||
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -518,6 +523,11 @@ if ($dirins && $action == 'initjs' && !empty($module))
|
||||
);
|
||||
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
|
||||
// Update descriptor file to uncomment file
|
||||
$srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
$arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/js/'.strtolower($module).'.js.php', '/').'\'/' => '\'/'.strtolower($module).'/js/'.strtolower($module).'.js.php\'');
|
||||
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -635,6 +645,14 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module))
|
||||
|
||||
$result = dol_delete_file($filetodelete);
|
||||
if (dol_is_dir_empty($dirtodelete)) dol_delete_dir($dirtodelete);
|
||||
|
||||
// Update descriptor file to comment file
|
||||
if (in_array($tab, array('css', 'js')))
|
||||
{
|
||||
$srcfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||
$arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\',');
|
||||
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,6 +810,26 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
//'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php',
|
||||
);
|
||||
|
||||
if (GETPOST('includerefgeneration', 'aZ09'))
|
||||
{
|
||||
dol_mkdir($destdir.'/core/modules/'.strtolower($module));
|
||||
|
||||
$filetogenerate += array(
|
||||
'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php',
|
||||
'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php',
|
||||
);
|
||||
}
|
||||
if (GETPOST('includedocgeneration', 'aZ09'))
|
||||
{
|
||||
dol_mkdir($destdir.'/core/modules/'.strtolower($module));
|
||||
dol_mkdir($destdir.'/core/modules/'.strtolower($module).'/doc');
|
||||
|
||||
$filetogenerate += array(
|
||||
'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
|
||||
);
|
||||
}
|
||||
|
||||
foreach($filetogenerate as $srcfile => $destfile)
|
||||
{
|
||||
$result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0);
|
||||
@ -810,8 +848,21 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
}
|
||||
}
|
||||
|
||||
//if (! $error) // If there is error copying 1 file, we still have to make the replacement
|
||||
//{
|
||||
// Edit the class 'class/'.strtolower($objectname).'.class.php'
|
||||
if (GETPOST('includerefgeneration', 'aZ09')) {
|
||||
// Replace 'visible'=>1, 'noteditable'=>0, 'default'=>''
|
||||
$arrayreplacement = array('/\'visible\'=>1,\s*\'noteditable\'=>0,\s*\'default\'=>\'\'/' => "'visible'=>4, 'noteditable'=>1, 'default'=>'(PROV)'");
|
||||
//var_dump($arrayreplacement);exit;
|
||||
//var_dump($destdir.'/class/'.strtolower($objectname).'.class.php');exit;
|
||||
dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1);
|
||||
}
|
||||
|
||||
// Edit the setup file and the card page
|
||||
if (GETPOST('includedocgeneration', 'aZ09')) {
|
||||
// TODO
|
||||
// dolReplaceInFile();
|
||||
}
|
||||
|
||||
// Scan for object class files
|
||||
$listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$');
|
||||
|
||||
@ -884,15 +935,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
|
||||
// Add module descriptor to list of files to replace "MyObject' string with real name of object.
|
||||
$filetogenerate[]='core/modules/mod'.$module.'.class.php';
|
||||
|
||||
// TODO
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Edit PHP files
|
||||
// Edit PHP files to make replacement
|
||||
foreach($filetogenerate as $destfile)
|
||||
{
|
||||
$phpfileval['fullname'] = $destdir.'/'.$destfile;
|
||||
@ -937,6 +985,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null);
|
||||
$tabobj = $objectname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1105,7 +1154,7 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
|
||||
}
|
||||
}
|
||||
|
||||
if ($dirins && $action == 'confirm_delete')
|
||||
if ($dirins && $action == 'confirm_deletemodule')
|
||||
{
|
||||
if (preg_match('/[^a-z0-9_]/i', $module))
|
||||
{
|
||||
@ -1132,8 +1181,6 @@ if ($dirins && $action == 'confirm_delete')
|
||||
}
|
||||
}
|
||||
|
||||
//header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule');
|
||||
//exit;
|
||||
$action = '';
|
||||
$module = 'deletemodule';
|
||||
}
|
||||
@ -1155,26 +1202,31 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
|
||||
$dir = $dirins.'/'.$modulelowercase;
|
||||
|
||||
// Delete some files
|
||||
$filetogenerate = array(
|
||||
'myobject_card.php'=>strtolower($objectname).'_card.php',
|
||||
'myobject_note.php'=>strtolower($objectname).'_note.php',
|
||||
'myobject_document.php'=>strtolower($objectname).'_document.php',
|
||||
'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
|
||||
'myobject_list.php'=>strtolower($objectname).'_list.php',
|
||||
'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php',
|
||||
'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
|
||||
'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
|
||||
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
|
||||
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
|
||||
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
|
||||
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
|
||||
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
|
||||
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
|
||||
'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php'
|
||||
$filetodelete = array(
|
||||
'myobject_card.php'=>strtolower($objectname).'_card.php',
|
||||
'myobject_note.php'=>strtolower($objectname).'_note.php',
|
||||
'myobject_document.php'=>strtolower($objectname).'_document.php',
|
||||
'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
|
||||
'myobject_list.php'=>strtolower($objectname).'_list.php',
|
||||
'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php',
|
||||
'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
|
||||
'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
|
||||
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
|
||||
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
|
||||
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
|
||||
'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql',
|
||||
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
|
||||
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
|
||||
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
|
||||
'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php',
|
||||
'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php',
|
||||
'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php',
|
||||
'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
|
||||
);
|
||||
|
||||
$resultko = 0;
|
||||
foreach($filetogenerate as $filetodelete)
|
||||
foreach($filetodelete as $filetodelete)
|
||||
{
|
||||
$resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1);
|
||||
if (! $resulttmp) $resultko++;
|
||||
@ -1190,8 +1242,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
|
||||
}
|
||||
}
|
||||
|
||||
//header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule');
|
||||
//exit;
|
||||
$action = '';
|
||||
$tabobj = 'deleteobject';
|
||||
}
|
||||
@ -1418,6 +1468,7 @@ if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >=2 ||
|
||||
// Search modules to edit
|
||||
print '<!-- Scanned dir -->'."\n";
|
||||
$listofmodules=array();
|
||||
$i=0;
|
||||
foreach($dirsrootforscan as $dirread)
|
||||
{
|
||||
$dirsincustom=dol_dir_list($dirread, 'directories');
|
||||
@ -1475,8 +1526,12 @@ foreach($dirsrootforscan as $dirread)
|
||||
if (empty($newdircustom)) $newdircustom=img_warning();
|
||||
// If dirread was forced to somewhere else, by using URL
|
||||
// htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
|
||||
print $langs->trans("DirScanned").' : <strong class="wordbreakimp">'.$dirread.'</strong><br>';
|
||||
if (empty($i)) print $langs->trans("DirScanned").' : ';
|
||||
else print ', ';
|
||||
print '<strong class="wordbreakimp">'.$dirread.'</strong>';
|
||||
$i++;
|
||||
}
|
||||
print '<br>';
|
||||
//var_dump($listofmodules);
|
||||
|
||||
$message='';
|
||||
@ -1508,7 +1563,7 @@ if ($message)
|
||||
}
|
||||
|
||||
//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'<br>';
|
||||
$infomodulesfound = '<div style="padding: 12px 9px 12px">'.$form->textwithpicto($langs->trans("ModuleBuilderDesc3", count($listofmodules)), $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'</div>';
|
||||
$infomodulesfound = '<div style="padding: 12px 9px 12px">'.$form->textwithpicto('<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).'</span>', $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'</div>';
|
||||
|
||||
|
||||
// Load module descriptor
|
||||
@ -1583,16 +1638,17 @@ if ($module == 'initmodule')
|
||||
print $langs->trans("EnterNameOfModuleDesc").'<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'">';
|
||||
print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'"><br>';
|
||||
|
||||
print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>';
|
||||
print '<br><input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>';
|
||||
print '</form>';
|
||||
}
|
||||
elseif ($module == 'deletemodule')
|
||||
{
|
||||
print '<!-- Form to init a module -->'."\n";
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="delete">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="confirm_delete">';
|
||||
print '<input type="hidden" name="action" value="confirm_deletemodule">';
|
||||
print '<input type="hidden" name="module" value="deletemodule">';
|
||||
|
||||
print $langs->trans("EnterNameOfModuleToDeleteDesc").'<br><br>';
|
||||
@ -1623,23 +1679,23 @@ elseif (! empty($module))
|
||||
$linktoenabledisable='';
|
||||
if (! empty($conf->global->$const_name)) // If module is already activated
|
||||
{
|
||||
$linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod' . $module . $param . '">';
|
||||
$linktoenabledisable.=img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$linktoenabledisable.='<a class="reposition asetresetmodule" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod' . $module . $param . '">';
|
||||
$linktoenabledisable.=img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1);
|
||||
$linktoenabledisable.='</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod' . $module . $param . '">';
|
||||
$linktoenabledisable.=img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$linktoenabledisable.='<a class="reposition asetresetmodule" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod' . $module . $param . '">';
|
||||
$linktoenabledisable.=img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', 1);
|
||||
$linktoenabledisable.="</a>\n";
|
||||
}
|
||||
if (! empty($conf->$modulelowercase->enabled))
|
||||
if (empty($conf->$modulelowercase->enabled))
|
||||
{
|
||||
$modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive");
|
||||
$modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsNotActive", $urltomodulesetup), '', -1, 'help');
|
||||
}
|
||||
else
|
||||
{
|
||||
$modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup);
|
||||
$modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsLive"), $langs->trans("Warning"), -1, 'warning');
|
||||
}
|
||||
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:'');
|
||||
@ -1719,13 +1775,8 @@ elseif (! empty($module))
|
||||
|
||||
// Link to enable / disable
|
||||
print $modulestatusinfo;
|
||||
print ' '.$linktoenabledisable;
|
||||
print '<br>';
|
||||
print ' '.$linktoenabledisable.'<br>';
|
||||
|
||||
if (realpath($dirread.'/'.$modulelowercase) != $dirread.'/'.$modulelowercase)
|
||||
{
|
||||
print '<span class="opacitymedium">'.$langs->trans("RealPathOfModule").' :</span> <strong>'.realpath($dirread.'/'.$modulelowercase).'</strong><br>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
if ($tab == 'description')
|
||||
@ -1738,21 +1789,28 @@ elseif (! empty($module))
|
||||
{
|
||||
dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc".$tab).'</span><br><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc".$tab).'</span>';
|
||||
$infoonmodulepath = '';
|
||||
if (realpath($dirread.'/'.$modulelowercase) != $dirread.'/'.$modulelowercase)
|
||||
{
|
||||
$infoonmodulepath = '<span class="opacitymedium">'.$langs->trans("RealPathOfModule").' :</span> <strong>'.realpath($dirread.'/'.$modulelowercase).'</strong><br>';
|
||||
print ' '.$infoonmodulepath;
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<table>';
|
||||
|
||||
print '<tr><td>';
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("ReadmeFile").' : <strong>'.$pathtofilereadme.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("ChangeLog").' : <strong>'.$pathtochangelog.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -1913,8 +1971,8 @@ elseif (! empty($module))
|
||||
{
|
||||
$pathtofile = $modulelowercase.'/langs/'.$langfile['relativename'];
|
||||
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : <strong>'.$pathtofile.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=txt&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=txt&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</table>';
|
||||
@ -1965,9 +2023,12 @@ elseif (! empty($module))
|
||||
print '<br>';
|
||||
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<br>';
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' :</span> ';
|
||||
if (! is_array($dicts) || empty($dicts)) print '<span class="opacitymedium">'.$langs->trans("NoDictionaries").'</span>';
|
||||
else print '<strong>'.$dicts['langs'].'</strong>';
|
||||
print '<br>';
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' :</span> <strong>'.$dicts['langs'].'</strong><br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("ListOfDictionariesEntries"), '', '');
|
||||
|
||||
@ -2092,7 +2153,7 @@ elseif (! empty($module))
|
||||
$dir = $dirread.'/'.$modulelowercase.'/class';
|
||||
|
||||
$head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject';
|
||||
$head3[$h][1] = $langs->trans("NewObject");
|
||||
$head3[$h][1] = '<span class="valignmiddle text-plus-circle">'.$langs->trans("NewObjectInModulebuilder").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
|
||||
$head3[$h][2] = 'newobject';
|
||||
$h++;
|
||||
|
||||
@ -2144,7 +2205,9 @@ elseif (! empty($module))
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EnterNameOfObjectDesc").'</span><br><br>';
|
||||
|
||||
print '<input type="text" name="objectname" value="'.dol_escape_htmltag(GETPOST('objectname', 'alpha')?GETPOST('objectname', 'alpha'):$modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">';
|
||||
print '<input type="text" name="objectname" value="'.dol_escape_htmltag(GETPOST('objectname', 'alpha')?GETPOST('objectname', 'alpha'):$modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'"><br>';
|
||||
print '<input type="checkbox" name="includerefgeneration" value="includerefgeneration"> '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).'<br>';
|
||||
print '<input type="checkbox" name="includedocgeneration" value="includedocgeneration"> '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).'<br>';
|
||||
print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Generate")).'"'.($dirins?'':' disabled="disabled"').'>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
@ -2152,7 +2215,6 @@ elseif (! empty($module))
|
||||
print $langs->trans("or");
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
//print '<input type="checkbox" name="initfromtablecheck"> ';
|
||||
print $langs->trans("InitStructureFromExistingTable");
|
||||
print '<input type="text" name="initfromtablename" value="" placeholder="'.$langs->trans("TableName").'">';
|
||||
@ -2415,7 +2477,7 @@ elseif (! empty($module))
|
||||
|
||||
print load_fiche_titre($langs->trans("ObjectProperties"), '', '');
|
||||
|
||||
|
||||
print '<!-- Table with properties of object -->'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -2425,16 +2487,22 @@ elseif (! empty($module))
|
||||
print '<th>';
|
||||
print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey"));
|
||||
print '</th>';
|
||||
print '<th>'.$langs->trans("Type").'</td>';
|
||||
print '<th>'.$form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelp")).'</th>';
|
||||
print '<th>'.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")).'</th>';
|
||||
print '<th class="center">'.$langs->trans("DefaultValue").'</th>';
|
||||
print '<th class="center">'.$langs->trans("DatabaseIndex").'</th>';
|
||||
print '<th class="center">'.$langs->trans("ForeignKey").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Position").'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</th>';
|
||||
print '<th class="center">'.$langs->trans("NotEditable").'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</th>';
|
||||
print '<th class="center">'.$langs->trans("CSSClass").'</th>';
|
||||
print '<th class="center">'.$langs->trans("KeyForTooltip").'</th>';
|
||||
print '<th class="center">'.$langs->trans("ShowOnCombobox").'</th>';
|
||||
//print '<th class="center">'.$langs->trans("Disabled").'</th>';
|
||||
print '<th>'.$langs->trans("Comment").'</th>';
|
||||
print '<th></th>';
|
||||
print '</tr>';
|
||||
@ -2455,11 +2523,17 @@ elseif (! empty($module))
|
||||
print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull', 'alpha')).'"></td>';
|
||||
print '<td><input class="text maxwidth50" name="propdefault" value="'.dol_escape_htmltag(GETPOST('propdefault', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propforeignkey" value="'.dol_escape_htmltag(GETPOST('propforeignkey', 'alpha')).'"></td>';
|
||||
print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propnoteditable" value="'.dol_escape_htmltag(GETPOST('propnoteditable', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propcss" value="'.dol_escape_htmltag(GETPOST('propcss', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="prophelp" value="'.dol_escape_htmltag(GETPOST('prophelp', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propshowoncombobox" value="'.dol_escape_htmltag(GETPOST('propshowoncombobox', 'alpha')).'"></td>';
|
||||
//print '<td class="center"><input class="text" size="2" name="propdisabled" value="'.dol_escape_htmltag(GETPOST('propdisabled', 'alpha')).'"></td>';
|
||||
print '<td><input class="text maxwidth100" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment', 'alpha')).'"></td>';
|
||||
print '<td class="center">';
|
||||
print '<input class="button" type="submit" name="add" value="'.$langs->trans("Add").'">';
|
||||
@ -2486,13 +2560,19 @@ elseif (! empty($module))
|
||||
$proptype=$propval['type'];
|
||||
$proparrayofkeyval=$propval['arrayofkeyval'];
|
||||
$propnotnull=$propval['notnull'];
|
||||
$propsearchall=$propval['searchall'];
|
||||
$propdefault=$propval['default'];
|
||||
$propindex=$propval['index'];
|
||||
$propforeignkey=$propval['foreignkey'];
|
||||
$propposition=$propval['position'];
|
||||
$propenabled=$propval['enabled'];
|
||||
$propvisible=$propval['visible'];
|
||||
$propnoteditable=$propval['noteditable'];
|
||||
$propsearchall=$propval['searchall'];
|
||||
$propisameasure=$propval['isameasure'];
|
||||
$propcss=$propval['css'];
|
||||
$prophelp=$propval['help'];
|
||||
$propshowoncombobox=$propval['showoncombobox'];
|
||||
//$propdisabled=$propval['disabled'];
|
||||
$propcomment=$propval['comment'];
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -2503,7 +2583,7 @@ elseif (! empty($module))
|
||||
print '<td>';
|
||||
print $proplabel;
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="wordbreak">';
|
||||
print $proptype;
|
||||
print '</td>';
|
||||
print '<td class="wordbreak">';
|
||||
@ -2520,6 +2600,9 @@ elseif (! empty($module))
|
||||
print '<td class="center">';
|
||||
print $propindex?'1':'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propforeignkey?$propforeignkey:'';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print $propposition;
|
||||
print '</td>';
|
||||
@ -2530,16 +2613,34 @@ elseif (! empty($module))
|
||||
print $propvisible?$propvisible:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propisameasure?$propisameasure:'';
|
||||
print $propnoteditable?$propnoteditable:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propsearchall?'1':'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propisameasure?$propisameasure:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propcss?$propcss:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $prophelp?$prophelp:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propshowoncombobox?$propshowoncombobox:'';
|
||||
print '</td>';
|
||||
/*print '<td class="center">';
|
||||
print $propdisabled?$propdisabled:'';
|
||||
print '</td>';*/
|
||||
print '<td>';
|
||||
print $propcomment;
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
|
||||
if ($propname != 'rowid')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -2666,7 +2767,7 @@ elseif (! empty($module))
|
||||
print '<br>';
|
||||
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
@ -2806,7 +2907,7 @@ elseif (! empty($module))
|
||||
print '<br>';
|
||||
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
@ -2903,7 +3004,7 @@ elseif (! empty($module))
|
||||
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong class="">'.$pathtofile.'</strong>';
|
||||
print '</td><td>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
@ -2912,8 +3013,8 @@ elseif (! empty($module))
|
||||
if (dol_is_file($dirins.'/'.$pathtohook))
|
||||
{
|
||||
print '<strong>'.$pathtohook.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2970,8 +3071,8 @@ elseif (! empty($module))
|
||||
|
||||
print '<tr><td>';
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("TriggersFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '<td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@ -3026,8 +3127,8 @@ elseif (! empty($module))
|
||||
if (dol_is_file($dirins.'/'.$pathtohook))
|
||||
{
|
||||
print '<strong>'.$pathtohook.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3078,8 +3179,8 @@ elseif (! empty($module))
|
||||
if (dol_is_file($dirins.'/'.$pathtohook))
|
||||
{
|
||||
print '<strong>'.$pathtohook.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3134,9 +3235,8 @@ elseif (! empty($module))
|
||||
$pathtofile = $widget['relpath'];
|
||||
|
||||
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("WidgetFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td>';
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@ -3221,8 +3321,8 @@ elseif (! empty($module))
|
||||
$pathtofile = $clifile['relpath'];
|
||||
|
||||
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("CLIFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '<td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@ -3273,7 +3373,7 @@ elseif (! empty($module))
|
||||
print '<br>';
|
||||
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
@ -3402,8 +3502,8 @@ elseif (! empty($module))
|
||||
if (preg_match('/\.md$/i', $spec['name'])) $format='markdown';
|
||||
print '<tr><td>';
|
||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>';
|
||||
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||
print '<td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ class MyModuleApi extends DolibarrApi
|
||||
throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'MyObject deleted'
|
||||
|
||||
@ -68,21 +68,21 @@ class MyObject extends CommonObject
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'position' is the sort order of field.
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
@ -91,13 +91,13 @@ class MyObject extends CommonObject
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'notnull'=> 1, 'default'=>'(PROV)', 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
||||
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1),
|
||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60),
|
||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
|
||||
@ -656,22 +656,22 @@ class MyObject extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus) || empty($this->labelstatusshort))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$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->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||
$this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelstatusshort[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');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -486,7 +486,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$odfHandler->saveToDisk($file);
|
||||
$odfHandler->saveToDisk($file);
|
||||
} catch (Exception $e) {
|
||||
$this->error=$e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
@ -0,0 +1,58 @@
|
||||
<?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/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("mymodule");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("MyObject"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
|
||||
<td class="right"><?php echo ''; ?></td>
|
||||
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
|
||||
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
print "<!-- END PHP TEMPLATE -->\n";
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* 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 core/tpl/mytemplate.tpl.php
|
||||
* \ingroup mymodule
|
||||
* \brief Example template.
|
||||
*
|
||||
* Put detailed description here.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/** Your code here. */
|
||||
echo "Hello world!";
|
||||
@ -153,6 +153,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permtoread = $user->rights->mymodule->myobject->read;
|
||||
$permtowrite = $user->rights->mymodule->myobject->write;
|
||||
$permtodelete = $user->rights->mymodule->myobject->delete;
|
||||
|
||||
|
||||
/*
|
||||
@ -190,8 +193,6 @@ if (empty($reshook))
|
||||
// Mass actions
|
||||
$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
$permtoread = $user->rights->mymodule->read;
|
||||
$permtodelete = $user->rights->mymodule->delete;
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -346,7 +347,7 @@ $arrayofmassactions = array(
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if ($permtodelete) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
@ -360,7 +361,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->mymodule->write);
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permtowrite);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
||||
|
||||
@ -593,8 +594,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
|
||||
$urlsource.=str_replace('&', '&', $param);
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->mymodule->read;
|
||||
$delallowed=$user->rights->mymodule->write;
|
||||
$genallowed=$permtoread;
|
||||
$delallowed=$permtowrite;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
}
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# CHANGELOG MRP FOR <a href="https://www.dolibarr.org">DOLIBARR ERP CRM</a>
|
||||
|
||||
## 1.0
|
||||
Initial version
|
||||
|
||||
@ -1,151 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson <testldr9@dolicloud.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file mrp/admin/setup.php
|
||||
* \ingroup mrp
|
||||
* \brief Mrp setup page.
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res=0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
||||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
||||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
|
||||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
|
||||
// Try main.inc.php using relative path
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
|
||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||
global $langs, $user;
|
||||
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
|
||||
require_once '../lib/mrp.lib.php';
|
||||
//require_once "../class/myclass.class.php";
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "mrp"));
|
||||
|
||||
// Access control
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$arrayofparameters=array(
|
||||
'MRP_MYPARAM1'=>array('css'=>'minwidth200','enabled'=>1),
|
||||
'MRP_MYPARAM2'=>array('css'=>'minwidth500','enabled'=>1)
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ((float) DOL_VERSION >= 6)
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$page_name = "MrpSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mrp');
|
||||
|
||||
// Configuration header
|
||||
$head = mrpAdminPrepareHead();
|
||||
dol_fiche_head($head, 'settings', '', -1, "mrp");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">'.$langs->trans("MrpSetupPage").'</span><br><br>';
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($arrayofparameters))
|
||||
{
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td>' . $conf->global->$key . '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Page end
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -94,8 +94,10 @@ class Mo extends CommonObject
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
||||
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",),
|
||||
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce",),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1),
|
||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>52),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
||||
@ -105,12 +107,10 @@ class Mo extends CommonObject
|
||||
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
|
||||
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",),
|
||||
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
|
||||
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
|
||||
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",),
|
||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '-1'=>'Canceled')),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '-1'=>'Canceled')),
|
||||
);
|
||||
public $rowid;
|
||||
public $ref;
|
||||
@ -546,21 +546,21 @@ class Mo 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('Validated');
|
||||
$this->labelstatus[self::STATUS_INPROGRESS] = $langs->trans('InProgress');
|
||||
$this->labelstatus[self::STATUS_PRODUCED] = $langs->trans('StatusMOProduced');
|
||||
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated');
|
||||
$this->labelStatus[self::STATUS_INPROGRESS] = $langs->trans('InProgress');
|
||||
$this->labelStatus[self::STATUS_PRODUCED] = $langs->trans('StatusMOProduced');
|
||||
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -35,7 +35,7 @@ function mrpAdminPrepareHead()
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/mrp/admin/setup.php", 1);
|
||||
$head[$h][0] = dol_buildpath("/admin/mrp.php", 1);
|
||||
$head[$h][1] = $langs->trans("Settings");
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
@ -4380,17 +4380,17 @@ class Product extends CommonObject
|
||||
/**
|
||||
* Return label of a given status
|
||||
*
|
||||
* @param int $status Statut
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
|
||||
* @return string Label of status
|
||||
* @param int $status Statut
|
||||
* @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
|
||||
* @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0, $type = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$labelstatut = $labelstatutShort = '';
|
||||
$labelStatus = $labelStatusShort = '';
|
||||
|
||||
$langs->load('products');
|
||||
if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch");
|
||||
@ -4420,43 +4420,42 @@ class Product extends CommonObject
|
||||
|
||||
$statuttrans=empty($status)?'status5':'status4';
|
||||
|
||||
if($status == 0){
|
||||
if ($status == 0) {
|
||||
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
|
||||
if($type==0){
|
||||
$labelstatut = $langs->trans('ProductStatusNotOnSellShort');
|
||||
$labelstatutShort = $langs->trans('ProductStatusNotOnSell');
|
||||
if($type==0) {
|
||||
$labelStatus = $langs->trans('ProductStatusNotOnSellShort');
|
||||
$labelStatusShort = $langs->trans('ProductStatusNotOnSell');
|
||||
}
|
||||
elseif($type == 1){
|
||||
$labelstatut = $langs->trans('ProductStatusNotOnBuyShort');
|
||||
$labelstatutShort = $langs->trans('ProductStatusNotOnBuy');
|
||||
elseif($type == 1) {
|
||||
$labelStatus = $langs->trans('ProductStatusNotOnBuyShort');
|
||||
$labelStatusShort = $langs->trans('ProductStatusNotOnBuy');
|
||||
}
|
||||
elseif($type == 2){
|
||||
$labelstatut = $langs->trans('ProductStatusNotOnBatch');
|
||||
$labelstatutShort = $langs->trans('ProductStatusNotOnBatchShort');
|
||||
elseif($type == 2) {
|
||||
$labelStatus = $langs->trans('ProductStatusNotOnBatch');
|
||||
$labelStatusShort = $langs->trans('ProductStatusNotOnBatchShort');
|
||||
}
|
||||
}
|
||||
elseif($status == 1){
|
||||
elseif ($status == 1) {
|
||||
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
|
||||
if($type==0){
|
||||
$labelstatut = $langs->trans('ProductStatusOnSellShort');
|
||||
$labelstatutShort = $langs->trans('ProductStatusOnSell');
|
||||
if ($type==0) {
|
||||
$labelStatus = $langs->trans('ProductStatusOnSellShort');
|
||||
$labelStatusShort = $langs->trans('ProductStatusOnSell');
|
||||
}
|
||||
elseif($type == 1){
|
||||
$labelstatut = $langs->trans('ProductStatusOnBuyShort');
|
||||
$labelstatutShort = $langs->trans('ProductStatusOnBuy');
|
||||
elseif ($type == 1) {
|
||||
$labelStatus = $langs->trans('ProductStatusOnBuyShort');
|
||||
$labelStatusShort = $langs->trans('ProductStatusOnBuy');
|
||||
}
|
||||
elseif($type == 2){
|
||||
$labelstatut = $langs->trans('ProductStatusOnBatch');
|
||||
$labelstatutShort = $langs->trans('ProductStatusOnBatchShort');
|
||||
elseif ($type == 2) {
|
||||
$labelStatus = $langs->trans('ProductStatusOnBatch');
|
||||
$labelStatusShort = $langs->trans('ProductStatusOnBatchShort');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($mode>6){
|
||||
if ($mode > 6) {
|
||||
return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0);
|
||||
}
|
||||
else{
|
||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
|
||||
} else {
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statuttrans, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -266,7 +266,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Last modified products
|
||||
* Latest modified products
|
||||
*/
|
||||
$max=15;
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
|
||||
@ -299,11 +299,11 @@ if ($result)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$colnb=4;
|
||||
$colnb=2;
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++;
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="'.$colnb.'">'.$transRecordedType.'</th>';
|
||||
print '<th class="right"><a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC">'.$langs->trans("FullList").'</td>';
|
||||
print '<th class="right" colspan="3"><a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC">'.$langs->trans("FullList").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
while ($i < $num)
|
||||
@ -359,10 +359,10 @@ if ($result)
|
||||
else print price($objp->price).' '.$langs->trans("HT");
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right nowrap"><span class="statusrefsell">';
|
||||
print '<td class="right nowrap width25"><span class="statusrefsell">';
|
||||
print $product_static->LibStatut($objp->tosell, 3, 0);
|
||||
print "</span></td>";
|
||||
print '<td class="right nowrap"><span class="statusrefbuy">';
|
||||
print '<td class="right nowrap width25"><span class="statusrefbuy">';
|
||||
print $product_static->LibStatut($objp->tobuy, 3, 1);
|
||||
print "</span></td>";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -396,16 +396,16 @@ class Inventory extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
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('Canceled');
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', 'status'.$status, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', 'status'.$status, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -55,20 +55,20 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
$listofstatus=array_keys($listofoppstatus);
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$labelstatus = '';
|
||||
$labelStatus = '';
|
||||
|
||||
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
|
||||
if ($code) $labelstatus = $langs->trans("OppStatus".$code);
|
||||
if (empty($labelstatus)) $labelstatus=$listofopplabel[$status];
|
||||
if ($code) $labelStatus = $langs->trans("OppStatus".$code);
|
||||
if (empty($labelStatus)) $labelStatus=$listofopplabel[$status];
|
||||
|
||||
//$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
|
||||
//$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%';
|
||||
//$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
|
||||
//$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%';
|
||||
|
||||
$dataseries[]=array($labelstatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0));
|
||||
$dataseries[]=array($labelStatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$labelstatus.'</td>';
|
||||
print '<td>'.$labelStatus.'</td>';
|
||||
print '<td class="right"><a href="list.php?statut='.$status.'">'.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -1725,6 +1725,7 @@ if ($action != 'dopayment')
|
||||
{
|
||||
// If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of stripe
|
||||
print '<br><div class="button buttonpayment" id="div_dopayment_stripe"><span class="fa fa-credit-card"></span> <input class="" type="submit" id="dopayment_stripe" name="dopayment_stripe" value="'.$langs->trans("StripeDoPayment").'">';
|
||||
print '<input type="hidden" name="noidempotency" value="'.GETPOST('noidempotency', 'int').'">';
|
||||
print '<br>';
|
||||
print '<span class="buttonpaymentsmall">'.$langs->trans("CreditOrDebitCard").'</span>';
|
||||
print '</div>';
|
||||
@ -1858,12 +1859,12 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment
|
||||
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 1;
|
||||
|
||||
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))
|
||||
{
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
}
|
||||
|
||||
$stripe = new Stripe($db);
|
||||
$stripeacc = $stripe->getStripeAccount($service);
|
||||
$stripecu = null;
|
||||
@ -1871,7 +1872,10 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment
|
||||
|
||||
if (! empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION))
|
||||
{
|
||||
$paymentintent=$stripe->getPaymentIntent($amount, $currency, $tag, 'Stripe payment: '.$fulltag.(is_object($object)?' ref='.$object->ref:''), $object, $stripecu, $stripeacc, $servicestatus);
|
||||
$noidempotency_key = (GETPOSTISSET('noidempotency') ? GETPOST('noidempotency', 'int') : 0); // By default noidempotency is unset, so we must use a different tag/ref for each payment. If set, we can pay several times the same tag/ref.
|
||||
$paymentintent=$stripe->getPaymentIntent($amount, $currency, $tag, 'Stripe payment: '.$fulltag.(is_object($object)?' ref='.$object->ref:''), $object, $stripecu, $stripeacc, $servicestatus, 0, 'automatic', false, null, 0, $noidempotency_key);
|
||||
// The paymentintnent has status 'requires_payment_method' (even if paymentintent was already payed)
|
||||
//var_dump($paymentintent);
|
||||
if ($stripe->error) setEventMessages($stripe->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ if (empty($conf) || ! is_object($conf))
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$contact = $GLOBALS['objcanvas']->control->object;
|
||||
|
||||
?>
|
||||
@ -78,7 +77,7 @@ $contact = $GLOBALS['objcanvas']->control->object;
|
||||
<?php if ($this->control->tpl['ismodifiable_customercode']) { ?>
|
||||
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15">
|
||||
<?php } else { ?>
|
||||
<?php echo $this->control->tpl['customercode']; ?>
|
||||
<?php echo $this->control->tpl['customercode']; ?>
|
||||
<input type="hidden" name="code_client" value="<?php echo $this->control->tpl['customercode']; ?>">
|
||||
<?php } ?>
|
||||
</td>
|
||||
@ -99,7 +98,7 @@ $contact = $GLOBALS['objcanvas']->control->object;
|
||||
<?php if ($this->control->tpl['ismodifiable_suppliercode']) { ?>
|
||||
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15">
|
||||
<?php } else { ?>
|
||||
<?php echo $this->control->tpl['suppliercode']; ?>
|
||||
<?php echo $this->control->tpl['suppliercode']; ?>
|
||||
<input type="hidden" name="code_fournisseur" value="<?php echo $this->control->tpl['suppliercode']; ?>">
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
@ -75,7 +75,7 @@ if (empty($conf) || ! is_object($conf))
|
||||
<?php if ($this->control->tpl['ismodifiable_customercode']) { ?>
|
||||
<input type="text" name="code_client" size="16" value="<?php echo $this->control->tpl['customercode']; ?>" maxlength="15">
|
||||
<?php } else { ?>
|
||||
<?php echo $this->control->tpl['customercode']; ?>
|
||||
<?php echo $this->control->tpl['customercode']; ?>
|
||||
<input type="hidden" name="code_client" value="<?php echo $this->control->tpl['customercode']; ?>">
|
||||
<?php } ?>
|
||||
</td>
|
||||
@ -96,7 +96,7 @@ if (empty($conf) || ! is_object($conf))
|
||||
<?php if ($this->control->tpl['ismodifiable_suppliercode']) { ?>
|
||||
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->control->tpl['suppliercode']; ?>" maxlength="15">
|
||||
<?php } else { ?>
|
||||
<?php echo $this->control->tpl['suppliercode']; ?>
|
||||
<?php echo $this->control->tpl['suppliercode']; ?>
|
||||
<input type="hidden" name="code_fournisseur" value="<?php echo $this->control->tpl['suppliercode']; ?>">
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
@ -2258,8 +2258,8 @@ class Societe extends CommonObject
|
||||
/**
|
||||
* Return label of status (activity, closed)
|
||||
*
|
||||
* @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 Libelle
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
@ -2283,15 +2283,15 @@ class Societe extends CommonObject
|
||||
$statusType = 'status4';
|
||||
if ($status == 0) $statusType = 'status5';
|
||||
|
||||
if (empty($this->labelstatus) || empty($this->labelstatusshort))
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
$this->labelstatus[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelstatus[1] = $langs->trans("InActivity");
|
||||
$this->labelstatusshort[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelstatusshort[1] = $langs->trans("InActivity");
|
||||
$this->labelStatus[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatus[1] = $langs->trans("InActivity");
|
||||
$this->labelStatusShort[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatusShort[1] = $langs->trans("InActivity");
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@ -232,7 +232,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Last third parties modified
|
||||
* Latest modified third parties
|
||||
*/
|
||||
$max=15;
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
|
||||
|
||||
@ -318,9 +318,10 @@ class Stripe extends CommonObject
|
||||
* @param boolean $confirmnow false=default, true=try to confirm immediatly after create (if conditions are ok)
|
||||
* @param string $payment_method 'pm_....' (if known)
|
||||
* @param string $off_session If we use an already known payment method to pay off line.
|
||||
* @param string $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent
|
||||
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found and failed to create
|
||||
*/
|
||||
public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0)
|
||||
public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -352,9 +353,10 @@ class Stripe extends CommonObject
|
||||
if (is_object($object))
|
||||
{
|
||||
// Warning. If a payment was tried and failed, a payment intent was created.
|
||||
// But if we change someting on object to pay (amount or other), reusing same payment intent is not allowed.
|
||||
// Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay),
|
||||
// that's why i comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old that will not be used)
|
||||
// But if we change someting on object to pay (amount or other that does not change the idempotency key), reusing same payment intent is not allowed.
|
||||
// Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay), Stripe will
|
||||
// automatically return the existing payment intent if idempotency is provided when we try to create the new one.
|
||||
// That's why we can comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used)
|
||||
/*
|
||||
$sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi";
|
||||
@ -445,14 +447,15 @@ class Stripe extends CommonObject
|
||||
global $stripearrayofkeysbyenv;
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);
|
||||
|
||||
// Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent.
|
||||
if (empty($key)) { // If the Stripe connect account not set, we use common API usage
|
||||
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description"));
|
||||
//$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array());
|
||||
} else {
|
||||
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description", "stripe_account" => $key));
|
||||
//$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("stripe_account" => $key));
|
||||
$arrayofoptions = array();
|
||||
if (empty($noidempotency_key)) {
|
||||
$arrayofoptions["idempotency_key"] = $description;
|
||||
}
|
||||
// Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent.
|
||||
if (! empty($key)) { // If the Stripe connect account not set, we use common API usage
|
||||
$arrayofoptions["stripe_account"] = $key;
|
||||
}
|
||||
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions);
|
||||
|
||||
// Store the payment intent
|
||||
if (is_object($object))
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/lib/Stripe.php';
|
||||
|
||||
global $stripe;
|
||||
//global $stripe;
|
||||
global $conf;
|
||||
global $stripearrayofkeysbyenv;
|
||||
|
||||
@ -55,4 +55,4 @@ else
|
||||
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
|
||||
\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
|
||||
\Stripe\Stripe::setApiVersion("2019-05-16"); // force version API
|
||||
\Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION)?"2019-05-16":$conf->global->STRIPE_FORCE_VERSION); // force version API
|
||||
|
||||
@ -158,8 +158,8 @@ class SupplierProposal extends CommonObject
|
||||
public $lines = array();
|
||||
public $line;
|
||||
|
||||
public $labelstatut=array();
|
||||
public $labelstatut_short=array();
|
||||
public $labelStatus=array();
|
||||
public $labelStatusShort=array();
|
||||
|
||||
public $nbtodo;
|
||||
public $nbtodolate;
|
||||
@ -2196,20 +2196,20 @@ class SupplierProposal extends CommonObject
|
||||
// phpcs:enable
|
||||
|
||||
// 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("supplier_proposal");
|
||||
$this->labelstatut[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraft");
|
||||
$this->labelstatut[self::STATUS_VALIDATED]=$langs->trans("SupplierProposalStatusValidated");
|
||||
$this->labelstatut[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSigned");
|
||||
$this->labelstatut[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSigned");
|
||||
$this->labelstatut[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosed");
|
||||
$this->labelstatut_short[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraftShort");
|
||||
$this->labelstatut_short[self::STATUS_VALIDATED]=$langs->trans("Opened");
|
||||
$this->labelstatut_short[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSignedShort");
|
||||
$this->labelstatut_short[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSignedShort");
|
||||
$this->labelstatut_short[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosedShort");
|
||||
$this->labelStatus[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraft");
|
||||
$this->labelStatus[self::STATUS_VALIDATED]=$langs->trans("SupplierProposalStatusValidated");
|
||||
$this->labelStatus[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSigned");
|
||||
$this->labelStatus[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSigned");
|
||||
$this->labelStatus[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosed");
|
||||
$this->labelStatusShort[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraftShort");
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED]=$langs->trans("Opened");
|
||||
$this->labelStatusShort[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSignedShort");
|
||||
$this->labelStatusShort[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSignedShort");
|
||||
$this->labelStatusShort[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosedShort");
|
||||
}
|
||||
|
||||
$statusnew='';
|
||||
@ -2219,7 +2219,7 @@ class SupplierProposal extends CommonObject
|
||||
elseif ($status==self::STATUS_NOTSIGNED) $statusnew='status5';
|
||||
elseif ($status==self::STATUS_CLOSE) $statusnew='status6';
|
||||
|
||||
return dolGetStatus($this->labelstatut[$status], $this->labelstatut_short[$status], '', $statusnew, $mode);
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusnew, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# CHANGELOG TAKEPOS FOR <a href="https://www.dolibarr.org">DOLIBARR ERP CRM</a>
|
||||
|
||||
## 1.0
|
||||
Initial version
|
||||
|
||||
@ -562,23 +562,23 @@ function MoreActions(totalactions){
|
||||
}
|
||||
}
|
||||
|
||||
// Popup to select the terminal to use
|
||||
function TerminalsDialog()
|
||||
{
|
||||
jQuery("#dialog-info").dialog({
|
||||
resizable: false,
|
||||
height:220,
|
||||
width:400,
|
||||
height: <?php echo 180+round($conf->global->TAKEPOS_NUM_TERMINALS / 3 * 20); ?>,
|
||||
width: <?php echo ($conf->dol_optimize_smallscreen ? 316 : 400); ?>,
|
||||
modal: true,
|
||||
buttons: {
|
||||
Terminal1: function() {
|
||||
'<?php echo dol_escape_js($langs->trans("Terminal")) ?> 1': function() {
|
||||
location.href='takepos.php?setterminal=1';
|
||||
}
|
||||
<?php
|
||||
for ($i = 2; $i <= $conf->global->TAKEPOS_NUM_TERMINALS; $i++)
|
||||
{
|
||||
print "
|
||||
,
|
||||
Terminal".$i.": function() {
|
||||
print ",
|
||||
'".dol_escape_js($langs->trans("Terminal"))." ".$i."': function() {
|
||||
location.href='takepos.php?setterminal=".$i."';
|
||||
}
|
||||
";
|
||||
|
||||
@ -37,7 +37,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
padding: 0.45em;
|
||||
vertical-align: middle;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
a.badge:focus, a.badge:hover {
|
||||
|
||||
@ -473,6 +473,12 @@ textarea.centpercent {
|
||||
.paddingright2 {
|
||||
padding-<?php print $right; ?>: 2px;
|
||||
}
|
||||
.marginleft2 {
|
||||
margin-<?php print $left; ?>: 2px;
|
||||
}
|
||||
.marginright2 {
|
||||
margin-<?php print $right; ?>: 2px;
|
||||
}
|
||||
.cursordefault {
|
||||
cursor: default;
|
||||
}
|
||||
@ -488,6 +494,9 @@ textarea.centpercent {
|
||||
.backgroundblank {
|
||||
background-color: #fff;
|
||||
}
|
||||
.nobackground, .nobackground tr {
|
||||
background: unset !important;
|
||||
}
|
||||
.checkboxattachfilelabel {
|
||||
font-size: 0.85em;
|
||||
opacity: 0.7;
|
||||
@ -517,6 +526,9 @@ body[class*="colorblind-"] .text-success{
|
||||
color: rgb(<?php echo $colortexttitle; ?>) !important;
|
||||
}
|
||||
|
||||
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
|
||||
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off,
|
||||
.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
|
||||
|
||||
/* Themes for badges */
|
||||
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>
|
||||
@ -2756,6 +2768,7 @@ table.listwithfilterbefore {
|
||||
.tagtable, .table-border { display: table; }
|
||||
.tagtr, .table-border-row { display: table-row; }
|
||||
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
|
||||
.confirmquestions .tagtr .tagtd:not(:first-child) { padding-left: 10px; }
|
||||
|
||||
|
||||
/* Pagination */
|
||||
|
||||
@ -21,10 +21,10 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
height: 20px;
|
||||
overflow: hidden;
|
||||
background-color: #f5f5f5;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
background-color: rgba(128, 128, 128, 0.1);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.progress.spaced{
|
||||
@ -167,7 +167,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
}
|
||||
.progress-bar-yellow,
|
||||
.progress-bar-warning {
|
||||
background-color: #f39c12;
|
||||
background-color: #bc9526;
|
||||
}
|
||||
.progress-striped .progress-bar-yellow,
|
||||
.progress-striped .progress-bar-warning {
|
||||
@ -184,4 +184,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
.progress-bar-consumed {
|
||||
background-color: rgb(0, 0, 0, 0.15);
|
||||
}
|
||||
@ -81,7 +81,7 @@ $toolTipFontColor='#333';
|
||||
$textSuccess ='#28a745';
|
||||
$colorblind_deuteranopes_textSuccess ='#37de5d';
|
||||
$textDanger ='#dc3545';
|
||||
$textWarning ='#f39c12';
|
||||
$textWarning ='#bc9526';
|
||||
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
|
||||
|
||||
|
||||
|
||||
@ -36,8 +36,8 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
.badge-dot {
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
padding: 0.25rem;
|
||||
vertical-align: middle;
|
||||
padding: 0.35em;
|
||||
vertical-align: unset;
|
||||
}
|
||||
|
||||
a.badge:focus, a.badge:hover {
|
||||
|
||||
@ -676,6 +676,12 @@ textarea.centpercent {
|
||||
.paddingright2 {
|
||||
padding-<?php print $right; ?>: 2px;
|
||||
}
|
||||
.marginleft2 {
|
||||
margin-<?php print $left; ?>: 2px;
|
||||
}
|
||||
.marginright2 {
|
||||
margin-<?php print $right; ?>: 2px;
|
||||
}
|
||||
.cursordefault {
|
||||
cursor: default;
|
||||
}
|
||||
@ -691,6 +697,9 @@ textarea.centpercent {
|
||||
.backgroundblank {
|
||||
background-color: #fff;
|
||||
}
|
||||
.nobackground, .nobackground tr {
|
||||
background: unset !important;
|
||||
}
|
||||
.checkboxattachfilelabel {
|
||||
font-size: 0.85em;
|
||||
opacity: 0.7;
|
||||
@ -720,6 +729,9 @@ body[class*="colorblind-"] .text-success{
|
||||
color: rgb(<?php echo $colortexttitle; ?>) !important;
|
||||
}
|
||||
|
||||
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
|
||||
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
|
||||
|
||||
|
||||
/* Themes for badges */
|
||||
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>
|
||||
@ -2840,6 +2852,8 @@ table.listwithfilterbefore {
|
||||
.tagtable, .table-border { display: table; }
|
||||
.tagtr, .table-border-row { display: table-row; }
|
||||
.tagtd, .table-border-col, .table-key-border-col, .table-val-border-col { display: table-cell; }
|
||||
.confirmquestions .tagtr .tagtd:not(:first-child) { padding-left: 10px; }
|
||||
|
||||
|
||||
/* Pagination */
|
||||
div.refidpadding {
|
||||
|
||||
@ -435,7 +435,7 @@ class Tickets extends DolibarrApi
|
||||
throw new RestException(500);
|
||||
}
|
||||
|
||||
return array(
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Ticket deleted'
|
||||
|
||||
@ -31,7 +31,7 @@ if (! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
session_cache_limiter(false);
|
||||
session_cache_limiter('public');
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
@ -201,6 +201,12 @@ class User extends CommonObject
|
||||
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
);
|
||||
|
||||
|
||||
const STATUS_DISABLED = 0;
|
||||
const STATUS_ENABLED = 1;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
@ -2478,48 +2484,31 @@ class User extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
* Return label of a status of user (active, inactive)
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load('users');
|
||||
|
||||
if ($mode == 0)
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
|
||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
|
||||
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
||||
elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled');
|
||||
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_DISABLED] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
$statusType = 'status5';
|
||||
if ($status == self::STATUS_ENABLED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -677,7 +677,7 @@ while ($i < min($num, $limit))
|
||||
if (! empty($arrayfields['u.statut']['checked']))
|
||||
{
|
||||
$userstatic->statut=$obj->statut;
|
||||
print '<td class="center">'.$userstatic->getLibStatut(3).'</td>';
|
||||
print '<td class="center">'.$userstatic->getLibStatut(5).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
|
||||
@ -92,6 +92,17 @@ class Website extends CommonObject
|
||||
*/
|
||||
public $virtualhost;
|
||||
|
||||
/**
|
||||
* List of containers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -229,10 +240,10 @@ class Website extends CommonObject
|
||||
$sql .= " t.tms as date_modification";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
|
||||
if (null !== $ref) {
|
||||
if (! empty($ref)) {
|
||||
$sql .= " AND t.ref = '" . $this->db->escape($ref) . "'";
|
||||
} else {
|
||||
$sql .= ' AND t.rowid = ' . $id;
|
||||
$sql .= ' AND t.rowid = ' . (int) $id;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -691,8 +702,8 @@ class Website extends CommonObject
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("WebSite") . '</u>';
|
||||
$label.= '<div width="100%">';
|
||||
$label.= '<b>' . $langs->trans('Nom') . ':</b> ' . $this->ref;
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
|
||||
$linkstart.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
||||
@ -734,31 +745,20 @@ class Website extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
elseif ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
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 ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
|
||||
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
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 ($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');
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
}
|
||||
|
||||
$statusType = 'status5';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class WebsitePage extends CommonObject
|
||||
/**
|
||||
* @var string String with name of icon for websitepage. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'label';
|
||||
public $picto = 'file-code';
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@ -88,6 +88,11 @@ class WebsitePage extends CommonObject
|
||||
public $date_modification;
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
|
||||
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
@ -480,25 +485,39 @@ class WebsitePage extends CommonObject
|
||||
global $menumanager;
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("Page") . '</u>';
|
||||
$label.= '<div width="100%">';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref.'<br>';
|
||||
$label.= '<b>' . $langs->trans('ID') . ':</b> ' . $this->id.'<br>';
|
||||
$label.= '<b>' . $langs->trans('Title') . ':</b> ' . $this->title;
|
||||
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
|
||||
$linkstart.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
||||
$linkstart.= '>';
|
||||
$url = DOL_URL_ROOT.'/website/index.php?websiteid='.$this->fk_website.'&pageid='.$this->id;
|
||||
|
||||
$linkclose='';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowMyObject");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
$linkstart = $linkend = '';
|
||||
//$linkstart = $linkend = '';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_picto(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
if ($withpicto)
|
||||
{
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
}
|
||||
$result.= $linkstart . $this->ref . $linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -526,36 +545,20 @@ class WebsitePage extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
elseif ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
elseif ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
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 ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
|
||||
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
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 ($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');
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
}
|
||||
|
||||
$statusType = 'status5';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ if (! $user->rights->website->read) accessforbidden();
|
||||
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
|
||||
|
||||
$error=0;
|
||||
$websiteid=GETPOST('websiteid', 'int');
|
||||
$websitekey=GETPOST('website', 'alpha');
|
||||
$page=GETPOST('page', 'alpha');
|
||||
$pageid=GETPOST('pageid', 'int');
|
||||
@ -101,7 +102,7 @@ $objectpage=new WebsitePage($db);
|
||||
$object->fetchAll(); // Init $object->records with list of websites
|
||||
|
||||
// If website not defined, we take first found
|
||||
if (empty($websitekey))
|
||||
if (! ($websiteid > 0) && empty($websitekey))
|
||||
{
|
||||
foreach($object->records as $key => $valwebsite)
|
||||
{
|
||||
@ -109,10 +110,12 @@ if (empty($websitekey))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($websitekey)
|
||||
if ($websiteid > 0 || $websitekey)
|
||||
{
|
||||
$res = $object->fetch(0, $websitekey);
|
||||
$res = $object->fetch($websiteid, $websitekey);
|
||||
$websitekey = $object->ref;
|
||||
}
|
||||
|
||||
$website = $object;
|
||||
|
||||
// Check pageid received as aprameter
|
||||
@ -418,7 +421,7 @@ if ($action == 'addcontainer')
|
||||
$db->begin();
|
||||
|
||||
$objectpage->fk_website = $object->id;
|
||||
if (GETPOST('fetchexternalurl', 'alpha'))
|
||||
if (GETPOSTISSET('fetchexternalurl'))
|
||||
{
|
||||
$urltograb=GETPOST('externalurl', 'alpha');
|
||||
$grabimages=GETPOST('grabimages', 'alpha');
|
||||
@ -426,12 +429,18 @@ if ($action == 'addcontainer')
|
||||
//var_dump($grabimages);exit;
|
||||
}
|
||||
|
||||
if ($urltograb)
|
||||
if (GETPOSTISSET('fetchexternalurl'))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
|
||||
//if (! preg_match('/^http/', $urltograb) && ! preg_match('/^file/', $urltograb))
|
||||
if (! preg_match('/^http/', $urltograb))
|
||||
if (empty($urltograb))
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
|
||||
$action = 'createcontainer';
|
||||
}
|
||||
elseif (! preg_match('/^http/', $urltograb))
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
@ -1372,6 +1381,8 @@ if ($action == 'updatemeta')
|
||||
$objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha');
|
||||
$objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09');
|
||||
$objectpage->htmlheader = trim(GETPOST('htmlheader', 'none'));
|
||||
$objectpage->fk_page = GETPOST('pageidfortranslation', 'int');
|
||||
|
||||
$newdatecreation=dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int'));
|
||||
if ($newdatecreation) $objectpage->date_creation = $newdatecreation;
|
||||
|
||||
@ -2006,6 +2017,7 @@ if (! GETPOST('hide_websitemenu'))
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
|
||||
$object->lines = $array;
|
||||
}
|
||||
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
|
||||
$atleastonepage=(is_array($array) && count($array) > 0);
|
||||
@ -2019,13 +2031,13 @@ if (! GETPOST('hide_websitemenu'))
|
||||
|
||||
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
|
||||
|
||||
if (! $atleastonepage)
|
||||
if ($atleastonepage)
|
||||
{
|
||||
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
|
||||
print '<input type="submit" class="button bordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="submit" class="button bordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
|
||||
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
|
||||
}
|
||||
|
||||
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
|
||||
@ -2137,55 +2149,11 @@ if (! GETPOST('hide_websitemenu'))
|
||||
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'" name="createcontainer">';
|
||||
print '</span>';
|
||||
|
||||
print '<span class="websiteselection">';
|
||||
//print '<span class="websiteselection">';
|
||||
|
||||
if ($action != 'addcontainer')
|
||||
{
|
||||
$out='';
|
||||
if ($atleastonepage && $action != 'editsource')
|
||||
{
|
||||
$out.='<select name="pageid" id="pageid" class="minwidth200 maxwidth300">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<select name="pageidbis" id="pageid" class="minwidth200 maxwidth300" disabled="disabled">';
|
||||
}
|
||||
if ($atleastonepage)
|
||||
{
|
||||
if (empty($pageid) && $action != 'createcontainer') // Page id is not defined, we try to take one
|
||||
{
|
||||
$firstpageid=0;$homepageid=0;
|
||||
foreach($array as $key => $valpage)
|
||||
{
|
||||
if (empty($firstpageid)) $firstpageid=$valpage->id;
|
||||
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
|
||||
}
|
||||
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
|
||||
}
|
||||
|
||||
foreach($array as $key => $valpage)
|
||||
{
|
||||
$out.='<option value="'.$key.'"';
|
||||
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
|
||||
$out.='>';
|
||||
$out.='['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] ';
|
||||
$out.=$valpage->pageurl.' - '.$valpage->title;
|
||||
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
|
||||
$out.='</option>';
|
||||
}
|
||||
}
|
||||
else $out.='<option value="-1"> </option>';
|
||||
$out.='</select>';
|
||||
if ($atleastonepage && $action != 'editsource')
|
||||
{
|
||||
$out.=ajax_combobox('pageid');
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.='<input type="hidden" name="pageid" value="'.$pageid.'">';
|
||||
$out.=ajax_combobox('pageid');
|
||||
}
|
||||
print $out;
|
||||
print $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2298,7 +2266,7 @@ if (! GETPOST('hide_websitemenu'))
|
||||
|
||||
print '<!-- button EditInLine and ShowSubcontainers -->'."\n";
|
||||
print '<div class="websiteselectionsection inline-block">';
|
||||
print '<div class="inline-block">';
|
||||
print '<div class="inline-block marginrightonly">';
|
||||
|
||||
print '<span id="switchckeditorinline">'."\n";
|
||||
print '<!-- Code to enabled edit inline ckeditor -->'."\n";
|
||||
@ -2351,23 +2319,23 @@ if (! GETPOST('hide_websitemenu'))
|
||||
if ($websitepage->grabbed_from)
|
||||
{
|
||||
//print '<input type="submit" class="button bordertransp" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'" value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
|
||||
print '<a class="button nobordertransp opacitymedium nohoverborder"'.$disabled.' href="#" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'">'.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
print '<a class="nobordertransp opacitymedium nohoverborder marginleftonlyshort"'.$disabled.' href="#" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'">'.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
|
||||
if (empty($conf->global->WEBSITE_EDITINLINE))
|
||||
{
|
||||
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=seteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=seteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unseteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unseteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<div class="inline-block">';
|
||||
print '<div class="inline-block marginrightonly">';
|
||||
print $langs->trans("ShowSubcontainers");
|
||||
/*if ($websitepage->grabbed_from)
|
||||
{
|
||||
@ -2377,11 +2345,11 @@ if (! GETPOST('hide_websitemenu'))
|
||||
{*/
|
||||
if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
|
||||
{
|
||||
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
|
||||
}
|
||||
/*}*/
|
||||
print '</div>';
|
||||
@ -2405,7 +2373,7 @@ if (! GETPOST('hide_websitemenu'))
|
||||
}
|
||||
}
|
||||
|
||||
print '</span>'; // end website selection
|
||||
//print '</span>'; // end website selection
|
||||
|
||||
print '<span class="websitetools">';
|
||||
|
||||
@ -2888,12 +2856,24 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
print '<!-- Edit or create page/container -->'."\n";
|
||||
//print '<div class="fichecenter">';
|
||||
|
||||
$hiddenfromfetchingafterload = ' hideobject';
|
||||
$hiddenmanuallyafterload = ' hideobject';
|
||||
if (GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching') $hiddenfromfetchingafterload = '';
|
||||
if (GETPOST('radiocreatefrom') == 'checkboxcreatemanually') $hiddenmanuallyafterload = '';
|
||||
|
||||
if ($action == 'editmeta' || empty($conf->use_javascript_ajax)) { // No autohide/show in such case
|
||||
$hiddenfromfetchingafterload='';
|
||||
$hiddenmanuallyafterload='';
|
||||
}
|
||||
|
||||
if ($action == 'createcontainer')
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print ' * '.$langs->trans("CreateByFetchingExternalPage").'<br><hr>';
|
||||
print '<table class="border" width="100%">';
|
||||
if (! empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
|
||||
print '<label for="checkboxcreatefromfetching"><span class="opacitymedium">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
|
||||
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("URL");
|
||||
print '</td><td>';
|
||||
@ -2911,10 +2891,12 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
|
||||
print '<br>';
|
||||
|
||||
print ' * '.$langs->trans("OrEnterPageInfoManually").'<br><hr>';
|
||||
if (! empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatemanually" value="checkboxcreatemanually"'.(GETPOST('radiocreatefrom') == 'checkboxcreatemanually' ? ' checked' : '').'> ';
|
||||
print '<label for="checkboxcreatemanually"><span class="opacitymedium">'.$langs->trans("OrEnterPageInfoManually").'</span></label><br>';
|
||||
print '<hr class="tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border tableforfield nobackground centpercent tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
|
||||
|
||||
if ($action != 'createcontainer')
|
||||
{
|
||||
@ -2928,16 +2910,9 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
print $langs->trans('InternalURLOfPage');
|
||||
print '</td><td>';
|
||||
print '/public/website/index.php?website='.urlencode($websitekey).'&pageid='.urlencode($pageid);
|
||||
//if ($objectpage->grabbed_from) print ' - <span class="opacitymedium">'.$langs->trans('InitiallyGrabbedFrom').' '.$objectpage->grabbed_from.'</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
/*
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('InitiallyGrabbedFrom');
|
||||
print '</td><td>';
|
||||
print $objectpage->grabbed_from;
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
$type_container=$objectpage->type_container;
|
||||
$pageurl=$objectpage->pageurl;
|
||||
$pagealiasalt=$objectpage->aliasalt;
|
||||
@ -2972,7 +2947,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
print '<tr><td class="fieldrequired">';
|
||||
print $langs->trans('WEBSITE_TITLE');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_TITLE" id="WEBSITE_TITLE" value="'.dol_escape_htmltag($pagetitle).'">';
|
||||
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_TITLE" id="WEBSITE_TITLE" value="'.dol_escape_htmltag($pagetitle).'" autofocus>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Alias
|
||||
@ -3023,26 +2998,14 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
print $formadmin->select_language($pagelang?$pagelang:$langs->defaultlang, 'WEBSITE_LANG', 0, null, '1');
|
||||
print '</td></tr>';
|
||||
|
||||
// Translation of
|
||||
$translationof=0;
|
||||
$translatedby=0;
|
||||
print '<!-- Translation of --><tr><td>';
|
||||
print $langs->trans('TranslationLinks');
|
||||
print '</td><td>';
|
||||
if ($action != 'createcontainer')
|
||||
{
|
||||
// Translation of
|
||||
if ($objectpage->fk_page > 0)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('ThisPageIsTranslationOf');
|
||||
print '</td><td>';
|
||||
$sourcepage=new WebsitePage($db);
|
||||
$result = $sourcepage->fetch($objectpage->fk_page);
|
||||
if ($result == 0) // not found, we can reset value
|
||||
{
|
||||
}
|
||||
elseif ($result > 0)
|
||||
{
|
||||
print $sourcepage->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Has translation pages
|
||||
$sql='SELECT rowid, lang from '.MAIN_DB_PREFIX.'website_page where fk_page = '.$objectpage->id;
|
||||
$resql = $db->query($sql);
|
||||
@ -3051,23 +3014,37 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
$num_rows = $db->num_rows($resql);
|
||||
if ($num_rows > 0)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('ThisPageHasTranslationPages');
|
||||
print '</td><td>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('ThisPageHasTranslationPages').':</span><br>';
|
||||
$i=0;
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$tmppage=new WebsitePage($db);
|
||||
$tmppage->fetch($obj->rowid);
|
||||
if ($i > 0) print ' - ';
|
||||
print $tmppage->getNomUrl(1).' ('.$tmppage->lang.')';
|
||||
print $tmppage->getNomUrl(1).' ('.$tmppage->lang.')<br>';
|
||||
$translatedby++;
|
||||
$i++;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
if (empty($translatedby) && ($action == 'editmeta' || $action == 'createcontainer' || $objectpage->fk_page > 0))
|
||||
{
|
||||
$sourcepage=new WebsitePage($db);
|
||||
$result = $sourcepage->fetch($objectpage->fk_page);
|
||||
if ($result == 0)
|
||||
{
|
||||
// not found, we can reset value to clean database
|
||||
}
|
||||
elseif ($result > 0)
|
||||
{
|
||||
$translationof = $sourcepage->id;
|
||||
print '<span class="opacitymedium">'.$langs->trans('ThisPageIsTranslationOf').'</span> ';
|
||||
print $formwebsite->selectContainer($website, 'pageidfortranslation', $sourcepage->id, 1, $action);
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
$htmlhelp=$langs->trans("WEBSITE_ALIASALTDesc");
|
||||
@ -3127,7 +3104,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
print '</table>';
|
||||
if ($action == 'createcontainer')
|
||||
{
|
||||
print '<div class="center">';
|
||||
print '<div class="center tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
|
||||
|
||||
print '<input class="button" type="submit" name="addcontainer" value="'.$langs->trans("Create").'">';
|
||||
print '<input class="button" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
|
||||
@ -3155,6 +3132,20 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
jQuery("#WEBSITE_PAGENAME").keyup(function() {
|
||||
disableautofillofalias = 1;
|
||||
});
|
||||
|
||||
jQuery("#checkboxcreatefromfetching,#checkboxcreatemanually").change(function() {
|
||||
console.log("we select a method to create a new container"+jQuery("#checkboxcreatefromfetching:checked").val())
|
||||
if (typeof(jQuery("#checkboxcreatefromfetching:checked").val()) != \'undefined\')
|
||||
{
|
||||
jQuery(".tablecheckboxcreatefromfetching").show();
|
||||
jQuery(".tablecheckboxcreatemanually").hide();
|
||||
}
|
||||
if (typeof(jQuery("#checkboxcreatemanually:checked").val()) != \'undefined\')
|
||||
{
|
||||
jQuery(".tablecheckboxcreatefromfetching").hide();
|
||||
jQuery(".tablecheckboxcreatemanually").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
@ -3286,6 +3277,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm')
|
||||
|
||||
if ($listofpages['code'] == 'OK')
|
||||
{
|
||||
print '<!-- List of search result -->'."\n";
|
||||
print '<div class="rowsearchresult">';
|
||||
|
||||
if ($action == 'replacesiteconfirm')
|
||||
@ -3317,7 +3309,8 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm')
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Container").'</td>';
|
||||
print '<td>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.$website->ref.'&pageid='.$answerrecord->id.'">'.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).'</a>';
|
||||
print $answerrecord->getNomUrl(1);
|
||||
print ' <span class="opacitymedium">('.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).')</span>';
|
||||
print '</td>';
|
||||
print '<td class="tdoverflow100">'.$answerrecord->description;
|
||||
print '</td>';
|
||||
|
||||
@ -633,37 +633,37 @@ class Hook extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus)) {
|
||||
if (empty($this->labelStatus)) {
|
||||
global $langs;
|
||||
//$langs->load("zapier@zapier");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
$this->labelStatus[1] = $langs->trans('Enabled');
|
||||
$this->labelStatus[0] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0) {
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
} elseif ($mode == 1) {
|
||||
return $this->labelstatus[$status];
|
||||
return $this->labelStatus[$status];
|
||||
} elseif ($mode == 2) {
|
||||
if ($status == 1) {
|
||||
return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
} elseif ($status == 0) {
|
||||
return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
}
|
||||
} elseif ($mode == 3) {
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
} elseif ($mode == 4) {
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status];
|
||||
} elseif ($mode == 5) {
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
} elseif ($mode == 6) {
|
||||
if ($status == 1) {
|
||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
} elseif ($status == 0) {
|
||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user