';
print img_weather($text, 0, $options);
@@ -411,11 +405,9 @@ if ($action == 'edit') {
print '
';
}
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 6c498d30867..b39f0a8d143 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -1740,7 +1740,6 @@ else
{
if ($showemptyline)
{
-
print '
';
$showemptyline=0;
}
diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php
index 4951f57c22f..e65eb2bbb0a 100644
--- a/htdocs/admin/dolistore/class/dolistore.class.php
+++ b/htdocs/admin/dolistore/class/dolistore.class.php
@@ -226,7 +226,6 @@ class Dolistore
$html .= self::get_categories($cat->id);
$html .= "\n";
} else {
-
}
}
diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php
index e8dbfab9942..29ef6d40a1e 100644
--- a/htdocs/admin/expedition.php
+++ b/htdocs/admin/expedition.php
@@ -366,7 +366,6 @@ foreach ($dirmodels as $reldir)
{
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);
diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php
index 8dde3449b6e..8a5cef82ceb 100644
--- a/htdocs/admin/expensereport.php
+++ b/htdocs/admin/expensereport.php
@@ -247,7 +247,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled())
{
-
print '
';
print "".$langs->trans("Logo")." ";
print '';
diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 759038930ef..dccfcdfdda1 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -720,7 +720,6 @@ if ($resql)
$i = 0;
while ($i < $num)
{
-
$row = $db->fetch_row($resql);
print 'isEnabled())
{
-
print ''.$module->nom." \n";
print $module->info();
print ' ';
@@ -303,7 +302,6 @@ print ' ';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
-
/*
* Documents models for Holidays
*/
@@ -369,7 +367,6 @@ foreach ($dirmodels as $reldir)
{
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);
diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php
index ea19b7034a6..27f99ecb4f1 100644
--- a/htdocs/admin/limits.php
+++ b/htdocs/admin/limits.php
@@ -172,7 +172,6 @@ if (empty($mysoc->country_code))
}
else
{
-
// Show examples
print ''.$langs->trans("ExamplesWithCurrentSetup").": \n";
diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php
index 1f8a74f6eb8..99cd481095b 100644
--- a/htdocs/admin/livraison.php
+++ b/htdocs/admin/livraison.php
@@ -356,8 +356,6 @@ foreach ($dirmodels as $reldir)
{
if (file_exists($dir.'/'.$file))
{
-
-
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index ff2b788a026..79d152fb7bf 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -364,7 +364,6 @@ if ($action == 'edit')
// ID
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
-
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:'');
print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").' ';
// SuperAdministrator access only
@@ -384,7 +383,6 @@ if ($action == 'edit')
// PW
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
-
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
print ' '.$langs->trans("MAIN_MAIL_SMTPS_PW").' ';
// SuperAdministrator access only
diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php
index 3d6cfc2d228..94f3820c5b9 100644
--- a/htdocs/admin/mails_emailing.php
+++ b/htdocs/admin/mails_emailing.php
@@ -316,7 +316,6 @@ if ($action == 'edit')
// ID
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
{
-
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING:'');
print ' '.$langs->trans("MAIN_MAIL_SMTPS_ID").' ';
// SuperAdministrator access only
diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php
index 43888d3e061..5a54a9e5c9f 100644
--- a/htdocs/admin/menus/edit.php
+++ b/htdocs/admin/menus/edit.php
@@ -323,7 +323,6 @@ if ($action == 'create')
$res = $db->query($sql);
if ($res)
{
-
while ($menu = $db->fetch_array($res))
{
$parent_rowid = $menu['rowid'];
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 787f3ded291..88ad0acf097 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -63,8 +63,6 @@ $dolistore = new Dolistore(false);
if (! $user->admin)
accessforbidden();
-$specialtostring=array(0=>'common', 1=>'interfaces', 2=>'other', 3=>'functional', 4=>'marketplace');
-
$familyinfo=array(
'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
@@ -190,7 +188,7 @@ if ($action=='install')
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
- setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").' Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.' '.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors');
+ setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").' '.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors');
$error++;
}
}
@@ -368,11 +366,8 @@ foreach ($modulesdir as $dir)
}
}
ksort($arrayofnatures);
- }
- // Define array $categ with categ with at least one qualified module
- if ($modulequalified > 0)
- {
+ // Define array $categ with categ with at least one qualified module
$filename[$i]= $modName;
$modules[$modName] = $objMod;
@@ -400,7 +395,15 @@ foreach ($modulesdir as $dir)
$arrayofwarningsext[$modName]=$objMod->warnings_activation_ext;
}
- $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
+ $familyposition = $familyinfo[$familykey]['position'];
+ if ($external)
+ {
+ // TODO Find a solution so modules with their own family are always at end
+ //var_dump($familyposition);
+ //$familyposition += 100;
+ }
+
+ $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].' ';
// Set categ[$i]
@@ -527,6 +530,7 @@ if ($mode == 'common')
print '
';
+ $object=new stdClass();
$parameters=array();
$reshook=$hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -538,14 +542,13 @@ if ($mode == 'common')
foreach ($orders as $key => $value)
{
$tab=explode('_', $value);
- $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
+ $familykey=$tab[1];
+ $module_position=$tab[2];
$modName = $filename[$key];
$objMod = $modules[$modName];
- $dirofmodule = $dirmod[$key];
//print $objMod->name." - ".$key." - ".$objMod->version." ";
- //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev')
if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab
if (! $objMod->getName())
@@ -729,7 +732,6 @@ if ($mode == 'common')
print '';
}
else {
-
print 'numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode .'&confirm=yes' . $param . '">';
print img_picto($langs->trans("Activated"), 'switch_on');
print ' ';
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index cc1d53d14f8..6d1a5c57cf6 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -164,7 +164,6 @@ print ' ';
$i=0;
foreach($listofnotifiedevents as $notifiedevent)
{
-
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
@@ -209,7 +208,6 @@ $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
foreach($listofnotifiedevents as $notifiedevent)
{
-
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php
index 20c0ae222eb..bb3c83c2ee2 100644
--- a/htdocs/admin/oauthlogintokens.php
+++ b/htdocs/admin/oauthlogintokens.php
@@ -122,7 +122,6 @@ dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
if ($mode == 'setup' && $user->admin)
{
-
print $langs->trans("OAuthSetupForLogin")." \n";
foreach($list as $key)
@@ -381,7 +380,6 @@ if ($mode == 'userconf' && $user->admin)
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
$resql = $db->query($sql);
while ($row=$db->fetch_array($resql)) {
-
print ' ';
print ''.$row['login'].' ';
print ''.$row['module'].' ';
diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php
index 4c8f4188e4b..db9efb0e5c7 100644
--- a/htdocs/admin/propal.php
+++ b/htdocs/admin/propal.php
@@ -294,7 +294,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled())
{
-
print ' '.$module->nom." \n";
print $module->info();
print ' ';
@@ -596,7 +595,6 @@ if (empty($conf->facture->enabled))
$i = 0;
while ($i < $num)
{
-
$row = $db->fetch_row($resql);
print '';
//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1)
// Patter for Password Perso
if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
-
-
$tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN);
print ' ';
print '';
diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php
index 73cad8f69ad..833d6c25d22 100644
--- a/htdocs/admin/sms.php
+++ b/htdocs/admin/sms.php
@@ -207,7 +207,6 @@ if ($action == 'edit')
}
else
{
-
if (! count($listofmethods)) print ''.$langs->trans("NoSmsEngine", '
DoliStore ').'
';
print '';
diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php
index 27a126c7ef6..9cb387aedc9 100644
--- a/htdocs/admin/supplier_invoice.php
+++ b/htdocs/admin/supplier_invoice.php
@@ -237,7 +237,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
-
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 24) == 'mod_facture_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
@@ -365,7 +364,6 @@ foreach ($dirmodels as $reldir)
if (is_dir($dir))
{
-
$handle=opendir($dir);
diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php
index ac7d5e98539..6369efb1361 100644
--- a/htdocs/admin/supplier_order.php
+++ b/htdocs/admin/supplier_order.php
@@ -267,7 +267,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
-
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php
index 65bb18fcc5f..8da430a9fa1 100644
--- a/htdocs/admin/supplier_payment.php
+++ b/htdocs/admin/supplier_payment.php
@@ -213,7 +213,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
-
while (($file = readdir($handle))!==false)
{
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
@@ -337,7 +336,6 @@ foreach ($dirmodels as $reldir)
if (is_dir($dir))
{
-
$handle=opendir($dir);
diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php
index 55fb4329d39..bd2cb10a3ad 100644
--- a/htdocs/admin/supplier_proposal.php
+++ b/htdocs/admin/supplier_proposal.php
@@ -246,7 +246,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
-
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
@@ -263,7 +262,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled())
{
-
print ''.$module->nom." \n";
print $module->info();
print ' ';
@@ -537,7 +535,6 @@ print '';
if ($conf->banque->enabled)
{
-
print '';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'   ';
if (! empty($conf->use_javascript_ajax))
@@ -559,7 +556,6 @@ if ($conf->banque->enabled)
}
else
{
-
print ' ';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '.$langs->trans('NotAvailable').' ';
}
diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php
index 92823045a62..bd93d7a9fc5 100644
--- a/htdocs/admin/syslog.php
+++ b/htdocs/admin/syslog.php
@@ -50,7 +50,6 @@ foreach ($dirsyslogs as $reldir) {
$handle = opendir($newdir);
if (is_resource($handle)) {
-
while (($file = readdir($handle)) !== false) {
if (substr($file, 0, 11) == 'mod_syslog_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
$file = substr($file, 0, dol_strlen($file) - 4);
diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php
index 195b5c83143..01836dd4a72 100644
--- a/htdocs/admin/system/database-tables.php
+++ b/htdocs/admin/system/database-tables.php
@@ -202,7 +202,6 @@ else
if ($resql)
{
while ($row = $db->fetch_row($resql)) {
-
$rescount = $db->query("SELECT COUNT(*) FROM " . $row[0]);
if ($rescount) {
$row_count = $db->fetch_row($rescount);
diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php
index d97252dc53b..8bb39f0056b 100644
--- a/htdocs/admin/ticket.php
+++ b/htdocs/admin/ticket.php
@@ -214,7 +214,6 @@ foreach ($dirmodels as $reldir) {
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
-
while (($file = readdir($handle)) !== false) {
if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
$file = $reg[1];
diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php
index ba2dde77bec..4d234e266e8 100644
--- a/htdocs/admin/translation.php
+++ b/htdocs/admin/translation.php
@@ -108,7 +108,6 @@ if ($action == 'update')
}
else
{
-
$db->rollback();
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
@@ -158,7 +157,6 @@ if ($action == 'add')
}
else
{
-
$db->rollback();
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php
index 2ead8e03210..ba6c3660bcd 100644
--- a/htdocs/admin/user.php
+++ b/htdocs/admin/user.php
@@ -239,7 +239,6 @@ foreach ($dirmodels as $reldir)
{
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);
diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php
index c0c4e3c57d8..190391b462b 100644
--- a/htdocs/admin/usergroup.php
+++ b/htdocs/admin/usergroup.php
@@ -186,7 +186,6 @@ foreach ($dirmodels as $reldir)
{
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);
diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php
index 1c7fe75f0de..0343fecf69d 100644
--- a/htdocs/admin/website.php
+++ b/htdocs/admin/website.php
@@ -572,7 +572,6 @@ if ($id)
// Lines with values
while ($i < $num)
{
-
$obj = $db->fetch_object($resql);
//print_r($obj);
print '';
diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php
index 6803f9d65e7..459bd2d8edc 100644
--- a/htdocs/asset/type.php
+++ b/htdocs/asset/type.php
@@ -83,7 +83,6 @@ $hookmanager->initHooks(array('assettypecard','globalcard'));
*/
if ($cancel) {
-
$action='';
if (! empty($backtopage))
diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php
index a0bb66f2b81..1ed7c449868 100644
--- a/htdocs/barcode/printsheet.php
+++ b/htdocs/barcode/printsheet.php
@@ -197,7 +197,6 @@ if ($action == 'builddoc')
// For labels
if ($mode == 'label')
{
-
$txtforsticker="%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator
$textleft=make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT)?$txtforsticker:$conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray);
$textheader=make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT)?'':$conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray);
diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php
index b44f27f7fe8..1f0c82e780b 100644
--- a/htdocs/blockedlog/admin/blockedlog_list.php
+++ b/htdocs/blockedlog/admin/blockedlog_list.php
@@ -92,7 +92,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
if ($action === 'downloadblockchain') {
-
$auth = new BlockedLogAuthority($db);
$bc = $auth->getLocalBlockChain();
diff --git a/htdocs/blockedlog/ajax/authority.php b/htdocs/blockedlog/ajax/authority.php
index bcbb4a66f91..45479c1e4db 100644
--- a/htdocs/blockedlog/ajax/authority.php
+++ b/htdocs/blockedlog/ajax/authority.php
@@ -51,7 +51,6 @@ if($auth->fetch(0, $signature)<=0) {
if(!empty($hash)) {
-
echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk';
}
elseif(!empty($newblock)){
@@ -62,7 +61,6 @@ elseif(!empty($newblock)){
echo 'blockadded';
}
else{
-
echo 'blockalreadyadded';
}
}
diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php
index 7325f9ae50c..cec6410b7b6 100644
--- a/htdocs/blockedlog/class/authority.class.php
+++ b/htdocs/blockedlog/class/authority.class.php
@@ -310,17 +310,14 @@ class BlockedLogAuthority
$signature=$block_static->getSignature();
foreach($blocks as &$block) {
-
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
$res = file_get_contents($url);
echo $block->signature.' '.$url. ' '.$res.' ';
if($res === 'blockalreadyadded' || $res === 'blockadded') {
-
$block->setCertified();
}
else {
-
$this->error = $langs->trans('ImpossibleToContactAuthority ', $url);
return -1;
}
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 14366f46de7..24548f736f2 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -977,7 +977,6 @@ class BlockedLog
if (empty($cachedlogs)) $cachedlogs=array();
if ($element=='all') {
-
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity;
}
@@ -1006,7 +1005,6 @@ class BlockedLog
$res = $this->db->query($sql);
if($res) {
-
$results=array();
$i = 0;
@@ -1046,7 +1044,6 @@ class BlockedLog
global $db,$conf,$mysoc;
if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint
-
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 5e24724b6f7..0949fa1a334 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -42,6 +42,11 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard
$backtopage = GETPOST('backtopage', 'alpha');
$lineid = GETPOST('lineid', 'int');
+// PDF
+$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
+$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
+$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
+
// Initialize technical objects
$object=new BOM($db);
$extrafields = new ExtraFields($db);
@@ -92,8 +97,8 @@ if (empty($reshook))
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
if (empty($backtopage)) {
- if (empty($id)) $backtopage = $backurlforlist;
- else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id;
+ if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
+ else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
}
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
@@ -286,6 +291,112 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
}
+ $formconfirm = '';
+
+ // Confirmation to delete
+ if ($action == 'delete') {
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
+ }
+
+ // Confirmation of validation
+ if ($action == 'validate')
+ {
+ // We check that object has a temporary ref
+ $ref = substr($object->ref, 1, 4);
+ if ($ref == 'PROV') {
+ $object->fetch_product();
+ $numref = $object->getNextNumRef($object->product);
+ } else {
+ $numref = $object->ref;
+ }
+
+ $text = $langs->trans('ConfirmValidateBom', $numref);
+ /*if (! empty($conf->notification->enabled))
+ {
+ require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
+ $notify = new Notify($db);
+ $text .= ' ';
+ $text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
+ }*/
+
+ $formquestion=array();
+ if (! empty($conf->bom->enabled))
+ {
+ $langs->load("mrp");
+ require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
+ $formproduct = new FormProduct($db);
+ $forcecombo=0;
+ if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
+ $formquestion = array(
+ // 'text' => $langs->trans("ConfirmClone"),
+ // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
+ // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
+ );
+ }
+
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
+ }
+
+ // Confirmation of closing
+ if ($action == 'close')
+ {
+ $text = $langs->trans('ConfirmCloseBom', $object->ref);
+ /*if (! empty($conf->notification->enabled))
+ {
+ require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
+ $notify = new Notify($db);
+ $text .= ' ';
+ $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
+ }*/
+
+ $formquestion=array();
+ if (! empty($conf->bom->enabled))
+ {
+ $langs->load("mrp");
+ require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
+ $formproduct = new FormProduct($db);
+ $forcecombo=0;
+ if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
+ $formquestion = array(
+ // 'text' => $langs->trans("ConfirmClone"),
+ // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
+ // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
+ );
+ }
+
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
+ }
+
+ // Confirmation of reopen
+ if ($action == 'reopen')
+ {
+ $text = $langs->trans('ConfirmReopenBom', $object->ref);
+ /*if (! empty($conf->notification->enabled))
+ {
+ require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
+ $notify = new Notify($db);
+ $text .= ' ';
+ $text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
+ }*/
+
+ $formquestion=array();
+ if (! empty($conf->bom->enabled))
+ {
+ $langs->load("mrp");
+ require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
+ $formproduct = new FormProduct($db);
+ $forcecombo=0;
+ if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
+ $formquestion = array(
+ // 'text' => $langs->trans("ConfirmClone"),
+ // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
+ // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
+ );
+ }
+
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
+ }
+
// Clone confirmation
if ($action == 'clone') {
// Create an array for form
@@ -294,20 +405,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Confirmation of action xxxx
- if ($action == 'xxx')
+ if ($action == 'setdraft')
{
+ $text = $langs->trans('ConfirmSetToDraft', $object->ref);
+
$formquestion=array();
- /*
- $forcecombo=0;
- if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
- $formquestion = array(
- // 'text' => $langs->trans("ConfirmClone"),
- // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
- // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
- // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
- );
- */
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
@@ -457,6 +560,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
//print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ' '."\n";
+ if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED)
+ {
+ print '' . $langs->trans("SetToDraft") . ' ';
+ }
+
// Modify
if ($user->rights->bom->write)
{
@@ -467,10 +575,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ''.$langs->trans('Modify').' '."\n";
}
+ // Validate
+ if ($user->rights->bom->write && $object->status == BOM::STATUS_DRAFT)
+ {
+ if (is_array($object->lines) && count($object->lines) > 0)
+ {
+ print '' . $langs->trans("Validate") . ' ';
+ }
+ else
+ {
+ print '' . $langs->trans("Validate") . ' ';
+ }
+ }
+
+ // Close / Cancel
+ if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED)
+ {
+ print '' . $langs->trans("Disable") . ' ';
+ }
+
+ // Re-open
+ if ($user->rights->bom->write && $object->status == BOM::STATUS_CANCELED)
+ {
+ print '' . $langs->trans("ReOpen") . ' ';
+ }
+
// Clone
if ($user->rights->bom->write)
{
- print '';
+ print '' . $langs->trans("ToClone") . ' ';
}
/*
diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php
index 635f0f9db65..46473d52ddb 100644
--- a/htdocs/bom/bom_list.php
+++ b/htdocs/bom/bom_list.php
@@ -21,6 +21,7 @@
* \ingroup bom
* \brief List page for bom
*/
+
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@@ -99,7 +100,7 @@ $arrayfields=array();
foreach($object->fields as $key => $val)
{
// If $val['visible']==0, then we never show the field
- if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
+ if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
@@ -179,8 +180,9 @@ foreach($object->fields as $key => $val)
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
-if (! empty($extrafields->attributes[$object->table_element]['label']))
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
+}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -213,6 +215,7 @@ foreach($object->fields as $key => $val)
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
+}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
@@ -258,7 +261,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
- header("Location: ".dol_buildpath('/bom/bom_card.php', 1).'?id='.$id);
+ header("Location: ".DOL_URL_ROOT.'/bom/bom_card.php?id='.$id);
exit;
}
@@ -290,7 +293,8 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
foreach($search as $key => $val)
{
- $param.= '&search_'.$key.'='.urlencode($search[$key]);
+ if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey);
+ else $param.= '&search_'.$key.'='.urlencode($search[$key]);
}
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
@@ -315,19 +319,7 @@ print ' ';
print ' ';
print ' ';
-$newcardbutton='';
-//if ($user->rights->bom->creer)
-//{
- $newcardbutton=''.$langs->trans('New').' ';
- $newcardbutton.= ' ';
- $newcardbutton.= ' ';
-//}
-//else
-//{
-// $newcardbutton=''.$langs->trans('New').' ';
-// $newcardbutton.= ' ';
-// $newcardbutton.= ' ';
-//}
+$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cubes', 0, $newcardbutton, '', $limit);
@@ -338,10 +330,10 @@ $objecttmp=new BOM($db);
$trackid='xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
-if ($sall)
+if ($search_all)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
- print ''.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
';
+ print ''.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
';
}
$moreforfilter = '';
@@ -424,7 +416,7 @@ $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sort
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
-print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
+print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print ' '."\n";
@@ -460,12 +452,14 @@ while ($i < min($num, $limit))
foreach($object->fields as $key => $val)
{
$cssforfield=(empty($val['css'])?'':$val['css']);
- if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
- elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
- 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'))) $cssforfield.=($cssforfield?' ':'').'right';
-
+ 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('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right';
+
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '';
@@ -488,7 +482,7 @@ while ($i < min($num, $limit))
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
- print ' ';
+ print ' ';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 73e26de8aea..84560d5a533 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -95,8 +95,8 @@ class BOM extends CommonObject
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
- 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,),
- 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,),
+ 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
+ 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
@@ -513,7 +513,7 @@ class BOM extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <=0 if OK, 0=Nothing done, >0 if KO
*/
- public function valid($user, $notrigger = 0)
+ public function validate($user, $notrigger = 0)
{
global $conf, $langs;
@@ -524,7 +524,7 @@ class BOM extends CommonObject
// Protection
if ($this->statut == self::STATUS_VALIDATED)
{
- dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
+ dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
return 0;
}
@@ -553,14 +553,14 @@ class BOM extends CommonObject
$this->newref = $num;
// Validate
- $sql = "UPDATE ".MAIN_DB_PREFIX."bom_bom";
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->db->escape($num)."',";
$sql.= " status = ".self::STATUS_VALIDATED.",";
$sql.= " date_valid='".$this->db->idate($now)."',";
$sql.= " fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
- dol_syslog(get_class($this)."::valid()", LOG_DEBUG);
+ dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
@@ -597,7 +597,7 @@ class BOM extends CommonObject
$dirdest = $conf->bom->dir_output.'/'.$newref;
if (! $error && file_exists($dirsource))
{
- dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
+ dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest))
{
@@ -640,64 +640,78 @@ class BOM extends CommonObject
* Set draft status
*
* @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
- public function setDraft($user)
+ public function setDraft($user, $notrigger = 0)
{
- global $conf, $langs;
+ // Protection
+ if ($this->status <= self::STATUS_DRAFT)
+ {
+ return 0;
+ }
- $error=0;
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
- // Protection
- if ($this->status <= self::STATUS_DRAFT)
- {
- return 0;
- }
-
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
- {
- $this->error='Permission denied';
- return -1;
- }*/
-
- $this->db->begin();
-
- $sql = "UPDATE ".MAIN_DB_PREFIX."bom";
- $sql.= " SET status = ".self::STATUS_DRAFT;
- $sql.= " WHERE rowid = ".$this->id;
-
- dol_syslog(get_class($this)."::setDraft", LOG_DEBUG);
- if ($this->db->query($sql))
- {
- if (! $error)
- {
- $this->oldcopy= clone $this;
- }
-
- if (!$error) {
- // Call trigger
- $result=$this->call_trigger('BOM_UNVALIDATE', $user);
- if ($result < 0) $error++;
- }
-
- if (!$error) {
- $this->status=self::STATUS_DRAFT;
- $this->db->commit();
- return 1;
- } else {
- $this->db->rollback();
- return -1;
- }
- }
- else
- {
- $this->error=$this->db->error();
- $this->db->rollback();
- return -1;
- }
+ return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'BOM_UNVALIDATE');
}
+ /**
+ * Set cancel status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, 0=Nothing done, >0 if OK
+ */
+ public function cancel($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status != self::STATUS_VALIDATED)
+ {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'BOM_CLOSE');
+ }
+
+ /**
+ * Set cancel status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, 0=Nothing done, >0 if OK
+ */
+ public function reopen($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status != self::STATUS_CANCELED)
+ {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN');
+ }
+
+
/**
* Return a link to the object card (with optionaly the picto)
*
@@ -929,7 +943,6 @@ class BOM extends CommonObject
$langs->load("mrp");
if (! dol_strlen($modele)) {
-
$modele = 'standard';
if ($this->modelpdf) {
@@ -1052,7 +1065,7 @@ class BOMLine extends CommonObject
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
- 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
+ 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
);
public $rowid;
diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php
index 1e54cc816fd..8128815ef3b 100644
--- a/htdocs/bookmarks/bookmarks.lib.php
+++ b/htdocs/bookmarks/bookmarks.lib.php
@@ -38,7 +38,6 @@ function printBookmarksList($aDb, $aLangs)
$ret = ''."\n";
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
-
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php
index 0ba6d7569b5..7feb0aac37a 100644
--- a/htdocs/bookmarks/card.php
+++ b/htdocs/bookmarks/card.php
@@ -54,7 +54,6 @@ $object=new Bookmark($db);
if ($action == 'add' || $action == 'addproduct' || $action == 'update')
{
-
if ($action == 'update') {
$invertedaction = 'edit';
} else {
diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php
index 22b8fea0a05..f9c438149e7 100644
--- a/htdocs/cashdesk/admin/cashdesk.php
+++ b/htdocs/cashdesk/admin/cashdesk.php
@@ -125,7 +125,6 @@ print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.
print ' ';
if (! empty($conf->banque->enabled))
{
-
print ''.$langs->trans("CashDeskBankAccountForSell").' ';
print '';
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1);
@@ -146,7 +145,6 @@ if (! empty($conf->banque->enabled))
if (! empty($conf->stock->enabled))
{
-
print ' '.$langs->trans("CashDeskDoNotDecreaseStock").' '; // Force warehouse (this is not a default value)
print '';
if (empty($conf->productbatch->enabled)) {
diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php
index 40b338ccca6..2f8a993829e 100644
--- a/htdocs/cashdesk/class/Facturation.class.php
+++ b/htdocs/cashdesk/class/Facturation.class.php
@@ -296,12 +296,10 @@ class Facturation
}
elseif ( $aId == 'RESET' )
{
-
$this->id = null;
}
else
{
-
$this->id = $aId;
}
}
@@ -343,7 +341,6 @@ class Facturation
}
elseif ( $aQte == 'RESET' )
{
-
$this->qte = null;
}
else
@@ -408,13 +405,10 @@ class Facturation
{
if (is_null($aMontantRemise)) {
-
return $this->montant_remise;
} elseif ( $aMontantRemise == 'RESET' ) {
-
$this->montant_remise = null;
} else {
-
$this->montant_remise = $aMontantRemise;
}
}
@@ -429,13 +423,10 @@ class Facturation
{
if (is_null($aPrix)) {
-
return $this->prix;
} elseif ( $aPrix == 'RESET' ) {
-
$this->prix = null;
} else {
-
$this->prix = $aPrix;
}
}
@@ -449,13 +440,10 @@ class Facturation
public function tva($aTva = null)
{
if (is_null($aTva)) {
-
return $this->tva;
} elseif ( $aTva == 'RESET' ) {
-
$this->tva = null;
} else {
-
$this->tva = $aTva;
}
}
@@ -469,13 +457,10 @@ class Facturation
public function numInvoice($aNumFacture = null)
{
if (is_null($aNumFacture)) {
-
return $this->num_facture;
} elseif ( $aNumFacture == 'RESET' ) {
-
$this->num_facture = null;
} else {
-
$this->num_facture = $aNumFacture;
}
}
@@ -490,13 +475,10 @@ class Facturation
{
if (is_null($aModeReglement)) {
-
return $this->mode_reglement;
} elseif ( $aModeReglement == 'RESET' ) {
-
$this->mode_reglement = null;
} else {
-
$this->mode_reglement = $aModeReglement;
}
}
@@ -511,13 +493,10 @@ class Facturation
{
if (is_null($aMontantEncaisse)) {
-
return $this->montant_encaisse;
} elseif ( $aMontantEncaisse == 'RESET' ) {
-
$this->montant_encaisse = null;
} else {
-
$this->montant_encaisse = $aMontantEncaisse;
}
}
@@ -532,13 +511,10 @@ class Facturation
{
if (is_null($aMontantRendu)) {
-
return $this->montant_rendu;
} elseif ( $aMontantRendu == 'RESET' ) {
-
$this->montant_rendu = null;
} else {
-
$this->montant_rendu = $aMontantRendu;
}
}
@@ -552,13 +528,10 @@ class Facturation
public function paiementLe($aPaiementLe = null)
{
if (is_null($aPaiementLe)) {
-
return $this->paiement_le;
} elseif ( $aPaiementLe == 'RESET' ) {
-
$this->paiement_le = null;
} else {
-
$this->paiement_le = $aPaiementLe;
}
}
@@ -572,13 +545,10 @@ class Facturation
public function prixTotalHt($aTotalHt = null)
{
if (is_null($aTotalHt)) {
-
return $this->prix_total_ht;
} elseif ( $aTotalHt == 'RESET' ) {
-
$this->prix_total_ht = null;
} else {
-
$this->prix_total_ht = $aTotalHt;
}
}
@@ -592,13 +562,10 @@ class Facturation
public function montantTva($aMontantTva = null)
{
if (is_null($aMontantTva)) {
-
return $this->montant_tva;
} elseif ( $aMontantTva == 'RESET' ) {
-
$this->montant_tva = null;
} else {
-
$this->montant_tva = $aMontantTva;
}
}
diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php
index f7e7c3af501..c52ecccef77 100644
--- a/htdocs/cashdesk/facturation.php
+++ b/htdocs/cashdesk/facturation.php
@@ -36,7 +36,6 @@ $form=new Form($db);
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
if ( GETPOST('filtre', 'alpha') ) {
-
// Avec filtre
$ret=array(); $i=0;
@@ -88,7 +87,6 @@ if ( GETPOST('filtre', 'alpha') ) {
}
$tab_designations=$ret;
} else {
-
// Sans filtre
$ret=array();
$i=0;
diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php
index a35abb46789..d892c1df0e6 100644
--- a/htdocs/cashdesk/tpl/liste_articles.tpl.php
+++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php
@@ -57,10 +57,8 @@ else
echo (''.$tab[$i]['ref'].' - '.$tab[$i]['label'].'
'."\n");
if ( $tab[$i]['remise_percent'] > 0 ) {
-
$remise_percent = ' -'.$tab[$i]['remise_percent'].'%';
} else {
-
$remise_percent = '';
}
diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php
index 64f340983ff..e8c16712b74 100644
--- a/htdocs/cashdesk/tpl/validation1.tpl.php
+++ b/htdocs/cashdesk/tpl/validation1.tpl.php
@@ -39,12 +39,10 @@ $langs->loadLangs(array("main","bills","banks"));
montantTva() ) {
-
echo (' '.$langs->trans("VAT").' '.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' ');
}
else
{
-
echo (''.$langs->trans("VAT").' '.$langs->trans("NoVAT").' ');
}
?>
@@ -87,16 +85,13 @@ $langs->loadLangs(array("main","bills","banks"));
getsetPaymentMode() == 'DIF' ) {
-
echo (''.$langs->trans("DateDue").' '.$obj_facturation->paiementLe().' ');
} else {
-
echo (''.$langs->trans("Received").' '.price(price2num($obj_facturation->montantEncaisse(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' ');
}
// Affichage du montant rendu (reglement en especes)
if ( $obj_facturation->montantRendu() ) {
-
echo (''.$langs->trans("Change").' '.price(price2num($obj_facturation->montantRendu(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' ');
}
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 48bb4179afc..cd3885b77b1 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1637,7 +1637,6 @@ class Categorie extends CommonObject
{
$nbfile = count($file['name']);
for ($i = 0; $i <= $nbfile; $i ++) {
-
$originImage = $dir . $file['name'][$i];
// Cree fichier en taille origine
diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php
index 70cf6e3e8f7..6def65666a0 100644
--- a/htdocs/categories/photos.php
+++ b/htdocs/categories/photos.php
@@ -69,7 +69,6 @@ if ($id > 0)
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if ($object->id) {
-
$file = $_FILES['userfile'];
if (is_array($file['name']) && count($file['name']) > 0)
{
diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php
index 07bf2861d71..3c9c7eb64e4 100644
--- a/htdocs/categories/traduction.php
+++ b/htdocs/categories/traduction.php
@@ -62,6 +62,7 @@ $object = new Categorie($db);
/*
* Actions
*/
+$error = 0;
// retour a l'affichage des traduction si annulation
if ($cancel == $langs->trans("Cancel"))
@@ -78,28 +79,44 @@ $cancel != $langs->trans("Cancel") &&
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
- // update de l'objet
- if ( $_POST["forcelangprod"] == $current_lang )
- {
- $object->label = $_POST["libelle"];
- $object->description = dol_htmlcleanlastbr($_POST["desc"]);
- }
- else
- {
- $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
- $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
- }
+ // check parameters
+ $forcelangprod = GETPOST('forcelangprod', 'alpha');
+ $libelle = GETPOST('libelle', 'alpha');
+ $desc = GETPOST('desc');
- // sauvegarde en base
- if ( $object->setMultiLangs($user) > 0 )
- {
- $action = '';
- }
- else
- {
- $action = 'add';
- setEventMessages($object->error, $object->errors, 'errors');
- }
+ if (empty($forcelangprod)) {
+ $error++;
+ $object->errors[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Translation'));
+ }
+
+ if (!$error) {
+ if (empty($libelle)) {
+ $error++;
+ $object->errors[] = $langs->trans('Language_' . $forcelangprod) . ' : ' . $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
+ }
+
+ if (!$error) {
+ // update de l'objet
+ if ($forcelangprod == $current_lang) {
+ $object->label = $libelle;
+ $object->description = dol_htmlcleanlastbr($desc);
+ } else {
+ $object->multilangs[$forcelangprod]["label"] = $libelle;
+ $object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
+ }
+
+ // sauvegarde en base
+ $res = $object->setMultiLangs($user);
+ if ($res < 0) $error++;
+ }
+ }
+
+ if ($error) {
+ $action = 'add';
+ setEventMessages($object->error, $object->errors, 'errors');
+ } else {
+ $action = '';
+ }
}
// Validation de l'edition
@@ -112,27 +129,34 @@ $cancel != $langs->trans("Cancel") &&
foreach ($object->multilangs as $key => $value) // enregistrement des nouvelles valeurs dans l'objet
{
- if ( $key == $current_lang )
- {
- $object->label = $_POST["libelle-".$key];
- $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
- }
- else
- {
- $object->multilangs[$key]["label"] = $_POST["libelle-".$key];
- $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
+ $libelle = GETPOST('libelle-'. $key, 'alpha');
+ $desc = GETPOST('desc-' . $key);
+
+ if (empty($libelle)) {
+ $error++;
+ $object->errors[] = $langs->trans('Language_' . $key) . ' : ' . $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
+ }
+
+ if ( $key == $current_lang ) {
+ $object->label = $libelle;
+ $object->description = dol_htmlcleanlastbr($desc);
+ } else {
+ $object->multilangs[$key]["label"] = $libelle;
+ $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($desc);
}
}
- if ( $object->setMultiLangs($user) > 0 )
- {
- $action = '';
- }
- else
- {
- $action = 'edit';
- setEventMessages($object->error, $object->errors, 'errors');
- }
+ if (!$error) {
+ $res = $object->setMultiLangs($user);
+ if ($res < 0) $error++;
+ }
+
+ if ($error) {
+ $action = 'edit';
+ setEventMessages($object->error, $object->errors, 'errors');
+ } else {
+ $action = '';
+ }
}
$result = $object->fetch($id, $ref);
@@ -224,8 +248,8 @@ if ($action == '')
{
if ($user->rights->produit->creer || $user->rights->service->creer)
{
- print ''.$langs->trans("Add").' ';
- if ($cnt_trans > 0) print ''.$langs->trans("Update").' ';
+ print ''.$langs->trans('Add').' ';
+ if ($cnt_trans > 0) print ''.$langs->trans('Update').' ';
}
}
@@ -242,6 +266,7 @@ if ($action == 'edit')
print ' ';
print ' ';
print ' ';
+ print ' ';
if (! empty($object->multilangs))
{
@@ -249,9 +274,14 @@ if ($action == 'edit')
{
print "".$langs->trans('Language_'.$key)." : ";
print '';
- print ''.$langs->trans('Label').' ';
+
+ // Label
+ $libelle = (GETPOST('libelle-'.$key, 'alpha') ? GETPOST('libelle-'.$key, 'alpha') : $object->multilangs[$key]['label']);
+ print ''.$langs->trans('Label').' ';
+ // Desc
+ $desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
print ''.$langs->trans('Description').' ';
- $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
+ $doleditor = new DolEditor("desc-$key", $desc, '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
$doleditor->Create();
print ' ';
@@ -280,7 +310,7 @@ elseif ($action != 'add')
{
$s=picto_from_langcode($key);
print '';
- print ''.($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".'id.'&action=delete&langtodelete='.$key.'">'.img_delete('', '').' ';
+ print ''.($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".'id.'&action=delete&langtodelete='.$key.'&type='.$type.'">'.img_delete('', '').' ';
print ''.$langs->trans('Label').' '.$object->multilangs[$key]["label"].' ';
print ''.$langs->trans('Description').' '.$object->multilangs[$key]["description"].' ';
if (! empty($conf->global->CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION))
@@ -308,14 +338,16 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
print ' ';
print ' ';
print ' ';
+ print ' ';
print '';
print ''.$langs->trans('Translation').' ';
- print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs);
+ print $formadmin->select_language(GETPOST('forcelangprod', 'alpha'), 'forcelangprod', 0, $object->multilangs);
print ' ';
- print ''.$langs->trans('Label').' ';
+ print '' . $langs->trans('Label') . ' ';
+ print ' ';
print ''.$langs->trans('Description').' ';
- $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
+ $doleditor = new DolEditor('desc', GETPOST('desc', 'none'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
$doleditor->Create();
print ' ';
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 737b488c090..fb246b5358b 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -125,7 +125,6 @@ if ($id > 0 && $removeelem > 0)
$elementtype = 'member';
}
elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
-
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$tmpobject = new Contact($db);
$result = $tmpobject->fetch($removeelem);
@@ -644,7 +643,6 @@ if ($type == Categorie::TYPE_CONTACT)
}
else
{
-
print '
";
@@ -430,7 +428,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop)
{
-
$obj = $db->fetch_object($resql);
print '';
$supplierorderstatic->id=$obj->rowid;
@@ -470,7 +467,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
}
else
{
-
print ' '.$langs->trans("NoSupplierOrder").' ';
}
print "
";
diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php
index 9544a394508..1049431b7f2 100644
--- a/htdocs/comm/mailing/advtargetemailing.php
+++ b/htdocs/comm/mailing/advtargetemailing.php
@@ -114,7 +114,6 @@ if ($action == 'loadfilter') {
}
if ($action == 'add') {
-
$user_contact_query = false;
$array_query = array ();
@@ -168,7 +167,6 @@ if ($action == 'add') {
}
if (preg_match("/^contact_/", $key)) {
-
$array_query[$key] = GETPOST($key);
$specials_date_key = array (
@@ -262,7 +260,6 @@ if ($action == 'clear') {
}
if ($action == 'savefilter' || $action == 'createfilter') {
-
$template_name = GETPOST('template_name');
$error = 0;
@@ -272,7 +269,6 @@ if ($action == 'savefilter' || $action == 'createfilter') {
}
if (empty($error)) {
-
$array_query = array ();
// Get extra fields
@@ -325,7 +321,6 @@ if ($action == 'savefilter' || $action == 'createfilter') {
}
if (preg_match("/^contact_/", $key)) {
-
$array_query[$key] = GETPOST($key);
$specials_date_key = array (
@@ -359,7 +354,6 @@ if ($action == 'savefilter' || $action == 'createfilter') {
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
}
} elseif ($action == 'savefilter') {
-
$result = $advTarget->update($user);
if ($result < 0) {
setEventMessages($advTarget->error, $advTarget->errors, 'errors');
@@ -421,7 +415,6 @@ $formcompany = new FormCompany($db);
$formother = new FormOther($db);
if ($object->fetch($id) >= 0) {
-
$head = emailing_prepare_head($object);
dol_fiche_head($head, 'advtargets', $langs->trans("Mailing"), 0, 'email');
@@ -465,7 +458,6 @@ if ($object->fetch($id) >= 0) {
// Show email selectors
if ($object->statut == 0 && $user->rights->mailing->creer) {
-
include DOL_DOCUMENT_ROOT . '/core/tpl/advtarget.tpl.php';
}
}
diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php
index 7346bf87543..465bf7dcc50 100644
--- a/htdocs/comm/mailing/class/advtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/advtargetemailing.class.php
@@ -556,7 +556,6 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[]= 't.entity IN ('.getEntity('societe').')';
if (count($arrayquery)>0) {
-
if (array_key_exists('cust_saleman', $arrayquery)) {
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
}
@@ -565,7 +564,6 @@ class AdvanceTargetingMailing extends CommonObject
}
if (!empty($arrayquery['cust_name'])) {
-
$sqlwhere[]= $this->transformToSQL('t.nom', $arrayquery['cust_name']);
}
if (!empty($arrayquery['cust_code'])) {
@@ -617,13 +615,11 @@ class AdvanceTargetingMailing extends CommonObject
//Standard Extrafield feature
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
-
$elementtype = Societe::$table_element;
$extrafields->fetch_name_optionals_label($elementtype);
foreach($extrafields->attributes[$elementtype]['label'] as $key=>$val) {
-
if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') ||
($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
if (!empty($arrayquery['options_'.$key])) {
@@ -713,7 +709,6 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[]= 't.entity IN ('.getEntity('socpeople').')';
if (count($arrayquery)>0) {
-
if (array_key_exists('contact_categ', $arrayquery)) {
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_contact as contactcateg ON contactcateg.fk_socpeople=t.rowid ";
}
@@ -767,7 +762,6 @@ class AdvanceTargetingMailing extends CommonObject
$extrafields->fetch_name_optionals_label($elementtype);
foreach($extrafields->attributes[$elementtype]['label'] as $key=>$val) {
-
if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') ||
($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
if (!empty($arrayquery['options_'.$key.'_cnct'])) {
@@ -809,7 +803,6 @@ class AdvanceTargetingMailing extends CommonObject
}
if (!empty($arrayquery['cust_name'])) {
-
$sqlwhere[]= $this->transformToSQL('ts.nom', $arrayquery['cust_name']);
}
if (!empty($arrayquery['cust_code'])) {
@@ -870,7 +863,6 @@ class AdvanceTargetingMailing extends CommonObject
$extrafields->fetch_name_optionals_label($elementtype);
foreach($extrafields->attributes[$elementtype]['label'] as $key=>$val) {
-
if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') ||
($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
if (!empty($arrayquery['options_'.$key])) {
diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
index 55b7177eb73..67ec7414e7c 100644
--- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
@@ -114,7 +114,6 @@ class FormAdvTargetEmailing extends Form
dol_syslog(get_class($this) . "::select_country sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
-
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
@@ -175,7 +174,6 @@ class FormAdvTargetEmailing extends Form
$resql_usr = $this->db->query($sql_usr);
if ($resql_usr) {
while ( $obj_usr = $this->db->fetch_object($resql_usr) ) {
-
$label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')';
$options_array [$obj_usr->rowid] = $label;
@@ -249,7 +247,6 @@ class FormAdvTargetEmailing extends Form
$sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1];
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0];
if (! empty($InfoFieldList [3])) {
-
// We have to join on extrafield table
if (strpos($InfoFieldList [3], 'extra') !== false) {
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra';
@@ -266,7 +263,6 @@ class FormAdvTargetEmailing extends Form
dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
-
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
@@ -306,7 +302,6 @@ class FormAdvTargetEmailing extends Form
$resql=$this->db->query($sql);
if ($resql)
{
-
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
@@ -396,7 +391,6 @@ class FormAdvTargetEmailing extends Form
$resql=$this->db->query($sql);
if ($resql)
{
-
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
@@ -442,8 +436,6 @@ class FormAdvTargetEmailing extends Form
dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
-
-
$out .= '';
if ($showempty)
$out .= ' ';
diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php
index 6d815d63d8b..41f74846125 100644
--- a/htdocs/comm/mailing/class/mailing.class.php
+++ b/htdocs/comm/mailing/class/mailing.class.php
@@ -328,7 +328,6 @@ class Mailing extends CommonObject
{
//Clone target
if (!empty($option2)) {
-
require_once DOL_DOCUMENT_ROOT .'/core/modules/mailings/modules_mailings.php';
$mailing_target = new MailingTargets($this->db);
@@ -352,7 +351,6 @@ class Mailing extends CommonObject
if ($this->db->num_rows($result))
{
while ($obj = $this->db->fetch_object($result)) {
-
$target_array[]=array(
'fk_contact'=>$obj->fk_contact,
'lastname'=>$obj->lastname,
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 92267d97033..70cd74ac149 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -818,7 +818,6 @@ if (empty($reshook))
// Add line
elseif ($action == 'addline' && $usercancreate) {
-
// Set if we used free entry or predefined product
$predef='';
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
@@ -2471,39 +2470,39 @@ if ($action == 'create')
{
if ($usercanvalidate)
{
- print '';
+ print 'id . '&action=validate">' . $langs->trans('Validate') . ' ';
}
else
- print '';
+ print '' . $langs->trans('Validate') . ' ';
}
// Create event
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
- print '';
+ print '' . $langs->trans("AddAction") . ' ';
}*/
// Edit
if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) {
- print '';
+ print 'id . '&action=modif">' . $langs->trans('Modify') . ' ';
}
// ReOpen
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $usercanclose) {
- print '';
+ print 'id . '&action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
+ print '>' . $langs->trans('ReOpen') . ' ';
}
// Send
if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || !empty($conf->global->PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($usercansend) {
- print '';
+ print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ' ';
} else
- print '';
+ print '' . $langs->trans('SendMail') . ' ';
}
// Create an order
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateorder) {
- print '';
+ print '' . $langs->trans("AddOrder") . ' ';
}
}
@@ -2511,7 +2510,7 @@ if ($action == 'create')
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateintervention) {
$langs->load("interventions");
- print '';
+ print '' . $langs->trans("AddIntervention") . ' ';
}
}
@@ -2520,7 +2519,7 @@ if ($action == 'create')
$langs->load("contracts");
if ($usercancreatecontract) {
- print '';
+ print '' . $langs->trans('AddContract') . ' ';
}
}
@@ -2529,7 +2528,7 @@ if ($action == 'create')
{
if (! empty($conf->facture->enabled) && $usercancreateinvoice)
{
- print '';
+ print '' . $langs->trans("AddBill") . ' ';
}
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
@@ -2537,30 +2536,30 @@ if ($action == 'create')
{
if ($usercanclose)
{
- print '';
+ print 'id . '&action=classifybilled&socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . ' ';
}
else
{
- print '';
+ print '' . $langs->trans("ClassifyBilled") . ' ';
}
}
}
// Set accepted/refused
if ($object->statut == Propal::STATUS_VALIDATED && $usercanclose) {
- print '';
+ print 'id . '&action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
+ print '>' . $langs->trans('SetAcceptedRefused') . ' ';
}
// Clone
if ($usercancreate) {
- print '';
+ print '' . $langs->trans("ToClone") . ' ';
}
// Delete
if ($usercandelete) {
- print '';
+ print 'id . '&action=delete"';
+ print '>' . $langs->trans('Delete') . ' ';
}
}
}
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 45cc0399a93..a55b4a28172 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -3484,7 +3484,6 @@ class Propal extends CommonObject
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
-
$dir = dol_buildpath($reldir."core/modules/propale/");
// Load file with numbering class (if found)
@@ -3627,7 +3626,6 @@ class Propal extends CommonObject
$langs->load("propale");
if (! dol_strlen($modele)) {
-
$modele = 'azur';
if ($this->modelpdf) {
@@ -4043,7 +4041,6 @@ class PropaleLigne extends CommonObjectLine
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
if ($this->db->query($sql) )
{
-
// Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php
index 321cb719f63..a1104682904 100644
--- a/htdocs/comm/propal/index.php
+++ b/htdocs/comm/propal/index.php
@@ -126,7 +126,6 @@ if ($resql)
$dataseries[]=array($propalstatic->LibStatut($status, 1), (isset($vals[$status])?(int) $vals[$status]:0));
if (! $conf->use_javascript_ajax)
{
-
print '';
print ''.$propalstatic->LibStatut($status, 0).' ';
print ''.(isset($vals[$status])?$vals[$status]:0).' ';
diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php
index c07bf53007b..cdd94c9cf6c 100644
--- a/htdocs/comm/prospect/index.php
+++ b/htdocs/comm/prospect/index.php
@@ -147,7 +147,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
$total += $obj->price;
}
if ($total>0) {
-
print ' '.$langs->trans("Total")." ".price($total)." ";
}
print "
";
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 968607ed660..6fdd1e36feb 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1080,7 +1080,6 @@ if (empty($reshook))
}
if (! $error) {
-
if (empty($user->rights->margins->creer))
{
foreach ($object->lines as &$line)
@@ -1924,7 +1923,7 @@ if ($action == 'create' && $usercancreate)
// Confirmation of validation
if ($action == 'validate')
{
- // on verifie si l'objet est en numerotation provisoire
+ // We check that object has a temporary ref
$ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') {
$numref = $object->getNextNumRef($soc);
@@ -2543,19 +2542,19 @@ if ($action == 'create' && $usercancreate)
// Send
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($usercansend) {
- print '';
+ print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ' ';
} else
- print '';
+ print '' . $langs->trans('SendMail') . ' ';
}
// Valid
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && $usercanvalidate)
{
- print '';
+ print 'id . '&action=validate">' . $langs->trans('Validate') . ' ';
}
// Edit
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
- print '';
+ print '' . $langs->trans('Modify') . ' ';
}
// Create event
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
@@ -2572,9 +2571,9 @@ if ($action == 'create' && $usercancreate)
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
if ($user->rights->ficheinter->creer) {
- print '';
+ print '' . $langs->trans('AddIntervention') . ' ';
} else {
- print '';
+ print '' . $langs->trans('AddIntervention') . ' ';
}
}
}
@@ -2584,7 +2583,7 @@ if ($action == 'create' && $usercancreate)
$langs->load("contracts");
if ($user->rights->contrat->creer) {
- print '';
+ print '' . $langs->trans('AddContract') . ' ';
}
}
@@ -2596,13 +2595,13 @@ if ($action == 'create' && $usercancreate)
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) {
if ($user->rights->expedition->creer) {
- print '';
+ print '' . $langs->trans('CreateShipment') . ' ';
} else {
- print '';
+ print '' . $langs->trans('CreateShipment') . ' ';
}
} else {
$langs->load("errors");
- print '';
+ print 'transnoentitiesnoconv("Shipment"))) . '">' . $langs->trans('CreateShipment') . ' ';
}
}
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 16d9dcdc3d8..6fe2104556b 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -647,7 +647,7 @@ class Commande extends CommonOrder
$now=dol_now();
- $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' SET fk_statut = '.self::STATUS_CLOSED.',';
$sql.= ' fk_user_cloture = '.$user->id.',';
$sql.= " date_cloture = '".$this->db->idate($now)."'";
@@ -2842,7 +2842,6 @@ class Commande extends CommonOrder
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
if ($this->db->query($sql))
{
-
if (! $error)
{
$this->oldcopy= clone $this;
@@ -2974,7 +2973,6 @@ class Commande extends CommonOrder
if ($this->statut == Commande::STATUS_DRAFT)
{
-
// Clean parameters
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
@@ -3830,7 +3828,6 @@ class Commande extends CommonOrder
$langs->load("orders");
if (! dol_strlen($modele)) {
-
$modele = 'einstein';
if ($this->modelpdf) {
diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php
index 33630de2acd..2149c48121b 100644
--- a/htdocs/commande/index.php
+++ b/htdocs/commande/index.php
@@ -201,7 +201,6 @@ if (! empty($conf->commande->enabled))
$var = true;
while ($i < $num)
{
-
$obj = $db->fetch_object($resql);
$commandestatic->id=$obj->rowid;
@@ -225,7 +224,6 @@ if (! empty($conf->commande->enabled))
}
else
{
-
print ''.$langs->trans("NoOrder").' ';
}
print "
";
@@ -272,7 +270,6 @@ if ($resql)
$var = true;
while ($i < $num)
{
-
$obj = $db->fetch_object($resql);
print '';
@@ -353,7 +350,6 @@ if (! empty($conf->commande->enabled))
$var = true;
while ($i < $num)
{
-
$obj = $db->fetch_object($resql);
print ' ';
print '';
@@ -435,7 +431,6 @@ if (! empty($conf->commande->enabled))
$var = true;
while ($i < $num)
{
-
$obj = $db->fetch_object($resql);
print ' ';
print '';
diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php
index 17ea98e1eef..583d7426757 100644
--- a/htdocs/compta/accounting-files.php
+++ b/htdocs/compta/accounting-files.php
@@ -92,7 +92,6 @@ $entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity;
$filesarray=array();
$result=false;
if (($action=="searchfiles" || $action=="dl" )) {
-
if (empty($date_start))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart")), null, 'errors');
diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php
index 7dede991eca..b82cee983f9 100644
--- a/htdocs/compta/bank/annuel.php
+++ b/htdocs/compta/bank/annuel.php
@@ -202,7 +202,6 @@ print ' ';
for ($mois = 1 ; $mois < 13 ; $mois++)
{
-
print '';
print "".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")." ";
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 1b0f7feffe4..61278b9b9f5 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -473,7 +473,9 @@ $sql.= " ba.rowid as bankid, ba.ref as bankref,";
$sql.= " bu.url_id,";
$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
// Add fields from extrafields
-foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -1275,19 +1277,15 @@ if ($resql)
}
elseif ($links[$key]['type']=='company')
{
-
}
elseif ($links[$key]['type']=='user')
{
-
}
elseif ($links[$key]['type']=='member')
{
-
}
elseif ($links[$key]['type']=='sc')
{
-
}
else
{
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index fd5a2b42723..fb6d723ad7e 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -627,7 +627,7 @@ else
$conciliate=$object->canBeConciliated();
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
- else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
+ else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").') '));
print ' ';
print ''.$langs->trans("BalanceMinimalAllowed").' ';
@@ -691,7 +691,6 @@ else
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT)
{
-
print '
';
print '';
diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php
index c4b127d02c9..683f04bc84c 100644
--- a/htdocs/compta/bank/categ.php
+++ b/htdocs/compta/bank/categ.php
@@ -59,10 +59,8 @@ if ($categid) {
$bankcateg = new BankCateg($db);
if ($bankcateg->fetch($categid) > 0) {
-
//Update category
if (GETPOST('update') && $label) {
-
$bankcateg->label = $label;
$bankcateg->update($user);
}
@@ -103,7 +101,6 @@ print "\n";
// Line to add category
if ($action != 'edit')
{
-
print '';
print ' ';
print ' ';
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 4e72c6312e6..5cd3902b7d1 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -265,7 +265,6 @@ class Account extends CommonObject
$string = '';
foreach ($this->getFieldsToShow() as $val) {
-
if ($val == 'BankCode') {
$string .= $this->code_banque.' ';
} elseif ($val == 'BankAccountNumber') {
@@ -493,7 +492,6 @@ class Account extends CommonObject
}
if ($accline->insert() > 0) {
-
if ($categorie>0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (";
$sql .= "lineid, fk_categ";
diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php
index 0d517a43fec..32bfe66f7d1 100644
--- a/htdocs/compta/bank/document.php
+++ b/htdocs/compta/bank/document.php
@@ -97,7 +97,6 @@ $form = new Form($db);
if ($id > 0 || !empty($ref)) {
if ($object->fetch($id, $ref)) {
-
$upload_dir = $conf->bank->dir_output . '/' . $object->ref;
// Onglets
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 8f87d6f7151..6a143d4a8d1 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -73,7 +73,7 @@ $hookmanager->initHooks(array('bankaccountlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('bank_account');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
@@ -144,7 +144,9 @@ $accounts = array();
$sql = "SELECT b.rowid, b.label, b.courant, b.rappro, b.account_number, b.fk_accountancy_journal, b.currency_code, b.datec as date_creation, b.tms as date_update";
// Add fields from extrafields
-foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -514,7 +516,10 @@ foreach ($accounts as $key=>$type)
}
}
}
- else print $langs->trans("FeatureDisabled");
+ else
+ {
+ print ''.$langs->trans("FeatureDisabled").' ';
+ }
print '';
if (! $i) $totalarray['nbfield']++;
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 9467cebde59..f264bb074b3 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1822,7 +1822,6 @@ if (empty($reshook))
}
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
-
$ret = $object->fetch($id);
if ($ret < 0) {
dol_print_error($db, $object->error);
@@ -2327,7 +2326,6 @@ if (empty($reshook))
// Change each progression persent on each lines
foreach($object->lines as $line)
{
-
// no traitement for special product
if ($line->product_type == 9 ) continue;
@@ -3185,7 +3183,6 @@ if ($action == 'create')
if (! empty($conf->global->INVOICE_USE_SITUATION))
{
if($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY){
-
$rwStyle = 'display:none;';
if(GETPOST('type', 'int') == Facture::TYPE_SITUATION){
$rwStyle = '';
@@ -3844,20 +3841,23 @@ elseif ($id > 0 || ! empty($ref))
// Type
print ' ' . $langs->trans('Type') . ' ';
print $object->getLibType();
+ if ($object->module_source) {
+ print ' ('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.') ';
+ }
if ($object->type == Facture::TYPE_REPLACEMENT) {
$facreplaced = new Facture($db);
$facreplaced->fetch($object->fk_facture_source);
- print ' (' . $langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)) . ')';
+ print ' (' . $langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)) . ') ';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($object->fk_facture_source)) {
$facusing = new Facture($db);
$facusing->fetch($object->fk_facture_source);
- print ' (' . $langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)) . ')';
+ print ' (' . $langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)) . ') ';
}
$facidavoir = $object->getListIdAvoirFromInvoice();
if (count($facidavoir) > 0) {
- print ' (' . $langs->transnoentities("InvoiceHasAvoir");
+ print ' (' . $langs->transnoentities("InvoiceHasAvoir");
$i = 0;
foreach ($facidavoir as $id) {
if ($i == 0)
@@ -3868,19 +3868,19 @@ elseif ($id > 0 || ! empty($ref))
$facavoir->fetch($id);
print $facavoir->getNomUrl(1);
}
- print ')';
+ print ') ';
}
if ($objectidnext > 0) {
$facthatreplace = new Facture($db);
$facthatreplace->fetch($objectidnext);
- print ' (' . $langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)) . ')';
+ print ' (' . $langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)) . ') ';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
$discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id);
if ($result > 0){
- print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).' ';
+ print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).' ';
}
}
@@ -3888,7 +3888,7 @@ elseif ($id > 0 || ! empty($ref))
{
$tmptemplate = new FactureRec($db);
$result = $tmptemplate->fetch($object->fk_fac_rec_source);
- if ($result > 0) print '. '.$langs->trans("GeneratedFromTemplate", $tmptemplate->ref);
+ if ($result > 0) print '. '.$langs->trans("GeneratedFromTemplate", $tmptemplate->ref).' ';
}
print ' ';
@@ -4347,7 +4347,6 @@ elseif ($id > 0 || ! empty($ref))
// List of previous situation invoices
if (($object->situation_cycle_ref > 0) && ! empty($conf->global->INVOICE_USE_SITUATION))
{
-
print '';
@@ -4660,7 +4659,6 @@ elseif ($id > 0 || ! empty($ref))
// Retained warranty : usualy use on construction industry
if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){
-
// Billed - retained warranty
if($object->type == Facture::TYPE_SITUATION)
{
@@ -4845,20 +4843,20 @@ elseif ($id > 0 || ! empty($ref))
{
if ($usercanunvalidate)
{
- print '';
+ print '' . $langs->trans('Modify') . ' ';
} else {
- print '' . $langs->trans('Modify') . '
';
+ print '' . $langs->trans('Modify') . ' ';
}
} elseif (!$object->is_last_in_cycle()) {
- print '' . $langs->trans('Modify') . '
';
+ print '' . $langs->trans('Modify') . ' ';
} else {
- print '' . $langs->trans('Modify') . '
';
+ print '' . $langs->trans('Modify') . ' ';
}
}
}
else
{
- print '' . $langs->trans('Modify') . '
';
+ print '' . $langs->trans('Modify') . ' ';
}
}
@@ -4874,9 +4872,9 @@ elseif ($id > 0 || ! empty($ref))
{
if ($object->close_code != 'replaced' || (! $objectidnext)) // Not replaced by another invoice or replaced but the replacement invoice has been deleted
{
- print '';
+ print '' . $langs->trans('ReOpen') . ' ';
} else {
- print '' . $langs->trans('ReOpen') . '
';
+ print '' . $langs->trans('ReOpen') . ' ';
}
}
@@ -4884,19 +4882,19 @@ elseif ($id > 0 || ! empty($ref))
if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
if ($usercanvalidate)
{
- print '';
+ print 'id . '&action=valid">' . $langs->trans('Validate') . ' ';
}
}
// Send by mail
if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($objectidnext) {
- print '' . $langs->trans('SendMail') . '
';
+ print '' . $langs->trans('SendMail') . ' ';
} else {
if ($usercansend) {
- print '';
+ print '' . $langs->trans('SendMail') . ' ';
} else
- print '';
+ print '' . $langs->trans('SendMail') . ' ';
}
}
@@ -4911,7 +4909,7 @@ elseif ($id > 0 || ! empty($ref))
{
print ''.$langs->trans("MakeWithdrawRequest").' ';
} else {
- print '' . $langs->trans('MakeWithdrawRequest') . '
';
+ print '' . $langs->trans('MakeWithdrawRequest') . ' ';
}
}
else
@@ -4930,18 +4928,18 @@ elseif ($id > 0 || ! empty($ref))
{
$langs->load("cashdesk");
$receipt_url=DOL_URL_ROOT."/takepos/receipt.php";
- print '';
+ print '' . $langs->trans('POSTicket') .' ';
}
// Create payment
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercanissuepayment) {
if ($objectidnext) {
- print '' . $langs->trans('DoPayment') . '
';
+ print '' . $langs->trans('DoPayment') . ' ';
} else {
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
// print '' . $langs->trans('DoPayment') . '
';
//} else {
- print '';
+ print '' . $langs->trans('DoPayment') . ' ';
//}
}
}
@@ -4953,27 +4951,27 @@ elseif ($id > 0 || ! empty($ref))
{
if ($resteapayer == 0)
{
- print ''.$langs->trans('DoPaymentBack').'
';
+ print ''.$langs->trans('DoPaymentBack').' ';
}
else
{
- print '';
+ print ''.$langs->trans('DoPaymentBack').' ';
}
}
// For standard invoice with excess received
if ($object->type == Facture::TYPE_STANDARD && empty($object->paye) && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) < 0 && $usercancreate && empty($discount->id))
{
- print '';
+ print 'id.'&action=converttoreduc">'.$langs->trans('ConvertExcessReceivedToReduc').' ';
}
// For credit note
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate && $object->getSommePaiement() == 0) {
- print '';
+ print 'id . '&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">' . $langs->trans('ConvertToReduc') . ' ';
}
// For deposit invoice
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > 0 && empty($discount->id))
{
- print '';
+ print 'id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').' ';
}
}
@@ -4982,7 +4980,7 @@ elseif ($id > 0 || ! empty($ref))
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))
)
{
- print '';
+ print ''.$langs->trans('ClassifyPaid').' ';
}
// Classify 'closed not completely paid' (possible si validee et pas encore classee payee)
@@ -4992,7 +4990,7 @@ elseif ($id > 0 || ! empty($ref))
if ($totalpaye > 0 || $totalcreditnotes > 0)
{
// If one payment or one credit note was linked to this invoice
- print '';
+ print '' . $langs->trans('ClassifyPaidPartially') . ' ';
}
else
{
@@ -5000,11 +4998,11 @@ elseif ($id > 0 || ! empty($ref))
{
if ($objectidnext)
{
- print '' . $langs->trans('ClassifyCanceled') . '
';
+ print '' . $langs->trans('ClassifyCanceled') . ' ';
}
else
{
- print '';
+ print '' . $langs->trans('ClassifyCanceled') . ' ';
}
}
}
@@ -5013,7 +5011,7 @@ elseif ($id > 0 || ! empty($ref))
// Clone
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
{
- print '';
+ print '' . $langs->trans("ToClone") . ' ';
}
// Clone as predefined / Create template
@@ -5021,7 +5019,7 @@ elseif ($id > 0 || ! empty($ref))
{
if (! $objectidnext && count($object->lines) > 0)
{
- print '';
+ print '' . $langs->trans("ChangeIntoRepeatableInvoice") . ' ';
}
}
@@ -5030,7 +5028,7 @@ elseif ($id > 0 || ! empty($ref))
{
if (! $objectidnext)
{
- print '';
+ print '' . $langs->trans("CreateCreditNote") . ' ';
}
}
@@ -5045,9 +5043,9 @@ elseif ($id > 0 || ! empty($ref))
{
if ($usercanunvalidate)
{
- print '';
+ print '' . $langs->trans("CreateCreditNote") . ' ';
} else {
- print '' . $langs->trans("CreateCreditNote") . '
';
+ print '' . $langs->trans("CreateCreditNote") . ' ';
}
}
@@ -5063,22 +5061,22 @@ elseif ($id > 0 || ! empty($ref))
{
if(($object->total_ttc - $totalcreditnotes ) == 0 )
{
- print '';
+ print '' . $langs->trans("RemoveSituationFromCycle") . ' ';
}
else
{
- print '';
+ print '' . $langs->trans("RemoveSituationFromCycle") . ' ';
}
}
// Create next situation invoice
if ($usercancreate && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
if ($object->is_last_in_cycle() && $object->situation_final != 1) {
- print '';
+ print '' . $langs->trans('CreateNextSituationInvoice') . ' ';
} elseif (!$object->is_last_in_cycle()) {
- print '';
+ print '' . $langs->trans('CreateNextSituationInvoice') . ' ';
} else {
- print '';
+ print '' . $langs->trans('CreateNextSituationInvoice') . ' ';
}
}
@@ -5088,31 +5086,31 @@ elseif ($id > 0 || ! empty($ref))
{
//var_dump($isErasable);
if ($isErasable == -4) {
- print '';
+ print '' . $langs->trans('Delete') . ' ';
}
elseif ($isErasable == -3) {
- print '';
+ print '' . $langs->trans('Delete') . ' ';
}
elseif ($isErasable == -2) {
- print '';
+ print '' . $langs->trans('Delete') . ' ';
}
elseif ($isErasable == -1) {
- print '';
+ print '' . $langs->trans('Delete') . ' ';
}
elseif ($isErasable <= 0) // Any other cases
{
- print '';
+ print '' . $langs->trans('Delete') . ' ';
}
elseif ($objectidnext)
{
- print '';
+ print '' . $langs->trans('Delete') . ' ';
}
else
{
- print '';
+ print 'id . '&action=delete">' . $langs->trans('Delete') . ' ';
}
} else {
- print '';
+ print '' . $langs->trans('Delete') . ' ';
}
}
print '';
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 18d153dc597..9ff90b7b025 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -1839,7 +1839,6 @@ class FactureLigneRec extends CommonInvoiceLine
$result = $this->db->query($sql);
if ($result)
{
-
$objp = $this->db->fetch_object($result);
$this->id = $objp->rowid;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 6149a161694..84835fa9608 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -848,7 +848,6 @@ class Facture extends CommonInvoice
if (! $error)
{
-
$result=$this->update_price(1);
if ($result > 0)
{
@@ -1933,7 +1932,6 @@ class Facture extends CommonInvoice
if (! $error)
{
-
$this->ref_client = $ref_client;
$this->db->commit();
@@ -3465,7 +3463,6 @@ class Facture extends CommonInvoice
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
-
$dir = dol_buildpath($reldir."core/modules/facture/");
// Load file with numbering class (if found)
@@ -5216,7 +5213,6 @@ class FactureLigne extends CommonInvoiceLine
$returnPercent = floatval($res['situation_percent']);
if($include_credit_note) {
-
$sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd';
$sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) ';
$sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id;
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 77abac6e4d1..4642c0b7da1 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -175,15 +175,15 @@ $arrayfields=array(
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>75),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>80),
'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1, 'position'=>85),
- 'f.module_source'=>array('label'=>"Module", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>90),
- 'f.pos_source'=>array('label'=>"Terminal", 'checked'=>0, 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>91),
+ 'f.module_source'=>array('label'=>"Module", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>90),
+ 'f.pos_source'=>array('label'=>"Terminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>($conf->cashdesk->enabled || $conf->takepos->enabled || $conf->global->INVOICE_SHOW_POS), 'position'=>91),
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>95),
'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>100),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1"), 'position'=>110),
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1"), 'position'=>120),
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130),
'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140),
- 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150),
+ 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
@@ -356,7 +356,6 @@ if ($massaction == 'withdrawrequest')
}
else
{
-
$db->rollback();
setEventMessages($aBill->error, $aBill->errors, 'errors');
}
diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php
index 86388fd7e87..e7762b834e4 100644
--- a/htdocs/compta/localtax/card.php
+++ b/htdocs/compta/localtax/card.php
@@ -61,7 +61,6 @@ if ($_POST["cancel"] == $langs->trans("Cancel") && ! $id)
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
-
$db->begin();
$datev=dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php
index 1e6ab5b4da1..97f97bbc735 100644
--- a/htdocs/compta/localtax/clients.php
+++ b/htdocs/compta/localtax/clients.php
@@ -195,7 +195,6 @@ if($calc ==0 || $calc == 2)
{
if(($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) !=0)
{
-
$intra = str_replace($find, $replace, $coll->tva_intra);
if(empty($intra))
{
@@ -269,7 +268,6 @@ if($calc ==0 || $calc == 1){
{
if(($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) != 0)
{
-
$intra = str_replace($find, $replace, $coll->tva_intra);
if(empty($intra))
{
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index 9ab469376e5..3afce69e94b 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -444,7 +444,6 @@ if ($action == 'new')
foreach ($accounts as $bid => $account_label)
{
-
print '
';
-
+ // set cookie by js
+ $boxcontent.='';
+ $this->info_box_contents[0][] = array(
+ 'tr'=>'class="nohover"',
+ 'td' => 'class="nohover"',
+ 'textnoformat' => $boxcontent,
+ );
$sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
@@ -163,11 +169,10 @@ class box_task extends ModeleBoxes
$sql.= $this->db->plimit($max, 0);
$result = $this->db->query($sql);
- $i = 0;
+ $i = 1;
if ($result) {
$num = $this->db->num_rows($result);
while ($objp = $this->db->fetch_object($result)) {
-
$taskstatic->id=$objp->rowid;
$taskstatic->ref=$objp->ref;
$taskstatic->label=$objp->label;
@@ -183,24 +188,18 @@ 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, true);
+ $this->info_box_contents[$i][] = array(
+ 'td' => '',
+ 'text' => $boxcontent,
+ );
$i++;
}
} else {
dol_print_error($this->db);
}
}
-
- // set cookie by js
- if(empty($i)){
- $boxcontent.='';
- }
-
- $this->info_box_contents[0][] = array(
- 'td' => '',
- 'text' => $boxcontent,
- );
}
/**
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index aafebd7b99f..5f8c630e46a 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -1392,7 +1392,6 @@ class CMailFile
$i=0;
foreach ($matches[1] as $full)
{
-
if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i', $full, $regs)) // If xxx is 'file=aaa'
{
$img = $regs[1];
diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php
index 60a5d9519a4..a02f00fbac9 100644
--- a/htdocs/core/class/CSMSFile.class.php
+++ b/htdocs/core/class/CSMSFile.class.php
@@ -112,7 +112,6 @@ class CSMSFile
if (empty($conf->global->MAIN_DISABLE_ALL_SMS))
{
-
// Action according to choosed sending method
if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') // Backward compatibility @deprecated
{
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index c99f78c3483..ee5b97c502a 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -1103,7 +1103,6 @@ abstract class CommonDocGenerator
global $hookmanager;
foreach ($this->cols as $colKey => $colDef) {
-
$parameters = array(
'colKey' => $colKey,
'pdf' => $pdf,
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index b9a4479367e..9625d31fc77 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -885,7 +885,6 @@ abstract class CommonObject
}
if(!$already_added) {
-
$this->db->begin();
// Insert into database
@@ -5984,7 +5983,6 @@ abstract class CommonObject
$sql = 'SELECT ' . $keyList;
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
if (! empty($InfoFieldList[4])) {
-
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
$InfoFieldList[4]=str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
@@ -6440,7 +6438,6 @@ abstract class CommonObject
$value = ''; // value was used, so now we reste it to use it to build final output
$toprint=array();
while ( $obj = $this->db->fetch_object($resql) ) {
-
// Several field into label (eq table:code|libelle:rowid)
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
@@ -6966,7 +6963,6 @@ abstract class CommonObject
$viewfilename = $file;
if ($size == 1 || $size == 'small') { // Format vignette
-
// Find name of thumb file
$photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small'));
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
@@ -7406,7 +7402,7 @@ abstract class CommonObject
if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref']=dol_string_nospecial($fieldvalues['ref']); // If field is a ref,we sanitize data
-
+
$keys=array();
$values = array();
foreach ($fieldvalues as $k => $v) {
@@ -7864,6 +7860,57 @@ abstract class CommonObject
}
}
+
+ /**
+ * Set draft status
+ *
+ * @param User $user Object user that modify
+ * @param int $status New status to set (often a constant like self::STATUS_XXX)
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @param string $triggercode Trigger code to use
+ * @return int <0 if KO, >0 if OK
+ */
+ public function setStatusCommon($user, $status, $notrigger = 0, $triggercode = '')
+ {
+ $error=0;
+
+ $this->db->begin();
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+ $sql.= " SET status = ".$status;
+ $sql.= " WHERE rowid = ".$this->id;
+
+ if ($this->db->query($sql))
+ {
+ if (! $error)
+ {
+ $this->oldcopy= clone $this;
+ }
+
+ if (! $error && ! $notrigger) {
+ // Call trigger
+ $result=$this->call_trigger($triggercode, $user);
+ if ($result < 0) $error++;
+ }
+
+ if (!$error) {
+ $this->status = $status;
+ $this->db->commit();
+ return 1;
+ } else {
+ $this->db->rollback();
+ return -1;
+ }
+ }
+ else
+ {
+ $this->error=$this->db->error();
+ $this->db->rollback();
+ return -1;
+ }
+ }
+
+
/**
* Initialise object with example values
* Id must be 0 if object instance is a specimen
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 287d8121213..72aa4bc4265 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -227,7 +227,7 @@ class Conf
$filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
foreach ($filesList as $file) {
$file=dol_sanitizeFileName($file);
- include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; // This file must set $this->global->XXX vars.
+ include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php"; // This file can run code like setting $this->global->XXX vars.
}
}
diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php
index e03aa8c6992..ab1448bc412 100644
--- a/htdocs/core/class/discount.class.php
+++ b/htdocs/core/class/discount.class.php
@@ -369,7 +369,6 @@ class DiscountAbsolute
}
}
elseif($this->fk_invoice_supplier_source) {
-
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
$sql.=" set paye=0, fk_statut=1";
$sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_invoice_supplier_source;
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index e465742cfef..f59aaab7bfa 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1404,7 +1404,6 @@ class ExtraFields
$sql = 'SELECT ' . $keyList;
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
if (!empty($InfoFieldList[4])) {
-
// can use SELECT request
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
$InfoFieldList[4] = str_replace('$SEL$', 'SELECT', $InfoFieldList[4]);
@@ -1813,7 +1812,6 @@ class ExtraFields
$value = ''; // value was used, so now we reste it to use it to build final output
$toprint=array();
while ( $obj = $this->db->fetch_object($resql) ) {
-
// Several field into label (eq table:code|libelle:rowid)
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index d9442e43457..e6a6a077cf8 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3913,7 +3913,6 @@ class Form
if ($nbaccountfound > 0) print ' ';
print '';
} else {
-
$langs->load('banks');
if ($selected) {
@@ -5323,7 +5322,7 @@ class Form
* @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
* @param string $form_name Not used
* @param int $d 1=Show days, month, years
- * @param int $addnowlink Add a link "Now"
+ * @param int $addnowlink Add a link "Now", 1 with server time, 2 with local computer time
* @param int $disabled Disable input fields
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
@@ -5605,12 +5604,32 @@ class Form
{
// Script which will be inserted in the onClick of the "Now" link
$reset_scripts = "";
-
+ if ($addnowlink==2) // local computer time
+ {
+ // pad add leading 0 on numbers
+ $reset_scripts.="Number.prototype.pad = function(size) {
+ var s = String(this);
+ while (s.length < (size || 2)) {s = '0' + s;}
+ return s;
+ };
+ var d = new Date();";
+ }
+
// Generate the date part, depending on the use or not of the javascript calendar
- $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day').'\');';
- $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d').'\');';
- $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m').'\');';
- $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y').'\');';
+ if($addnowlink==1) // server time expressed in user time setup
+ {
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
+ }
+ elseif($addnowlink==2)
+ {
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));';
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(d.getDate().pad());';
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(d.getMonth().pad());';
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
+ }
/*if ($usecalendar == "eldy")
{
$base=DOL_URL_ROOT.'/core/';
@@ -5627,7 +5646,15 @@ class Form
{
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
- $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H').'\');';
+ if($addnowlink==1)
+ {
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');';
+ }
+ elseif($addnowlink==2)
+ {
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
+ }
+
if ($fullday) $reset_scripts .= ' } ';
}
// Update the minute part
@@ -5635,7 +5662,14 @@ class Form
{
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
- $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M').'\');';
+ if($addnowlink==1)
+ {
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');';
+ }
+ elseif($addnowlink==2)
+ {
+ $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
+ }
if ($fullday) $reset_scripts .= ' } ';
}
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php
index 177f2f0cc61..42fec36ef6a 100644
--- a/htdocs/core/class/html.formcron.class.php
+++ b/htdocs/core/class/html.formcron.class.php
@@ -77,7 +77,6 @@ class FormCron extends Form
$out.='';
}
} else {
-
$out=' ';
if ($selected=='command') {
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 48db977255f..24242485339 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -463,7 +463,6 @@ class FormOther
{
while ($obj_usr = $this->db->fetch_object($resql_usr))
{
-
$out.='rowid == $selected) $out.=' selected';
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 8d0c45bbb41..b83da89e277 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -67,6 +67,7 @@ class FormTicket
public $withsubstit;
public $withfile;
+ public $withfilereadonly;
public $ispublic; // To show information or not into public form
@@ -74,7 +75,7 @@ class FormTicket
public $withcompany; // affiche liste déroulante company
public $withfromsocid;
public $withfromcontactid;
- public $withnotnotifytiersatcreate;
+ public $withnotifytiersatcreate;
public $withusercreate; // Show name of creating user in form
public $withcreatereadonly;
@@ -111,7 +112,7 @@ class FormTicket
$this->withfromcontactid = 0;
//$this->withthreadid=0;
//$this->withtitletopic='';
- $this->withnotnotifytiersatcreate = 0;
+ $this->withnotifytiersatcreate = 0;
$this->withusercreate = 1;
$this->withcreatereadonly = 1;
$this->withemail = 0;
@@ -374,7 +375,7 @@ class FormTicket
$listofmimes = explode(';', $_SESSION["listofmimes"]);
}
- $out .= '';
+ $out = ' ';
$out .= '' . $langs->trans("MailFile") . ' ';
$out .= '';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
@@ -409,7 +410,8 @@ class FormTicket
}
// Other attributes
- $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $action); // Note that $action and $object may have been modified by hook
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
print $ticketstat->showOptionals($extrafields, 'edit');
@@ -504,23 +506,18 @@ class FormTicket
}
print '>';
+ $value = ' ';
if ($format == 0) {
$value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
- }
-
- if ($format == 1) {
+ } elseif ($format == 1) {
$value = $arraytypes['code'];
- }
-
- if ($format == 2) {
+ } elseif ($format == 2) {
$value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
- }
-
- if ($format == 3) {
+ } elseif ($format == 3) {
$value = $arraytypes['code'];
}
- print $value ? $value : ' ';
+ print $value;
print '';
}
}
diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index a187e58cac1..4ff061933e9 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -128,7 +128,6 @@ class InfoBox
if (! in_array($obj->box_id, $excludelist))
{
-
if (preg_match('/^([^@]+)@([^@]+)$/i', $obj->file, $regs))
{
$boxname = preg_replace('/\.php$/i', '', $regs[1]);
diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php
index a70605612fe..cdc5b283c44 100644
--- a/htdocs/core/class/link.class.php
+++ b/htdocs/core/class/link.class.php
@@ -135,7 +135,6 @@ class Link extends CommonObject
{
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
-
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists", $this->name);
$result=-1;
}
diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php
index fd7b769096f..cb4e7ef9e5a 100644
--- a/htdocs/core/class/utils.class.php
+++ b/htdocs/core/class/utils.class.php
@@ -819,7 +819,6 @@ class Utils
$tabfiles[] = array('name' => $mainlog, 'path' => $mainlogdir);
foreach($tabfiles as $file) {
-
$logname = $file['name'];
$logpath = $file['path'];
diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php
index a20e033ab19..2230bfac5a1 100644
--- a/htdocs/core/lib/bank.lib.php
+++ b/htdocs/core/lib/bank.lib.php
@@ -276,7 +276,6 @@ function checkBanForAccount($account)
}
if ($country_code == 'BE') { // Belgium rules
-
}
if ($country_code == 'ES') { // Spanish rules
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 513f63d5f06..caa0915b91a 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -144,7 +144,6 @@ function getBrowserInfo($user_agent)
$tablet = $detectmobile->isTablet();
if ($detectmobile->isMobile()) {
-
$phone = 'unknown';
// If phone/smartphone, we set phone os name.
@@ -1893,7 +1892,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
/**
- * Return an array with locale date info.
+ * Return an array with locale date info.
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
* WARNING: This function always use PHP server timezone to return locale informations !!!
* Usage must be avoid.
@@ -2039,9 +2038,9 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $
/**
- * Return date for now. In most cases, we use this function without parameters (that means GMT time).
+ * Return date for now. In most cases, we use this function without parameters (that means GMT time).
*
- * @param string $mode 'gmt' => we return GMT timestamp,
+ * @param string $mode 'gmt' => we return GMT timestamp,
* 'tzserver' => we add the PHP server timezone
* 'tzref' => we add the company timezone
* 'tzuser' => we add the user timezone
@@ -2245,9 +2244,9 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
if (! empty($type))
{
- $htmllink ='';
- $htmllink.=img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright');
- $htmllink.=$value;
+ $htmllink = '
';
+ $htmllink .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
+ $htmllink .= $value;
if ($type == 'skype')
{
$htmllink.= ' ';
@@ -2263,7 +2262,8 @@ function dol_print_socialnetworks($value, $cid, $socid, $type)
}
if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type=='skype')
{
- $addlink='AC_SKYPE'; $link='';
+ $addlink='AC_SKYPE';
+ $link='';
if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link='
'.img_object($langs->trans("AddAction"), "calendar").' ';
$htmllink.=($link?' '.$link:'');
}
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index c2c3528c869..6543b659a88 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -1722,7 +1722,6 @@ function is_ip($ip)
{
// First we test if it is a valid IPv4
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
-
// Then we test if it is a private range
if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) return 2;
diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php
index dd8d1a4a944..5eb45b261a0 100644
--- a/htdocs/core/lib/json.lib.php
+++ b/htdocs/core/lib/json.lib.php
@@ -118,7 +118,6 @@ function _val($val)
* escaping with a slash or encoding to UTF-8 where necessary
*/
for ($c = 0; $c < $strlen_var; ++$c) {
-
$ord_var_c = ord($val[$c]);
switch (true) {
diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php
index 3f1baa72e8a..01ebdd277e1 100644
--- a/htdocs/core/lib/ldap.lib.php
+++ b/htdocs/core/lib/ldap.lib.php
@@ -163,7 +163,6 @@ function show_ldap_content($result, $level, $count, $var, $hide = 0, $subcount =
$hide=0;
if (! is_numeric($key))
{
-
print '
';
print '';
print $key;
diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php
index fff750c167b..e6f36b25d47 100644
--- a/htdocs/core/lib/modulebuilder.lib.php
+++ b/htdocs/core/lib/modulebuilder.lib.php
@@ -123,7 +123,6 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
if (count($object->fields))
{
-
foreach($object->fields as $key => $val)
{
$i++;
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index d16fc569961..609201dd0c3 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -240,14 +240,18 @@ function pdf_getPDFFont($outputlangs)
*/
function pdf_getPDFFontSize($outputlangs)
{
+ global $conf;
+
$size=10; // By default, for FPDI or ISO language on TCPDF
- if (class_exists('TCPDF')) // If TCPDF on, we can use an UTF8 one like DejaVuSans if required (slower)
+ if (class_exists('TCPDF')) // If TCPDF on, we can use an UTF8 font like DejaVuSans if required (slower)
{
- if ($outputlangs->trans('FONTSIZEFORPDF')!='FONTSIZEFORPDF')
+ if ($outputlangs->trans('FONTSIZEFORPDF') != 'FONTSIZEFORPDF')
{
$size = (int) $outputlangs->trans('FONTSIZEFORPDF');
}
}
+ if (! empty($conf->global->MAIN_PDF_FORCE_FONT_SIZE)) $size = $conf->global->MAIN_PDF_FORCE_FONT_SIZE;
+
return $size;
}
@@ -2238,7 +2242,6 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails =
}
else
{
-
if (is_object($hookmanager))
{
$special_code = $object->lines[$i]->special_code;
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 9c6e7901d34..170421cecfd 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -98,7 +98,6 @@ function product_prepare_head($object)
$h++;
if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
-
global $db;
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php
index 4d1bc5b3593..988c7a2d78c 100644
--- a/htdocs/core/lib/stock.lib.php
+++ b/htdocs/core/lib/stock.lib.php
@@ -29,7 +29,7 @@
*/
function stock_prepare_head($object)
{
- global $langs, $conf;
+ global $langs, $conf, $user;
$h = 0;
$head = array();
@@ -39,10 +39,13 @@ function stock_prepare_head($object)
$head[$h][2] = 'card';
$h++;
- $head[$h][0] = DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id;
- $head[$h][1] = $langs->trans("StockMovements");
- $head[$h][2] = 'movements';
- $h++;
+ if (!empty($user->rights->stock->mouvement->lire))
+ {
+ $head[$h][0] = DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id;
+ $head[$h][1] = $langs->trans("StockMovements");
+ $head[$h][2] = 'movements';
+ $h++;
+ }
/*
$head[$h][0] = DOL_URL_ROOT.'/product/stock/fiche-valo.php?id='.$object->id;
diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index 543bdb025fa..5ff41f97495 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -786,7 +786,6 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
// Contact for this action
if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
-
$contactList = '';
foreach ($histo[$key]['socpeopleassigned'] as $cid => $Tab) {
$contact = new Contact($db);
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index be5871bf6e3..7beadc9496b 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -638,8 +638,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// TextTitleColor for title of Pages
if ($foruserprofile)
{
-
-
}
else
{
@@ -665,8 +663,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// BackgroundTableTitleColor
if ($foruserprofile)
{
-
-
}
else
{
@@ -692,8 +688,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// TextTitleColor
if ($foruserprofile)
{
-
-
}
else
{
@@ -719,7 +713,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// BackgroundTableLineOddColor
if ($foruserprofile)
{
-
}
else
{
@@ -749,7 +742,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// BackgroundTableLineEvenColor
if ($foruserprofile)
{
-
}
else
{
@@ -1005,7 +997,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
else
{
-
}
print '
';
}
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 39e2150280e..5f27a68d63a 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -137,7 +137,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout
}
else
{
- $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png';
+ $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred_alpha.png';
}
$title=$langs->trans("GoIntoSetupToChangeLogo");
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 5d6bf501d82..380b6a22355 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -482,7 +482,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI);
$logoContainerAdditionalClass = 'backgroundforcompanylogo';
- if(!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)){
+ if(! empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)){
$logoContainerAdditionalClass = '';
}
@@ -496,7 +496,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
}*/
else
{
- $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png';
+ $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred_alpha.png';
+ $logoContainerAdditionalClass = '';
}
$title=$langs->trans("GoIntoSetupToChangeLogo");
@@ -1172,7 +1173,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Fiscal year - Not really yet used. In a future will lock some periods.
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
- $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear', 20);
+ $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20);
}
$newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30);
@@ -1290,12 +1291,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Accounting
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire, '', $mainmenu, 'accountancy', 1);
+
// General Ledger
$newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire);
// Balance
$newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire);
+ // Closure
+ if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
+ $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure');
+
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_closure/', $leftmenu)) {
+ $newmenu->add("/accountancy/closure/validate.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->fiscalyear->write);
+ }
+ }
+
// Files
if ((! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) || ! empty($conf->global->ACCOUNTANCY_SHOW_EXPORT_FILES_MENU))
{
@@ -1305,9 +1316,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Reports
$newmenu->add("/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
- if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
$newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire);
- $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire);
+ $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire);
$newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire);
}
diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php
index be6bd9f095d..eed79c037fd 100644
--- a/htdocs/core/modules/bom/mod_bom_advanced.php
+++ b/htdocs/core/modules/bom/mod_bom_advanced.php
@@ -118,11 +118,11 @@ class mod_bom_advanced extends ModeleNumRefboms
/**
* Return next free value
*
- * @param Societe $objsoc Object thirdparty
+ * @param Product $objprod Object product
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($objsoc, $object)
+ public function getNextValue($objprod, $object)
{
global $db,$conf;
@@ -139,7 +139,7 @@ class mod_bom_advanced extends ModeleNumRefboms
$date = ($object->date_bom ? $object->date_bom : $object->date);
- $numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', $objsoc, $date);
+ $numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date);
return $numFinal;
}
diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php
index af7e173bbae..eefbc7570c0 100644
--- a/htdocs/core/modules/bom/mod_bom_standard.php
+++ b/htdocs/core/modules/bom/mod_bom_standard.php
@@ -108,16 +108,16 @@ class mod_bom_standard extends ModeleNumRefboms
/**
* Return next free value
*
- * @param Societe $objsoc Object thirdparty
+ * @param Product $objprod Object product
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
- public function getNextValue($objsoc, $object)
+ public function getNextValue($objprod, $object)
{
global $db,$conf;
// D'abord on recupere la valeur max
- $posindice=8;
+ $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
@@ -137,7 +137,7 @@ class mod_bom_standard extends ModeleNumRefboms
}
//$date=time();
- $date=$object->date;
+ $date=$object->date_creation;
$yymm = strftime("%y%m", $date);
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
diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
index d2dd1f56218..badf7343295 100644
--- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php
+++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
@@ -269,7 +269,7 @@ class pdf_strato extends ModelePDFContract
$tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
- // Affiche notes
+ // Display notes
if (! empty($object->note_public))
{
$tab_top -= 2;
@@ -411,7 +411,7 @@ class pdf_strato extends ModelePDFContract
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
- $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
+ $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@@ -613,7 +613,7 @@ class pdf_strato extends ModelePDFContract
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->CONTRACT_DRAFT_WATERMARK);
}
- //Prepare la suite
+ //Prepare next
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
@@ -727,7 +727,7 @@ class pdf_strato extends ModelePDFContract
$this->recipient = $object->thirdparty;
//Recipient name
- // On peut utiliser le nom de la societe du contact
+ // You can use the name of the contact company
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
index 8d29edec7d8..21658ed32d0 100644
--- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
@@ -146,7 +146,7 @@ class pdf_espadon extends ModelePdfExpedition
/**
* Function to build pdf onto disk
*
- * @param Object $object Object expedition to generate (or id if old method)
+ * @param Object $object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@@ -218,7 +218,7 @@ class pdf_espadon extends ModelePdfExpedition
if ($conf->expedition->dir_output)
{
- // Definition de $dir et $file
+ // Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->expedition->dir_output."/sending";
@@ -370,7 +370,7 @@ class pdf_espadon extends ModelePdfExpedition
// Notes
if (! empty($object->note_public))
{
- $pdf->SetFont('', '', $default_font_size - 1); // Dans boucle pour gerer multi-page
+ $pdf->SetFont('', '', $default_font_size - 1); // In loop to manage multi-page
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1);
}
@@ -390,10 +390,10 @@ class pdf_espadon extends ModelePdfExpedition
}
- // Use new auto collum system
+ // Use new auto column system
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
- // Simulation de tableau pour connaitre la hauteur de la ligne de titre
+ // Table simulation to know the height of the title line
$pdf->startTransaction();
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
@@ -502,7 +502,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
- $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
+ $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
// weight
@@ -606,10 +606,10 @@ class pdf_espadon extends ModelePdfExpedition
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
- // Affiche zone totaux
+ // Display total area
$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
- // Pied de page
+ // Pagefoot
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
@@ -653,12 +653,12 @@ class pdf_espadon extends ModelePdfExpedition
/**
* Show total to pay
*
- * @param PDF $pdf Object PDF
+ * @param PDF $pdf Object PDF
* @param Facture $object Object invoice
- * @param int $deja_regle Montant deja regle
- * @param int $posy Position depart
+ * @param int $deja_regle Amount already paid
+ * @param int $posy Start Position
* @param Translate $outputlangs Objet langs
- * @return int Position pour suite
+ * @return int Position for suite
*/
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
@@ -673,7 +673,7 @@ class pdf_espadon extends ModelePdfExpedition
$tab2_hl = 4;
$pdf->SetFont('', 'B', $default_font_size - 1);
- // Tableau total
+ // Total table
$col1x = $this->posxweightvol-50; $col2x = $this->posxweightvol;
/*if ($this->page_largeur < 210) // To work with US executive format
{
@@ -824,7 +824,7 @@ class pdf_espadon extends ModelePdfExpedition
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SHIPPING_DRAFT_WATERMARK);
}
- //Prepare la suite
+ //Prepare next
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
@@ -1006,7 +1006,7 @@ class pdf_espadon extends ModelePdfExpedition
}
//Recipient name
- // On peut utiliser le nom de la societe du contact
+ // You can use the name of the contact company
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
index ad676dba22e..53f46ccc861 100644
--- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
@@ -174,20 +174,20 @@ class pdf_merou extends ModelePdfExpedition
$origin = $object->origin;
- //Creation de l expediteur
+ //Create sender
$this->expediteur = $mysoc;
- //Creation du destinataire
+ //Create recipient
$idcontact = $object->$origin->getIdContact('external', 'SHIPPING');
$this->destinataire = new Contact($this->db);
if (! empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]);
- //Creation du livreur
+ //Create deliverer
$idcontact = $object->$origin->getIdContact('internal', 'LIVREUR');
$this->livreur = new User($this->db);
if (! empty($idcontact[0])) $this->livreur->fetch($idcontact[0]);
- // Definition de $dir et $file
+ // Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->expedition->dir_output."/sending";
@@ -273,7 +273,7 @@ class pdf_merou extends ModelePdfExpedition
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter;
$tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter;
- // Affiche notes
+ // Display notes
if (! empty($object->note_public))
{
$pdf->SetFont('', '', $default_font_size - 1);
@@ -314,7 +314,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
- // Description de la ligne produit
+ // Description of product line
$libelleproduitservice = pdf_writelinedesc($pdf, $object, $i, $outputlangs, 90, 3, 50, $curY, 0, 1);
$nexY = $pdf->GetY();
@@ -335,7 +335,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->Rect(10+3, $curY, 3, 3);
$pdf->Rect(20+3, $curY, 3, 3);
- //Insertion de la reference du produit
+ //Inserting the product reference
$pdf->SetXY(30, $curY);
$pdf->SetFont('', 'B', $default_font_size - 3);
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0);
@@ -404,7 +404,7 @@ class pdf_merou extends ModelePdfExpedition
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
- // Pied de page
+ // Pagefoot
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
@@ -579,11 +579,11 @@ class pdf_merou extends ModelePdfExpedition
}
//*********************Entete****************************
- //Nom du Document
+ //Document name
$pdf->SetXY($Xoff, 7);
$pdf->SetFont('', 'B', $default_font_size + 2);
$pdf->SetTextColor(0, 0, 0);
- $pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Bordereau expedition
+ $pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Sending sheet
//Num Expedition
$Yoff = $Yoff+7;
$Xoff = 142;
@@ -601,7 +601,7 @@ class pdf_merou extends ModelePdfExpedition
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1, $hookmanager);
//$this->Code39($Xoff+43, $Yoff+1, $object->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
- //Definition Emplacement du bloc Societe
+ //Definition Location of the Company block
$Xoff = 110;
$blSocX=90;
$blSocY=24;
@@ -632,7 +632,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
}
- // Date Expedition
+ // Date delivery
$Yoff = $Yoff+7;
$pdf->SetXY($blSocX-80, $blSocY+17);
@@ -698,7 +698,7 @@ class pdf_merou extends ModelePdfExpedition
}
// Recipient name
- // On peut utiliser le nom de la societe du contact
+ // You can use the name of the contact company
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index 983c0c502ae..b180994b7e5 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -844,7 +844,6 @@ class pdf_rouget extends ModelePdfExpedition
}
if (!empty($conf->global->SHIPPING_PDF_DISPLAY_AMOUNT_HT)) {
-
$pdf->line($this->posxpuht-1, $tab_top, $this->posxpuht-1, $tab_top + $tab_height);
if (empty($hidetop))
{
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 1768a0b1950..4320c63f58b 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -149,7 +149,7 @@ class pdf_crabe extends ModelePDFFactures
$this->description = $langs->trans('PDFCrabeDescription');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
- // Dimensiont page
+ // Dimension page
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width'];
@@ -359,7 +359,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- // Positionne $this->atleastonediscount si on a au moins une remise
+ // Set $this->atleastonediscount if you have at least one discount
for ($i = 0 ; $i < $nblines ; $i++)
{
if ($object->lines[$i]->remise_percent)
@@ -428,7 +428,7 @@ class pdf_crabe extends ModelePDFFactures
}
}
- // Affiche notes
+ // Display notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
{
@@ -554,7 +554,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
- $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
+ $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
@@ -606,7 +606,7 @@ class pdf_crabe extends ModelePDFFactures
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
- // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
+ // Collection of totals by value of VAT in $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) // Compute progress from previous situation
{
@@ -712,19 +712,19 @@ class pdf_crabe extends ModelePDFFactures
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
- // Affiche zone infos
+ // Display info area
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
- // Affiche zone totaux
+ // Display total area
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
- // Affiche zone versements
+ // Display Payments area
if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
{
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs, $heightforfooter);
}
- // Pied de page
+ // Pagefoot
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
@@ -1046,7 +1046,7 @@ class pdf_crabe extends ModelePDFFactures
// Show payment mode CHQ
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
{
- // Si mode reglement non force ou si force a CHQ
+ // If unregulated or forced payment mode to CHQ
if (! empty($conf->global->FACTURE_CHQ_NUMBER))
{
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
@@ -1137,7 +1137,7 @@ class pdf_crabe extends ModelePDFFactures
$tab2_hl = 4;
$pdf->SetFont('', '', $default_font_size - 1);
- // Tableau total
+ // Total table
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 9e0fad32172..bf58ebb6e8e 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -574,7 +574,6 @@ class pdf_sponge extends ModelePDFFactures
$pagenb = $pageposbeforeprintlines;
for ($i = 0; $i < $nblines; $i++)
{
-
$curY = $nexY;
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);
@@ -1268,7 +1267,6 @@ class pdf_sponge extends ModelePDFFactures
$deja_paye = 0;
$i = 1;
if(!empty($TPreviousIncoice)){
-
$pdf->setY($tab2_top);
$posy = $pdf->GetY();
@@ -1276,7 +1274,6 @@ class pdf_sponge extends ModelePDFFactures
foreach ($TPreviousIncoice as &$fac){
-
if($posy > $this->page_hauteur - 4 ) {
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pdf->addPage();
@@ -1482,7 +1479,6 @@ class pdf_sponge extends ModelePDFFactures
// VAT
// Situations totals migth be wrong on huge amounts
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
-
$sum_pdf_tva = 0;
foreach($this->tva as $tvakey => $tvaval){
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index a806cab111f..9997e68ca14 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -181,14 +181,6 @@ class modAccounting extends DolibarrModules
$this->rights[$r][5] = '';
$r++;
- $this->rights[$r][0] = 50430;
- $this->rights[$r][1] = 'Define and close a fiscal year';
- $this->rights[$r][2] = 'r';
- $this->rights[$r][3] = 0;
- $this->rights[$r][4] = 'fiscalyear';
- $this->rights[$r][5] = '';
- $r++;
-
$this->rights[$r][0] = 50401;
$this->rights[$r][1] = 'Bind products and invoices with accounting accounts';
$this->rights[$r][2] = 'r';
@@ -197,16 +189,6 @@ class modAccounting extends DolibarrModules
$this->rights[$r][5] = 'write';
$r++;
- /*
- $this->rights[$r][0] = 50402;
- $this->rights[$r][1] = 'Make binding with products and invoices';
- $this->rights[$r][2] = 'r';
- $this->rights[$r][3] = 0;
- $this->rights[$r][4] = 'ventilation';
- $this->rights[$r][5] = 'dispatch_advanced';
- $r++;
- */
-
$this->rights[$r][0] = 50411;
$this->rights[$r][1] = 'Read operations in Ledger';
$this->rights[$r][2] = 'r';
@@ -255,6 +237,13 @@ class modAccounting extends DolibarrModules
$this->rights[$r][5] = 'lire';
$r++;
+ $this->rights[$r][0] = 50430;
+ $this->rights[$r][1] = 'Manage fiscal periods, validate movements and close periods';
+ $this->rights[$r][2] = 'r';
+ $this->rights[$r][3] = 0;
+ $this->rights[$r][4] = 'fiscalyear';
+ $this->rights[$r][5] = 'write';
+ $r++;
// Menus
//-------
diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php
index 488dccd9067..c5169c7f6d1 100644
--- a/htdocs/core/modules/modDataPolicy.class.php
+++ b/htdocs/core/modules/modDataPolicy.class.php
@@ -59,7 +59,7 @@ class modDataPolicy extends DolibarrModules {
// It is used to group modules by family in module setup page
$this->family = "technic";
// Module position in the family on 2 digits ('01', '10', '20', ...)
- $this->module_position = '81';
+ $this->module_position = '78';
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
// Module label (no space allowed), used if translation string 'ModuledatapolicyName' not found (MyModue is name of module).
diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php
index 8286bca9c82..78832122ff0 100644
--- a/htdocs/core/modules/modDocumentGeneration.class.php
+++ b/htdocs/core/modules/modDocumentGeneration.class.php
@@ -45,7 +45,7 @@ class modDocumentGeneration extends DolibarrModules
$this->numero = 1520;
$this->family = "technic";
- $this->module_position = '80';
+ $this->module_position = '78';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Direct mail document generation";
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index da2ac06dcea..a3e3e539468 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -85,6 +85,13 @@ class modProduct extends DolibarrModules
$this->const[$r][3] = 'Module to control product codes';
$this->const[$r][4] = 0;
$r++;
+
+ $this->const[$r][0] = "PRODUCT_PRICE_UNIQ";
+ $this->const[$r][1] = "chaine";
+ $this->const[$r][2] = "1";
+ $this->const[$r][3] = 'pricing rule by default';
+ $this->const[$r][4] = 0;
+ $r++;
/*$this->const[$r][0] = "PRODUCT_ADDON_PDF";
$this->const[$r][1] = "chaine";
diff --git a/htdocs/core/modules/modZapier.class.php b/htdocs/core/modules/modZapier.class.php
index ed628110044..fe8f43416f3 100644
--- a/htdocs/core/modules/modZapier.class.php
+++ b/htdocs/core/modules/modZapier.class.php
@@ -42,14 +42,14 @@ class modZapier extends DolibarrModules
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
- $this->numero = 792000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
+ $this->numero = 50330;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'zapier';
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
- $this->module_position = 100;
+ $this->module_position = '13';
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
// Module label (no space allowed), used if translation string 'ModuleZapierName' not found (Zapier is name of module).
diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php
index e70db46aefa..eeef6ab34e5 100644
--- a/htdocs/core/modules/printing/printgcp.modules.php
+++ b/htdocs/core/modules/printing/printgcp.modules.php
@@ -88,7 +88,6 @@ class printing_printgcp extends PrintingDriver
'type'=>'info',
);
} else {
-
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
// Token storage
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index d8aed4f67cf..d3693932f76 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -756,8 +756,6 @@ class pdf_azur extends ModelePDFPropales
if (count($filetomerge->lines) > 0) {
foreach ($filetomerge->lines as $linefile) {
if (! empty($linefile->id) && ! empty($linefile->file_name)) {
-
-
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{
if (! empty($conf->product->enabled)) {
diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
index 3049214679e..0d4f86ca82a 100644
--- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
@@ -867,8 +867,6 @@ class pdf_cyan extends ModelePDFPropales
if (count($filetomerge->lines) > 0) {
foreach ($filetomerge->lines as $linefile) {
if (! empty($linefile->id) && ! empty($linefile->file_name)) {
-
-
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{
if (! empty($conf->product->enabled)) {
diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
index f8c0b06e514..3a8b1a78a3e 100644
--- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php
+++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
@@ -72,7 +72,6 @@ class pdf_squille extends ModelePdfReception
$this->posxpuht=$this->page_largeur - $this->marge_droite;
if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
-
$this->posxweightvol=$this->page_largeur - $this->marge_droite - 118;
$this->posxqtyordered=$this->page_largeur - $this->marge_droite - 96;
$this->posxqtytoship=$this->page_largeur - $this->marge_droite - 68;
@@ -658,7 +657,6 @@ class pdf_squille extends ModelePdfReception
$pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1);
if(!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
-
$pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl, '', 0, 'C', 1);
@@ -754,7 +752,6 @@ class pdf_squille extends ModelePdfReception
}
if(!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
-
$pdf->line($this->posxpuht-1, $tab_top, $this->posxpuht-1, $tab_top + $tab_height);
if (empty($hidetop))
{
diff --git a/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php b/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
index 8a7d3e9e58a..1c634023b80 100644
--- a/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
+++ b/htdocs/core/modules/security/generate/modGeneratePassStandard.class.php
@@ -107,7 +107,6 @@ class modGeneratePassStandard extends ModeleGenPassword
// add random characters to $password until $length is reached
while ($i < $this->length)
{
-
// pick a random character from the possible ones
$char = substr($possible, mt_rand(0, dol_strlen($possible)-1), 1);
diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
index 2a5f797147e..71e4da43773 100644
--- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
@@ -253,6 +253,7 @@ class pdf_stdmovement extends ModelePDFMovement
$warehousestatic=new Entrepot($db);
$movement=new MouvementStock($db);
$userstatic=new User($db);
+ $element = 'movement';
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,";
@@ -262,7 +263,9 @@ class pdf_stdmovement extends ModelePDFMovement
$sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,";
$sql.= " u.login, u.photo, u.lastname, u.firstname";
// Add fields from extrafields
- foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
+ if (! empty($extrafields->attributes[$element]['label'])) {
+ foreach ($extrafields->attributes[$element]['label'] as $key => $val) $sql.=($extrafields->attributes[$element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+ }
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -335,7 +338,6 @@ class pdf_stdmovement extends ModelePDFMovement
if ($conf->stock->dir_output)
{
-
if ($resql)
{
$product = new Product($db);
diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php
index ee050d44b21..b59ca8c2b22 100644
--- a/htdocs/core/tpl/advtarget.tpl.php
+++ b/htdocs/core/tpl/advtarget.tpl.php
@@ -236,7 +236,6 @@ print '';
} elseif (GETPOST('action') == 'confirm_delete' && GETPOST('confirm') == 'yes' && GETPOST('socid') > 0) {
-
// La suppression n'a pas été possible
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
$societe = new Societe($this->db);
$societe->fetch(GETPOST('socid'));
// On vérifie si il est utilisé
if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) {
-
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
$form = new Form($this->db);
echo $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1);
@@ -428,7 +424,6 @@ class ActionsDatapolicy
$societe->fetch(GETPOST('socid'));
if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) {
-
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
$jsscript .= '
';
-
return $html;
}
diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php
index 7827024d4fc..a1bf67cb8c5 100644
--- a/htdocs/margin/checkMargins.php
+++ b/htdocs/margin/checkMargins.php
@@ -201,7 +201,6 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
-
dol_syslog(__FILE__, LOG_DEBUG);
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php
index 2d29542a948..8d1e04cafd2 100644
--- a/htdocs/margin/customerMargins.php
+++ b/htdocs/margin/customerMargins.php
@@ -91,7 +91,6 @@ print '';
$client = false;
if ($socid > 0) {
-
$soc = new Societe($db);
$soc->fetch($socid);
diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php
index 33b7946355c..f63067d6af8 100644
--- a/htdocs/margin/productMargins.php
+++ b/htdocs/margin/productMargins.php
@@ -103,7 +103,6 @@ dol_fiche_head($head, 'productMargins', $titre, 0, $picto);
print '';
if ($id > 0) {
-
print ''.$langs->trans('ChooseProduct/Service').' ';
print '';
print $form->select_produits($id, 'id', '', 20, 0, 1, 2, '', 1, array(), 0, 'All');
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 5cd32512713..4ac7fb6e716 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -295,7 +295,6 @@ if ($dirins && $action == 'initphpunit' && !empty($module))
}
else
{
-
}
}
if ($dirins && $action == 'initsqlextrafields' && !empty($module))
@@ -537,6 +536,26 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
}
else
{
+ /**
+ * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
+ * 'label' the translation key.
+ * 'enabled' is a condition when the field must be managed.
+ * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 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 replaced by the global setup of default values)
+ * '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")
+ */
+
/*public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
@@ -562,14 +581,31 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
$i=10;
while ($obj = $db->fetch_object($_results))
{
+ // fieldname
$fieldname = $obj->Field;
+ // type
$type = $obj->Type;
if ($type == 'int(11)') $type='integer';
+ // notnull
$notnull = ($obj->Null == 'YES'?0:1);
+ // label
$label = preg_replace('/_/', ' ', ucfirst($fieldname));
if ($fieldname == 'rowid') $label='ID';
+ if ($fieldname == 'import_key') $label='ImportKey';
+ // visible
+ $visible = -1;
+ if ($fieldname == 'entity') $visible = -2;
+ if ($fieldname == 'model_pdf') $visible = 0;
+ // enabled
+ $enabled = 1;
+ // default
+ $default = '';
+ if ($fieldname == 'entity') $default=1;
- $string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."', 'enabled'=>1, 'visible'=>-2";
+ $string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',";
+ if ($default != '') $string.= " 'default'=>".$default.",";
+ $string.= " 'enabled'=>".$enabled.",";
+ $string.= " 'visible'=>".$visible;
if ($notnull) $string.= ", 'notnull'=>".$notnull;
if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1";
$string.= ", 'position'=>".$i."),\n";
@@ -1332,7 +1368,6 @@ else
}
else
{
-
$message=info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb=0;
}
@@ -1578,7 +1613,7 @@ elseif (! empty($module))
print '
';
print ' ';
- print load_fiche_titre($langs->trans("DescriptorFile"));
+ print load_fiche_titre($langs->trans("DescriptorFile"), '', '');
if (! empty($moduleobj))
{
@@ -1638,35 +1673,33 @@ elseif (! empty($module))
print '';
print '
';
-
- print ' ';
-
- // Readme file
- print load_fiche_titre($langs->trans("ReadmeFile"));
-
- print '
';
- print '';
- if (dol_is_file($dirread.'/'.$pathtofilereadme)) print $moduleobj->getDescLong();
- else print $langs->trans("ErrorFileNotFound", $pathtofilereadme);
-
- print '
';
-
- // ChangeLog
- print load_fiche_titre($langs->trans("ChangeLog"));
-
- print '
';
- print '
';
-
- if (dol_is_file($dirread.'/'.$pathtochangelog)) print $moduleobj->getChangeLog();
- else print $langs->trans("ErrorFileNotFound", $pathtochangelog);
-
- print '
';
}
else
{
print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
';
}
+ if (! empty($moduleobj))
+ {
+ print '
';
+
+ // Readme file
+ print load_fiche_titre($langs->trans("ReadmeFile"), '', '');
+
+ print '';
+ if (dol_is_file($dirread.'/'.$pathtofilereadme)) print '
'.$moduleobj->getDescLong().'
';
+ else print '
'.$langs->trans("ErrorFileNotFound", $pathtofilereadme).' ';
+
+ print '
';
+
+ // ChangeLog
+ print load_fiche_titre($langs->trans("ChangeLog"), '', '');
+
+ print '';
+ if (dol_is_file($dirread.'/'.$pathtochangelog)) print '
'.$moduleobj->getChangeLog().'
';
+ else print '
'.$langs->trans("ErrorFileNotFound", $pathtochangelog).' ';
+ }
+
dol_fiche_end();
}
else
@@ -2488,7 +2521,6 @@ elseif (! empty($module))
if ($action != 'editfile' || empty($file))
{
-
print '
';
$htmlhelp=$langs->trans("PermissionsDefDescTooltip", ''.$langs->trans('DefaultPermissions').' ');
print $form->textwithpicto($langs->trans("PermissionsDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').' ';
diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php
index fcf529db13b..530b320b111 100644
--- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php
+++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php
@@ -205,7 +205,6 @@ class ActionsMyModule
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
-
}
return $ret;
@@ -234,7 +233,6 @@ class ActionsMyModule
/* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
-
}
return $ret;
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 371c4498da8..59da2cde8ae 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -489,6 +489,82 @@ class MyObject extends CommonObject
return $this->deleteLineCommon($user, $idline, $notrigger);
}
+
+ /**
+ * Set draft status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function setDraft($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status <= self::STATUS_DRAFT)
+ {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'BOM_UNVALIDATE');
+ }
+
+ /**
+ * Set cancel status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, 0=Nothing done, >0 if OK
+ */
+ public function cancel($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status != self::STATUS_VALIDATED)
+ {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'BOM_CLOSE');
+ }
+
+ /**
+ * Set back to validated status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, 0=Nothing done, >0 if OK
+ */
+ public function reopen($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status != self::STATUS_CANCELED)
+ {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN');
+ }
+
/**
* Return a link to the object card (with optionaly the picto)
*
@@ -722,7 +798,6 @@ class MyObject extends CommonObject
$langs->load("mymodule@mymodule");
if (! dol_strlen($modele)) {
-
$modele = 'standard';
if ($this->modelpdf) {
diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
index 17d8d0cf150..db2c79ca082 100644
--- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
+++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
@@ -103,7 +103,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Data and type of action are stored into $object and $action
switch ($action) {
-
// Users
//case 'USER_CREATE':
//case 'USER_MODIFY':
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 01d800f23c8..5727d596a6d 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -114,8 +114,6 @@ $permissiontoadd=$user->rights->mymodule->write; // Used by the include of actio
/*
* Actions
- *
- * Put here all code to do according to value of "action" parameter
*/
$parameters=array();
@@ -129,7 +127,7 @@ if (empty($reshook))
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
if (empty($backtopage)) {
- if (empty($id)) $backtopage = $backurlforlist;
+ if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
@@ -437,6 +435,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
print 'id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . ' '."\n";
+ // Back to draft
+ if (! empty($user->rights->mymodule->write) && $object->status == BOM::STATUS_VALIDATED)
+ {
+ print '' . $langs->trans("SetToDraft") . ' ';
+ }
+
// Modify
if (! empty($user->rights->mymodule->write))
{
diff --git a/htdocs/mrp/ChangeLog.md b/htdocs/mrp/ChangeLog.md
new file mode 100644
index 00000000000..416bad1d559
--- /dev/null
+++ b/htdocs/mrp/ChangeLog.md
@@ -0,0 +1,5 @@
+# CHANGELOG MRP FOR DOLIBARR ERP CRM
+
+## 1.0
+Initial version
+
diff --git a/htdocs/mrp/README.md b/htdocs/mrp/README.md
new file mode 100644
index 00000000000..b23e31fb577
--- /dev/null
+++ b/htdocs/mrp/README.md
@@ -0,0 +1,3 @@
+# MRP Module
+
+Module to manage Manufacturing Orders (MO)
\ No newline at end of file
diff --git a/htdocs/mrp/admin/setup.php b/htdocs/mrp/admin/setup.php
new file mode 100644
index 00000000000..8d7df29b383
--- /dev/null
+++ b/htdocs/mrp/admin/setup.php
@@ -0,0 +1,151 @@
+
+ * Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson
+ *
+ * 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 .
+ */
+
+/**
+ * \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 = ''.$langs->trans("BackToModuleList").' ';
+
+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 ''.$langs->trans("MrpSetupPage").' ';
+
+
+if ($action == 'edit')
+{
+ print '';
+ print ' ';
+}
+else
+{
+ if (! empty($arrayofparameters))
+ {
+ print '';
+ print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
+
+ foreach($arrayofparameters as $key => $val)
+ {
+ print '';
+ $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
+ print $form->textwithpicto($langs->trans($key), $tooltiphelp);
+ print ' ' . $conf->global->$key . ' ';
+ }
+
+ print '
';
+
+ print '';
+ }
+ else
+ {
+ print ' '.$langs->trans("NothingToSetup");
+ }
+}
+
+
+// Page end
+dol_fiche_end();
+
+llxFooter();
+$db->close();
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
new file mode 100644
index 00000000000..5bac2320b24
--- /dev/null
+++ b/htdocs/mrp/class/mo.class.php
@@ -0,0 +1,745 @@
+
+ * 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 .
+ */
+
+/**
+ * \file class/mo.class.php
+ * \ingroup mrp
+ * \brief This file is a CRUD class file for Mo (Create/Read/Update/Delete)
+ */
+
+// Put here all includes required by your class file
+require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
+
+/**
+ * Class for Mo
+ */
+class Mo extends CommonObject
+{
+ /**
+ * @var string ID to identify managed object
+ */
+ public $element = 'mo';
+
+ /**
+ * @var string Name of table without prefix where object is stored
+ */
+ public $table_element = 'mrp_mo';
+
+ /**
+ * @var int Does mo support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+ */
+ public $ismultientitymanaged = 0;
+
+ /**
+ * @var int Does mo support extrafields ? 0=No, 1=Yes
+ */
+ public $isextrafieldmanaged = 1;
+
+ /**
+ * @var string String with name of icon for mo. Must be the part after the 'object_' into object_mo.png
+ */
+ public $picto = 'mrp';
+
+
+ const STATUS_DRAFT = 0;
+ const STATUS_VALIDATED = 1; // To produce
+ const STATUS_INPROGRESS = 2;
+ const STATUS_DONE = 3;
+ const STATUS_CANCELED = -1;
+
+
+
+ /**
+ * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
+ * 'label' the translation key.
+ * 'enabled' is a condition when the field must be managed.
+ * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 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 replaced by the global setup of default values)
+ * '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")
+ */
+
+ // 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.
+ */
+ public $fields=array(
+ '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'=>1, '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'=>-1, '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',),
+ 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'index'=>1, 'comment'=>"Qty to produce",),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1),
+ 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,),
+ 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,),
+ 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
+ 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,),
+ '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', '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', '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', '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'=>'Done', '-1'=>'Canceled')),
+ );
+ public $rowid;
+ public $ref;
+ public $entity;
+ public $label;
+ public $qty;
+ public $fk_soc;
+ public $note_public;
+ public $note_private;
+ public $date_creation;
+ public $tms;
+ public $fk_user_creat;
+ public $fk_user_modif;
+ public $import_key;
+ public $status;
+ public $fk_product;
+ public $date_start_planned;
+ public $date_end_planned;
+ public $fk_bom;
+ public $fk_project;
+ // END MODULEBUILDER PROPERTIES
+
+
+ // If this object has a subtable with lines
+
+ /**
+ * @var int Name of subtable line
+ */
+ //public $table_element_line = 'mrp_moline';
+
+ /**
+ * @var int Field with ID of parent key if this field has a parent
+ */
+ //public $fk_element = 'fk_mo';
+
+ /**
+ * @var int Name of subtable class that manage subtable lines
+ */
+ //public $class_element_line = 'Moline';
+
+ /**
+ * @var array List of child tables. To test if we can delete object.
+ */
+ //protected $childtables=array();
+
+ /**
+ * @var array List of child tables. To know object to delete on cascade.
+ */
+ //protected $childtablesoncascade=array('mrp_modet');
+
+ /**
+ * @var MoLine[] Array of subtable lines
+ */
+ //public $lines = array();
+
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDb $db Database handler
+ */
+ public function __construct(DoliDB $db)
+ {
+ global $conf, $langs;
+
+ $this->db = $db;
+
+ if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0;
+ if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0;
+
+ // Unset fields that are disabled
+ foreach($this->fields as $key => $val)
+ {
+ if (isset($val['enabled']) && empty($val['enabled']))
+ {
+ unset($this->fields[$key]);
+ }
+ }
+
+ // Translate some data of arrayofkeyval
+ foreach($this->fields as $key => $val)
+ {
+ if (is_array($val['arrayofkeyval']))
+ {
+ foreach($val['arrayofkeyval'] as $key2 => $val2)
+ {
+ $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2);
+ }
+ }
+ }
+ }
+
+ /**
+ * Create object into database
+ *
+ * @param User $user User that creates
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, Id of created object if OK
+ */
+ public function create(User $user, $notrigger = false)
+ {
+ return $this->createCommon($user, $notrigger);
+ }
+
+ /**
+ * Clone an object into another one
+ *
+ * @param User $user User that creates
+ * @param int $fromid Id of object to clone
+ * @return mixed New object created, <0 if KO
+ */
+ public function createFromClone(User $user, $fromid)
+ {
+ global $langs, $extrafields;
+ $error = 0;
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $object = new self($this->db);
+
+ $this->db->begin();
+
+ // Load source object
+ $result = $object->fetchCommon($fromid);
+ if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines();
+
+ // get lines so they will be clone
+ //foreach($this->lines as $line)
+ // $line->fetch_optionals();
+
+ // Reset some properties
+ unset($object->id);
+ unset($object->fk_user_creat);
+ unset($object->import_key);
+
+
+ // Clear fields
+ $object->ref = "copy_of_".$object->ref;
+ $object->title = $langs->trans("CopyOf")." ".$object->title;
+ // ...
+ // Clear extrafields that are unique
+ if (is_array($object->array_options) && count($object->array_options) > 0)
+ {
+ $extrafields->fetch_name_optionals_label($this->table_element);
+ foreach($object->array_options as $key => $option)
+ {
+ $shortkey = preg_replace('/options_/', '', $key);
+ if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
+ {
+ //var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
+ unset($object->array_options[$key]);
+ }
+ }
+ }
+
+ // Create clone
+ $object->context['createfromclone'] = 'createfromclone';
+ $result = $object->createCommon($user);
+ if ($result < 0) {
+ $error++;
+ $this->error = $object->error;
+ $this->errors = $object->errors;
+ }
+
+ if (! $error)
+ {
+ // copy internal contacts
+ if ($this->copy_linked_contact($object, 'internal') < 0)
+ {
+ $error++;
+ }
+ }
+
+ if (! $error)
+ {
+ // copy external contacts if same company
+ if (property_exists($this, 'socid') && $this->socid == $object->socid)
+ {
+ if ($this->copy_linked_contact($object, 'external') < 0)
+ $error++;
+ }
+ }
+
+ unset($object->context['createfromclone']);
+
+ // End
+ if (!$error) {
+ $this->db->commit();
+ return $object;
+ } else {
+ $this->db->rollback();
+ return -1;
+ }
+ }
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param int $id Id object
+ * @param string $ref Ref
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ public function fetch($id, $ref = null)
+ {
+ $result = $this->fetchCommon($id, $ref);
+ if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
+ return $result;
+ }
+
+ /**
+ * Load object lines in memory from the database
+ *
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ public function fetchLines()
+ {
+ $this->lines=array();
+
+ $result = $this->fetchLinesCommon();
+ return $result;
+ }
+
+
+ /**
+ * Load list of objects in memory from the database.
+ *
+ * @param string $sortorder Sort Order
+ * @param string $sortfield Sort field
+ * @param int $limit limit
+ * @param int $offset Offset
+ * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
+ * @param string $filtermode Filter mode (AND or OR)
+ * @return array|int int <0 if KO, array of pages if OK
+ */
+ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
+ {
+ global $conf;
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $records=array();
+
+ $sql = 'SELECT ';
+ $sql .= $this->getFieldList();
+ $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
+ if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
+ else $sql .= ' WHERE 1 = 1';
+ // Manage filter
+ $sqlwhere = array();
+ if (count($filter) > 0) {
+ foreach ($filter as $key => $value) {
+ if ($key=='t.rowid') {
+ $sqlwhere[] = $key . '='. $value;
+ }
+ elseif (strpos($key, 'date') !== false) {
+ $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
+ }
+ elseif ($key=='customsql') {
+ $sqlwhere[] = $value;
+ }
+ else {
+ $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
+ }
+ }
+ }
+ if (count($sqlwhere) > 0) {
+ $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
+ }
+
+ if (!empty($sortfield)) {
+ $sql .= $this->db->order($sortfield, $sortorder);
+ }
+ if (!empty($limit)) {
+ $sql .= ' ' . $this->db->plimit($limit, $offset);
+ }
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+ $i = 0;
+ while ($i < min($limit, $num))
+ {
+ $obj = $this->db->fetch_object($resql);
+
+ $record = new self($this->db);
+ $record->setVarsFromFetchObj($obj);
+
+ $records[$record->id] = $record;
+
+ $i++;
+ }
+ $this->db->free($resql);
+
+ return $records;
+ } else {
+ $this->errors[] = 'Error ' . $this->db->lasterror();
+ dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
+
+ return -1;
+ }
+ }
+
+ /**
+ * Update object into database
+ *
+ * @param User $user User that modifies
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function update(User $user, $notrigger = false)
+ {
+ return $this->updateCommon($user, $notrigger);
+ }
+
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function delete(User $user, $notrigger = false)
+ {
+ return $this->deleteCommon($user, $notrigger);
+ //return $this->deleteCommon($user, $notrigger, 1);
+ }
+
+ /**
+ * Delete a line of object in database
+ *
+ * @param User $user User that delete
+ * @param int $idline Id of line to delete
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int >0 if OK, <0 if KO
+ */
+ public function deleteLine(User $user, $idline, $notrigger = false)
+ {
+ if ($this->status < 0)
+ {
+ $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
+ return -2;
+ }
+
+ return $this->deleteLineCommon($user, $idline, $notrigger);
+ }
+
+ /**
+ * Return a link to the object card (with optionaly the picto)
+ *
+ * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
+ * @param string $option On what the link point to ('nolink', ...)
+ * @param int $notooltip 1=Disable tooltip
+ * @param string $morecss Add more css on link
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
+ */
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+ {
+ global $conf, $langs, $hookmanager;
+
+ if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
+
+ $result = '';
+
+ $label = '' . $langs->trans("Mo") . ' ';
+ $label.= ' ';
+ $label.= '' . $langs->trans('Ref') . ': ' . $this->ref;
+
+ $url = dol_buildpath('/mrp/mo_card.php', 1).'?id='.$this->id;
+
+ if ($option != 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ }
+
+ $linkclose='';
+ if (empty($notooltip))
+ {
+ if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ {
+ $label=$langs->trans("ShowMo");
+ $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 = '';
+ $linkend=' ';
+
+ $result .= $linkstart;
+ if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
+ if ($withpicto != 2) $result.= $this->ref;
+ $result .= $linkend;
+ //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
+
+ global $action,$hookmanager;
+ $hookmanager->initHooks(array('modao'));
+ $parameters=array('id'=>$this->id, 'getnomurl'=>$result);
+ $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ if ($reshook > 0) $result = $hookmanager->resPrint;
+ else $result .= $hookmanager->resPrint;
+
+ return $result;
+ }
+
+ /**
+ * Return label of the 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 getLibStatut($mode = 0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return the status
+ *
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function LibStatut($status, $mode = 0)
+ {
+ // phpcs:enable
+ 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');
+ }
+
+ if ($mode == 0)
+ {
+ return $this->labelstatus[$status];
+ }
+ elseif ($mode == 1)
+ {
+ return $this->labelstatus[$status];
+ }
+ elseif ($mode == 2)
+ {
+ return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ }
+ elseif ($mode == 3)
+ {
+ return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
+ }
+ elseif ($mode == 4)
+ {
+ return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ }
+ elseif ($mode == 5)
+ {
+ return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
+ }
+ elseif ($mode == 6)
+ {
+ return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
+ }
+ }
+
+ /**
+ * Load the info information in the object
+ *
+ * @param int $id Id of object
+ * @return void
+ */
+ public function info($id)
+ {
+ $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
+ $sql.= ' fk_user_creat, fk_user_modif';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
+ $sql.= ' WHERE t.rowid = '.$id;
+ $result=$this->db->query($sql);
+ if ($result)
+ {
+ if ($this->db->num_rows($result))
+ {
+ $obj = $this->db->fetch_object($result);
+ $this->id = $obj->rowid;
+ if ($obj->fk_user_author)
+ {
+ $cuser = new User($this->db);
+ $cuser->fetch($obj->fk_user_author);
+ $this->user_creation = $cuser;
+ }
+
+ if ($obj->fk_user_valid)
+ {
+ $vuser = new User($this->db);
+ $vuser->fetch($obj->fk_user_valid);
+ $this->user_validation = $vuser;
+ }
+
+ if ($obj->fk_user_cloture)
+ {
+ $cluser = new User($this->db);
+ $cluser->fetch($obj->fk_user_cloture);
+ $this->user_cloture = $cluser;
+ }
+
+ $this->date_creation = $this->db->jdate($obj->datec);
+ $this->date_modification = $this->db->jdate($obj->datem);
+ $this->date_validation = $this->db->jdate($obj->datev);
+ }
+
+ $this->db->free($result);
+ }
+ else
+ {
+ dol_print_error($this->db);
+ }
+ }
+
+ /**
+ * Initialise object with example values
+ * Id must be 0 if object instance is a specimen
+ *
+ * @return void
+ */
+ public function initAsSpecimen()
+ {
+ $this->initAsSpecimenCommon();
+ }
+
+ /**
+ * Create an array of lines
+ *
+ * @return array|int array of lines if OK, <0 if KO
+ */
+ public function getLinesArray()
+ {
+ $this->lines=array();
+
+ $objectline = new MoLine($this->db);
+ $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_mo = '.$this->id));
+
+ if (is_numeric($result))
+ {
+ $this->error = $this->error;
+ $this->errors = $this->errors;
+ return $result;
+ }
+ else
+ {
+ $this->lines = $result;
+ return $this->lines;
+ }
+ }
+
+ /**
+ * Create a document onto disk according to template module.
+ *
+ * @param string $modele Force template to use ('' to not force)
+ * @param Translate $outputlangs objet lang a utiliser pour traduction
+ * @param int $hidedetails Hide details of lines
+ * @param int $hidedesc Hide description
+ * @param int $hideref Hide ref
+ * @param null|array $moreparams Array to provide more information
+ * @return int 0 if KO, 1 if OK
+ */
+ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
+ {
+ global $conf,$langs;
+
+ $langs->load("mrp");
+
+ if (! dol_strlen($modele)) {
+ $modele = 'standard';
+
+ if ($this->modelpdf) {
+ $modele = $this->modelpdf;
+ } elseif (! empty($conf->global->MO_ADDON_PDF)) {
+ $modele = $conf->global->MO_ADDON_PDF;
+ }
+ }
+
+ $modelpath = "core/modules/mrp/doc/";
+
+ return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
+ }
+
+ /**
+ * Action executed by scheduler
+ * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters'
+ *
+ * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
+ */
+ //public function doScheduledJob($param1, $param2, ...)
+ public function doScheduledJob()
+ {
+ global $conf, $langs;
+
+ //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
+
+ $error = 0;
+ $this->output = '';
+ $this->error='';
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $now = dol_now();
+
+ $this->db->begin();
+
+ // ...
+
+ $this->db->commit();
+
+ return $error;
+ }
+}
+
+/**
+ * Class MoLine. You can also remove this and generate a CRUD class for lines objects.
+ */
+class MoLine
+{
+ // To complete with content of an object MoLine
+ // We should have a field rowid, fk_mo and position
+}
diff --git a/htdocs/mrp/core/modules/modMrp.class.php b/htdocs/mrp/core/modules/modMrp.class.php
new file mode 100644
index 00000000000..7e57f70c6c8
--- /dev/null
+++ b/htdocs/mrp/core/modules/modMrp.class.php
@@ -0,0 +1,349 @@
+
+ * Copyright (C) 2018-2019 Nicolas ZABOURI
+ * Copyright (C) 2019 Frédéric France
+ * Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson
+ *
+ * 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 .
+ */
+
+/**
+ * \defgroup mrp Module Mrp
+ * \brief Mrp module descriptor.
+ *
+ * \file htdocs/mrp/core/modules/modMrp.class.php
+ * \ingroup mrp
+ * \brief Description and activation file for module Mrp
+ */
+include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
+
+/**
+ * Description and activation class for module Mrp
+ */
+class modMrp extends DolibarrModules
+{
+ /**
+ * Constructor. Define names, constants, directories, boxes, permissions
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ global $langs,$conf;
+ $this->db = $db;
+
+ // Id for module (must be unique).
+ // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
+ $this->numero = 660; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
+ // Key text used to identify module (for permissions, menus, etc...)
+ $this->rights_class = 'mrp';
+ // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
+ // It is used to group modules by family in module setup page
+ $this->family = "products";
+ // Module position in the family on 2 digits ('01', '10', '20', ...)
+ $this->module_position = '62';
+ // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
+ //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
+ // Module label (no space allowed), used if translation string '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";
+ // 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'
+ $this->version = 'dolibarr';
+ // Url to the file with your last numberversion of this module
+ //$this->url_last_version = 'http://www.example.com/versionmodule.txt';
+
+ // Key used in llx_const table to save module status enabled/disabled (where MRP is value of property name of module in uppercase)
+ $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
+ // Name of image file used for this module.
+ // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
+ // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
+ $this->picto='mrp';
+ // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
+ $this->module_parts = array(
+ // Set this to 1 if module has its own trigger directory (core/triggers)
+ 'triggers' => 0,
+ // Set this to 1 if module has its own login method file (core/login)
+ 'login' => 0,
+ // Set this to 1 if module has its own substitution function file (core/substitutions)
+ 'substitutions' => 0,
+ // Set this to 1 if module has its own menus handler directory (core/menus)
+ 'menus' => 0,
+ // Set this to 1 if module overwrite template dir (core/tpl)
+ 'tpl' => 0,
+ // Set this to 1 if module has its own barcode directory (core/modules/barcode)
+ 'barcode' => 0,
+ // Set this to 1 if module has its own models directory (core/modules/xxx)
+ 'models' => 0,
+ // Set this to 1 if module has its own theme directory (theme)
+ 'theme' => 0,
+ // Set this to relative path of css file if module has its own css file
+ 'css' => array(
+ // '/mrp/css/mrp.css.php',
+ ),
+ // Set this to relative path of js file if module must load a js on all pages
+ 'js' => array(
+ // '/mrp/js/mrp.js.php',
+ ),
+ // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
+ 'hooks' => array(
+ // 'data' => array(
+ // 'hookcontext1',
+ // 'hookcontext2',
+ // ),
+ // 'entity' => '0',
+ ),
+ // Set this to 1 if features of module are opened to external users
+ 'moduleforexternal' => 0,
+ );
+ // Data directories to create when module is enabled.
+ // 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");
+ // Dependencies
+ // A condition to hide module
+ $this->hidden = false;
+ // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
+ $this->depends = array('modBom');
+ $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
+ $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
+ $this->langfiles = array("mrp");
+ $this->phpmin = array(5,5); // Minimum version of PHP required by module
+ $this->need_dolibarr_version = array(8,0); // Minimum version of Dolibarr required by module
+ $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
+ $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
+ //$this->automatic_activation = array('FR'=>'MrpWasAutomaticallyActivatedBecauseOfYourCountryChoice');
+ //$this->always_enabled = true; // If true, can't be disabled
+
+ // Constants
+ // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
+ // Example: $this->const=array(1 => array('MRP_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
+ // 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)
+ );
+
+ // Some keys to add into the overwriting translation tables
+ /*$this->overwrite_translation = array(
+ 'en_US:ParentCompany'=>'Parent company or reseller',
+ 'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
+ )*/
+
+ if (! isset($conf->mrp) || ! isset($conf->mrp->enabled)) {
+ $conf->mrp=new stdClass();
+ $conf->mrp->enabled=0;
+ }
+
+ // Array to add new pages in new tabs
+ $this->tabs = array();
+ // Example:
+ // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mrp:$user->rights->mrp->read:/mrp/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
+ // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mrp:$user->rights->othermodule->read:/mrp/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
+ // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
+ //
+ // Where objecttype can be
+ // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
+ // 'contact' to add a tab in contact view
+ // 'contract' to add a tab in contract view
+ // 'group' to add a tab in group view
+ // 'intervention' to add a tab in intervention view
+ // 'invoice' to add a tab in customer invoice view
+ // 'invoice_supplier' to add a tab in supplier invoice view
+ // 'member' to add a tab in fundation member view
+ // 'opensurveypoll' to add a tab in opensurvey poll view
+ // 'order' to add a tab in customer order view
+ // 'order_supplier' to add a tab in supplier order view
+ // 'payment' to add a tab in payment view
+ // 'payment_supplier' to add a tab in supplier payment view
+ // 'product' to add a tab in product view
+ // 'propal' to add a tab in propal view
+ // 'project' to add a tab in project view
+ // 'stock' to add a tab in stock view
+ // 'thirdparty' to add a tab in third party view
+ // 'user' to add a tab in user view
+
+ // Dictionaries
+ $this->dictionaries=array();
+ /* Example:
+ $this->dictionaries=array(
+ 'langs'=>'mylangfile@mrp',
+ // List of tables we want to see into dictonnary editor
+ 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"),
+ // Label of tables
+ 'tablib'=>array("Table1","Table2","Table3"),
+ // Request to select fields
+ 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
+ // Sort order
+ 'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
+ // List of fields (result of select to show dictionary)
+ 'tabfield'=>array("code,label","code,label","code,label"),
+ // List of fields (list of fields to edit a record)
+ 'tabfieldvalue'=>array("code,label","code,label","code,label"),
+ // List of fields (list of fields for insert)
+ 'tabfieldinsert'=>array("code,label","code,label","code,label"),
+ // Name of columns with primary key (try to always name it 'rowid')
+ 'tabrowid'=>array("rowid","rowid","rowid"),
+ // Condition to show each dictionary
+ 'tabcond'=>array($conf->mrp->enabled,$conf->mrp->enabled,$conf->mrp->enabled)
+ );
+ */
+
+ // Boxes/Widgets
+ // Add here list of php file(s) stored in mrp/core/boxes that contains a class to show a widget.
+ $this->boxes = array(
+ // 0 => array(
+ // 'file' => 'mrpwidget1.php@mrp',
+ // 'note' => 'Widget provided by Mrp',
+ // 'enabledbydefaulton' => 'Home',
+ // ),
+ // ...
+ );
+
+ // Cronjobs (List of cron jobs entries to add when module is enabled)
+ // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
+ $this->cronjobs = array(
+ // 0 => array(
+ // 'label' => 'MyJob label',
+ // 'jobtype' => 'method',
+ // 'class' => '/mrp/class/mo.class.php',
+ // 'objectname' => 'Mo',
+ // 'method' => 'doScheduledJob',
+ // 'parameters' => '',
+ // 'comment' => 'Comment',
+ // 'frequency' => 2,
+ // 'unitfrequency' => 3600,
+ // 'status' => 0,
+ // 'test' => '$conf->mrp->enabled',
+ // 'priority' => 50,
+ // ),
+ );
+ // Example: $this->cronjobs=array(
+ // 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50),
+ // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50)
+ // );
+
+ // Permissions provided by this module
+ $this->rights = array();
+ $r=0;
+ // Add here entries to declare new permissions
+ /* BEGIN MODULEBUILDER PERMISSIONS */
+ $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
+ $this->rights[$r][1] = 'Read objects of Mrp'; // Permission label
+ $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
+ $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
+ $r++;
+ $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
+ $this->rights[$r][1] = 'Create/Update objects of Mrp'; // Permission label
+ $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
+ $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
+ $r++;
+ $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
+ $this->rights[$r][1] = 'Delete objects of Mrp'; // Permission label
+ $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
+ $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
+ $r++;
+ /* END MODULEBUILDER PERMISSIONS */
+
+ // Main menu entries to add
+ $this->menu = array();
+ $r=0;
+ // Add here entries to declare new menus
+ /* BEGIN MODULEBUILDER TOPMENU */
+ /* END MODULEBUILDER LEFTMENU MO */
+
+ // Exports profiles provided by this module
+ $r=1;
+ /* BEGIN MODULEBUILDER EXPORT MO */
+ /*
+ $langs->load("mrp");
+ $this->export_code[$r]=$this->rights_class.'_'.$r;
+ $this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_icon[$r]='mo@mrp';
+ $keyforclass = 'Mo'; $keyforclassfile='/mymobule/class/mo.class.php'; $keyforelement='mo';
+ include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+ $keyforselect='mo'; $keyforaliasextra='extra'; $keyforelement='mo';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+ //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
+ $this->export_sql_start[$r]='SELECT DISTINCT ';
+ $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'mo as t';
+ $this->export_sql_end[$r] .=' WHERE 1 = 1';
+ $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
+ $r++; */
+ /* END MODULEBUILDER EXPORT MO */
+
+ // Imports profiles provided by this module
+ $r=1;
+ /* BEGIN MODULEBUILDER IMPORT MO */
+ /*
+ $langs->load("mrp");
+ $this->export_code[$r]=$this->rights_class.'_'.$r;
+ $this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_icon[$r]='mo@mrp';
+ $keyforclass = 'Mo'; $keyforclassfile='/mymobule/class/mo.class.php'; $keyforelement='mo';
+ include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+ $keyforselect='mo'; $keyforaliasextra='extra'; $keyforelement='mo';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+ //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
+ $this->export_sql_start[$r]='SELECT DISTINCT ';
+ $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'mo as t';
+ $this->export_sql_end[$r] .=' WHERE 1 = 1';
+ $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
+ $r++; */
+ /* END MODULEBUILDER IMPORT MO */
+ }
+
+ /**
+ * Function called when module is enabled.
+ * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+ * It also creates data directories
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function init($options = '')
+ {
+ $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')
+
+ // Create extrafields during init
+ //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->mrp->enabled');
+ //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
+ //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
+ //$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');
+
+ $sql = array();
+ return $this->_init($sql, $options);
+ }
+
+ /**
+ * Function called when module is disabled.
+ * Remove from database constants, boxes and permissions from Dolibarr database.
+ * Data directories are not deleted
+ *
+ * @param string $options Options when enabling module ('', 'noboxes')
+ * @return int 1 if OK, 0 if KO
+ */
+ public function remove($options = '')
+ {
+ $sql = array();
+ return $this->_remove($sql, $options);
+ }
+}
diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php
index f5f723a8fac..b6c20cde620 100644
--- a/htdocs/mrp/index.php
+++ b/htdocs/mrp/index.php
@@ -175,7 +175,7 @@ print ' ';
*/
$max=5;
-$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem";
+$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom as a";
$sql.= " WHERE a.entity IN (".getEntity('bom').")";
$sql.= $db->order("a.tms", "DESC");
@@ -200,6 +200,7 @@ if ($resql)
$staticbom->id=$obj->rowid;
$staticbom->ref=$obj->ref;
$staticbom->date_modification=$obj->datem;
+ $staticbom->status=$obj->status;
print '
';
print ''.$staticbom->getNomUrl(1, 32).' ';
diff --git a/htdocs/mrp/lib/mrp.lib.php b/htdocs/mrp/lib/mrp.lib.php
new file mode 100644
index 00000000000..7ee1fcd04c7
--- /dev/null
+++ b/htdocs/mrp/lib/mrp.lib.php
@@ -0,0 +1,54 @@
+
+ *
+ * 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 .
+ */
+
+/**
+ * \file mrp/lib/mrp.lib.php
+ * \ingroup mrp
+ * \brief Library files with common functions for Mrp
+ */
+
+/**
+ * Prepare admin pages header
+ *
+ * @return array
+ */
+function mrpAdminPrepareHead()
+{
+ global $langs, $conf;
+
+ $langs->load("mrp");
+
+ $h = 0;
+ $head = array();
+
+ $head[$h][0] = dol_buildpath("/mrp/admin/setup.php", 1);
+ $head[$h][1] = $langs->trans("Settings");
+ $head[$h][2] = 'settings';
+ $h++;
+
+ // Show more tabs from modules
+ // Entries must be declared in modules descriptor with line
+ //$this->tabs = array(
+ // 'entity:+tabname:Title:@mrp:/mrp/mypage.php?id=__ID__'
+ //); // to add new tab
+ //$this->tabs = array(
+ // 'entity:-tabname:Title:@mrp:/mrp/mypage.php?id=__ID__'
+ //); // to remove a tab
+ complete_head_from_modules($conf, $langs, null, $head, $h, 'mrp');
+
+ return $head;
+}
diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php
new file mode 100644
index 00000000000..6189761269e
--- /dev/null
+++ b/htdocs/mrp/lib/mrp_mo.lib.php
@@ -0,0 +1,83 @@
+.
+ */
+
+/**
+ * \file lib/mrp_mo.lib.php
+ * \ingroup mrp
+ * \brief Library files with common functions for Mo
+ */
+
+/**
+ * Prepare array of tabs for Mo
+ *
+ * @param Mo $object Mo
+ * @return array Array of tabs
+ */
+function moPrepareHead($object)
+{
+ global $db, $langs, $conf;
+
+ $langs->load("mrp");
+
+ $h = 0;
+ $head = array();
+
+ $head[$h][0] = dol_buildpath("/mrp/mo_card.php", 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans("Card");
+ $head[$h][2] = 'card';
+ $h++;
+
+ if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
+ {
+ $nbNote = 0;
+ if (!empty($object->note_private)) $nbNote++;
+ if (!empty($object->note_public)) $nbNote++;
+ $head[$h][0] = dol_buildpath('/mrp/mo_note.php', 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans('Notes');
+ if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.' ';
+ $head[$h][2] = 'note';
+ $h++;
+ }
+
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
+ $upload_dir = $conf->mrp->dir_output . "/mo/" . dol_sanitizeFileName($object->ref);
+ $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
+ $nbLinks=Link::count($db, $object->element, $object->id);
+ $head[$h][0] = dol_buildpath("/mrp/mo_document.php", 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans('Documents');
+ if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).' ';
+ $head[$h][2] = 'document';
+ $h++;
+
+ $head[$h][0] = dol_buildpath("/mrp/mo_agenda.php", 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans("Events");
+ $head[$h][2] = 'agenda';
+ $h++;
+
+ // Show more tabs from modules
+ // Entries must be declared in modules descriptor with line
+ //$this->tabs = array(
+ // 'entity:+tabname:Title:@mrp:/mrp/mypage.php?id=__ID__'
+ //); // to add new tab
+ //$this->tabs = array(
+ // 'entity:-tabname:Title:@mrp:/mrp/mypage.php?id=__ID__'
+ //); // to remove a tab
+ complete_head_from_modules($conf, $langs, $object, $head, $h, 'mo@mrp');
+
+ return $head;
+}
diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php
new file mode 100644
index 00000000000..aab1ff10581
--- /dev/null
+++ b/htdocs/mrp/mo_agenda.php
@@ -0,0 +1,262 @@
+
+ * 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 .
+ */
+
+/**
+ * \file mo_agenda.php
+ * \ingroup mrp
+ * \brief Page of Mo events
+ */
+
+// 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 && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
+if (! $res) die("Include of main fails");
+
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+dol_include_once('/mrp/class/mo.class.php');
+dol_include_once('/mrp/lib/mrp_mo.lib.php');
+
+
+// Load translation files required by the page
+$langs->loadLangs(array("mrp","other"));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'alpha');
+$cancel = GETPOST('cancel', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
+if (GETPOST('actioncode', 'array'))
+{
+ $actioncode=GETPOST('actioncode', 'array', 3);
+ if (! count($actioncode)) $actioncode='0';
+}
+else
+{
+ $actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
+}
+$search_agenda_label=GETPOST('search_agenda_label');
+
+// Security check - Protection if external user
+//if ($user->societe_id > 0) access_forbidden();
+//if ($user->societe_id > 0) $socid = $user->societe_id;
+//$result = restrictedArea($user, 'mrp', $id);
+
+$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$sortfield = GETPOST("sortfield", 'alpha');
+$sortorder = GETPOST("sortorder", 'alpha');
+$page = GETPOST("page", 'int');
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+$offset = $limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+if (! $sortfield) $sortfield='a.datep,a.id';
+if (! $sortorder) $sortorder='DESC';
+
+// Initialize technical objects
+$object=new Mo($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('moagenda','globalcard')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity] . "/" . $object->id;
+
+
+
+/*
+ * Actions
+ */
+
+$parameters=array('id'=>$socid);
+$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+if (empty($reshook))
+{
+ // Cancel
+ if (GETPOST('cancel', 'alpha') && ! empty($backtopage))
+ {
+ header("Location: ".$backtopage);
+ exit;
+ }
+
+ // Purge search criteria
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
+ {
+ $actioncode='';
+ $search_agenda_label='';
+ }
+}
+
+
+
+/*
+ * View
+ */
+
+$contactstatic = new Contact($db);
+
+$form = new Form($db);
+
+if ($object->id > 0)
+{
+ $title=$langs->trans("Agenda");
+ //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
+ $help_url = '';
+ llxHeader('', $title, $help_url);
+
+ if (! empty($conf->notification->enabled)) $langs->load("mails");
+ $head = moPrepareHead($object);
+
+
+ dol_fiche_head($head, 'agenda', $langs->trans("Mo"), -1, $object->picto);
+
+ // Object card
+ // ------------------------------------------------------------
+ $linkback = '' . $langs->trans("BackToList") . ' ';
+
+ $morehtmlref='';
+ /*
+ // Ref customer
+ $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+ // Thirdparty
+ $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref.='
'.$langs->trans('Project') . ' ';
+ if ($user->rights->mrp->creer)
+ {
+ if ($action != 'classify')
+ //$morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ $morehtmlref.=' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='
';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
+ } else {
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.='
';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.=' ';
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ }*/
+ $morehtmlref.='
';
+
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+ print '';
+ print '
';
+
+ $object->info($object->id);
+ dol_print_object_info($object, 1);
+
+ print '
';
+
+ dol_fiche_end();
+
+
+
+ // Actions buttons
+
+ $objthirdparty=$object;
+ $objcon=new stdClass();
+
+ $out='&origin='.$object->element.'&originid='.$object->id;
+ $permok=$user->rights->agenda->myactions->create;
+ if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
+ {
+ //$out.='trans("AddAnAction"),'filenew');
+ //$out.=" ";
+ }
+
+
+ print '';
+
+ if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
+ {
+ $param='&id='.$object->id.'&socid='.$socid;
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
+
+
+ //print load_fiche_titre($langs->trans("ActionsOnMo"), '', '');
+
+ // List of all actions
+ $filters=array();
+ $filters['search_agenda_label']=$search_agenda_label;
+
+ // TODO Replace this with same code than into list.php
+ //show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
+ }
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
new file mode 100644
index 00000000000..f15b45b96e5
--- /dev/null
+++ b/htdocs/mrp/mo_card.php
@@ -0,0 +1,550 @@
+
+ * 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 .
+ */
+
+/**
+ * \file mo_card.php
+ * \ingroup mrp
+ * \brief Page to create/edit/view mo
+ */
+
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
+//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
+//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
+//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
+//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
+//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
+//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
+//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
+//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
+//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
+//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
+//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
+//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
+//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
+//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies
+
+
+// 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 && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
+if (! $res) die("Include of main fails");
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+dol_include_once('/mrp/class/mo.class.php');
+dol_include_once('/mrp/lib/mrp_mo.lib.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("mrp", "other"));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'aZ09');
+$confirm = GETPOST('confirm', 'alpha');
+$cancel = GETPOST('cancel', 'aZ09');
+$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'mocard'; // To manage different context of search
+$backtopage = GETPOST('backtopage', 'alpha');
+//$lineid = GETPOST('lineid', 'int');
+
+// Initialize technical objects
+$object=new Mo($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('mocard','globalcard')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+
+// Initialize array of search criterias
+$search_all=trim(GETPOST("search_all", 'alpha'));
+$search=array();
+foreach($object->fields as $key => $val)
+{
+ if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
+}
+
+if (empty($action) && empty($id) && empty($ref)) $action='view';
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+
+// Security check - Protection if external user
+//if ($user->societe_id > 0) access_forbidden();
+//if ($user->societe_id > 0) $socid = $user->societe_id;
+//$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0);
+//$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
+
+$permissionnote=$user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php
+$permissiondellink=$user->rights->mrp->write; // Used by the include of actions_dellink.inc.php
+$permissionedit=$user->rights->mrp->write; // Used by the include of actions_lineupdown.inc.php
+$permissiontoadd=$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php
+
+
+
+/*
+ * Actions
+ *
+ * Put here all code to do according to value of "action" parameter
+ */
+
+$parameters=array();
+$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+if (empty($reshook))
+{
+ $error=0;
+
+ $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0);
+ $backurlforlist = dol_buildpath('/mrp/mo_list.php', 1);
+ if (empty($backtopage)) {
+ if (empty($id)) $backtopage = $backurlforlist;
+ else $backtopage = dol_buildpath('/mrp/mo_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
+ }
+ $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record
+
+ // Actions cancel, add, update, delete or clone
+ include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
+
+ // Actions when linking object each other
+ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
+
+ // Actions when printing a doc from card
+ include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
+
+ // Actions to send emails
+ $trigger_name='MO_SENTBYMAIL';
+ $autocopy='MAIN_MAIL_AUTOCOPY_MO_TO';
+ $trackid='mo'.$object->id;
+ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
+}
+
+
+
+
+/*
+ * View
+ *
+ * Put here all code to build page
+ */
+
+$form=new Form($db);
+$formfile=new FormFile($db);
+
+llxHeader('', $langs->trans('Mo'), '');
+
+// Example : Adding jquery code
+print '';
+
+
+// Part to create
+if ($action == 'create')
+{
+ print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Mo")), '', 'cubes');
+
+ print '';
+}
+
+// Part to edit record
+if (($id || $ref) && $action == 'edit')
+{
+ print load_fiche_titre($langs->trans("Mo"), '', 'cubes');
+
+ print '';
+}
+
+// Part to show record
+if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
+{
+ $res = $object->fetch_optionals();
+
+ $head = moPrepareHead($object);
+ dol_fiche_head($head, 'card', $langs->trans("Mo"), -1, $object->picto);
+
+ $formconfirm = '';
+
+ // Confirmation to delete
+ if ($action == 'delete')
+ {
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMo'), $langs->trans('ConfirmDeleteMo'), 'confirm_delete', '', 0, 1);
+ }
+ // Confirmation to delete line
+ if ($action == 'deleteline')
+ {
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
+ }
+ // Clone confirmation
+ if ($action == 'clone') {
+ // Create an array for form
+ $formquestion = array();
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMo', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
+ }
+
+ // Confirmation of action xxxx
+ if ($action == 'xxx')
+ {
+ $formquestion=array();
+ /*
+ $forcecombo=0;
+ if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
+ $formquestion = array(
+ // 'text' => $langs->trans("ConfirmClone"),
+ // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
+ // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
+ // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
+ );
+ */
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
+ }
+
+ // Call Hook formConfirm
+ $parameters = array('lineid' => $lineid);
+ $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
+ elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
+
+ // Print form confirm
+ print $formconfirm;
+
+
+ // Object card
+ // ------------------------------------------------------------
+ $linkback = '' . $langs->trans("BackToList") . ' ';
+
+ $morehtmlref='';
+ /*
+ // Ref bis
+ $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', null, null, '', 1);
+ // Thirdparty
+ $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref.='
'.$langs->trans('Project') . ' ';
+ if ($user->rights->mrp->write)
+ {
+ if ($action != 'classify')
+ $morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='
';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
+ } else {
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.=$proj->getNomUrl();
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ }
+ */
+ $morehtmlref.='
';
+
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+
+ print '';
+ print '
';
+ print '
';
+ print '
'."\n";
+
+ // Common attributes
+ //$keyforbreak='fieldkeytoswitchonsecondcolumn';
+ include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
+
+ // Other attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
+
+ print '
';
+ print '
';
+ print '
';
+
+ print '
';
+
+ dol_fiche_end();
+
+
+ /*
+ * Lines
+ */
+
+ if (! empty($object->table_element_line))
+ {
+ // Show object lines
+ $result = $object->getLinesArray();
+
+ print ' \n";
+ }
+
+
+ // Buttons for actions
+
+ if ($action != 'presend' && $action != 'editline') {
+ print ''."\n";
+ }
+
+
+ // Select mail models is same action as presend
+ if (GETPOST('modelselected')) {
+ $action = 'presend';
+ }
+
+ if ($action != 'presend')
+ {
+ print '';
+ print '
'; // ancre
+
+ // Documents
+ /*$objref = dol_sanitizeFileName($object->ref);
+ $relativepath = $comref . '/' . $comref . '.pdf';
+ $filedir = $conf->mrp->dir_output . '/' . $objref;
+ $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
+ $genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content
+ $delallowed = $user->rights->mrp->create; // If you can create/edit, you can remove a file on card
+ print $formfile->showdocuments('mrp', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
+ */
+
+ // Show links to link elements
+ $linktoelem = $form->showLinkToObjectBlock($object, null, array('mo'));
+ $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+
+
+ print '
';
+
+ $MAXEVENT = 10;
+
+ $morehtmlright = '
';
+ $morehtmlright.= $langs->trans("SeeAll");
+ $morehtmlright.= ' ';
+
+ // List of actions on element
+ include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
+ $formactions = new FormActions($db);
+ $somethingshown = $formactions->showactions($object, 'mo', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
+
+ print '
';
+ }
+
+ //Select mail models is same action as presend
+ /*
+ if (GETPOST('modelselected')) $action = 'presend';
+
+ // Presend form
+ $modelmail='inventory';
+ $defaulttopic='InformationMessage';
+ $diroutput = $conf->product->dir_output.'/inventory';
+ $trackid = 'stockinv'.$object->id;
+
+ include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
+ */
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php
new file mode 100644
index 00000000000..09f34ae583e
--- /dev/null
+++ b/htdocs/mrp/mo_document.php
@@ -0,0 +1,167 @@
+
+ * 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 .
+ */
+
+/**
+ * \file mo_document.php
+ * \ingroup mrp
+ * \brief Tab for documents linked to Mo
+ */
+
+// 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 && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
+if (! $res) die("Include of main fails");
+
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+dol_include_once('/mrp/class/mo.class.php');
+dol_include_once('/mrp/lib/mrp_mo.lib.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("mrp","companies","other","mails"));
+
+
+$action=GETPOST('action', 'aZ09');
+$confirm=GETPOST('confirm');
+$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
+$ref = GETPOST('ref', 'alpha');
+
+// Security check - Protection if external user
+//if ($user->societe_id > 0) access_forbidden();
+//if ($user->societe_id > 0) $socid = $user->societe_id;
+//$result = restrictedArea($user, 'mrp', $id);
+
+// Get parameters
+$sortfield = GETPOST("sortfield", 'alpha');
+$sortorder = GETPOST("sortorder", 'alpha');
+$page = GETPOST("page", 'int');
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+$offset = $conf->liste_limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+if (! $sortorder) $sortorder="ASC";
+if (! $sortfield) $sortfield="name";
+//if (! $sortfield) $sortfield="position_name";
+
+// Initialize technical objects
+$object=new Mo($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('modocument','globalcard')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+
+//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity?$object->entity:$conf->entity] . "/mo/" . dol_sanitizeFileName($object->id);
+if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity?$object->entity:$conf->entity] . "/mo/" . dol_sanitizeFileName($object->ref);
+
+
+/*
+ * Actions
+ */
+
+include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+$title=$langs->trans("Mo").' - '.$langs->trans("Files");
+$help_url='';
+//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
+llxHeader('', $title, $help_url);
+
+if ($object->id)
+{
+ /*
+ * Show tabs
+ */
+ $head = moPrepareHead($object);
+
+ dol_fiche_head($head, 'document', $langs->trans("Mo"), -1, $object->picto);
+
+
+ // Build file list
+ $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
+ $totalsize=0;
+ foreach($filearray as $key => $file)
+ {
+ $totalsize+=$file['size'];
+ }
+
+ // Object card
+ // ------------------------------------------------------------
+ $linkback = '' . $langs->trans("BackToList") . ' ';
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+ print '';
+
+ print '
';
+ print '
';
+
+ // Number of files
+ print ''.$langs->trans("NbOfAttachedFiles").' '.count($filearray).' ';
+
+ // Total size
+ print ''.$langs->trans("TotalSizeOfAttachedFiles").' '.$totalsize.' '.$langs->trans("bytes").' ';
+
+ print '
';
+
+ print '
';
+
+ dol_fiche_end();
+
+ $modulepart = 'mrp';
+ //$permission = $user->rights->mrp->create;
+ $permission = 1;
+ //$permtoedit = $user->rights->mrp->create;
+ $permtoedit = 1;
+ $param = '&id=' . $object->id;
+
+ //$relativepathwithnofile='mo/' . dol_sanitizeFileName($object->id).'/';
+ $relativepathwithnofile='mo/' . dol_sanitizeFileName($object->ref).'/';
+
+ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
+}
+else
+{
+ accessforbidden('', 0, 1);
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php
new file mode 100644
index 00000000000..2f32058a41f
--- /dev/null
+++ b/htdocs/mrp/mo_list.php
@@ -0,0 +1,589 @@
+
+ * 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 .
+ */
+
+/**
+ * \file mo_list.php
+ * \ingroup mrp
+ * \brief List page for mo
+ */
+
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
+//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
+//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
+//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
+//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
+//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
+//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
+//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
+//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
+//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
+//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
+//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
+//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
+//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
+//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL'
+
+// Load Dolibarr environment
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+
+// load mrp libraries
+require_once __DIR__ . '/class/mo.class.php';
+
+// for other modules
+//dol_include_once('/othermodule/class/otherobject.class.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("mrp","other"));
+
+$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
+$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
+$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
+$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
+$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'molist'; // To manage different context of search
+$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
+
+$id = GETPOST('id', 'int');
+
+// Load variable for pagination
+$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$sortfield = GETPOST('sortfield', 'alpha');
+$sortorder = GETPOST('sortorder', 'alpha');
+$page = GETPOST('page', 'int');
+if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
+$offset = $limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+//if (! $sortfield) $sortfield="p.date_fin";
+//if (! $sortorder) $sortorder="DESC";
+
+// Initialize technical objects
+$object = new Mo($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->mrp->dir_output . '/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('molist')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+
+// Default sort order (if not yet defined by previous GETPOST)
+if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
+if (! $sortorder) $sortorder="ASC";
+
+// Security check
+if (empty($conf->mrp->enabled)) accessforbidden('Module not enabled');
+$socid=0;
+if ($user->societe_id > 0) // Protection if external user
+{
+ //$socid = $user->societe_id;
+ accessforbidden();
+}
+//$result = restrictedArea($user, 'mrp', $id, '');
+
+
+// Initialize array of search criterias
+$search_all=trim(GETPOST("search_all", 'alpha'));
+$search=array();
+foreach($object->fields as $key => $val)
+{
+ if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
+}
+
+// List of fields to search into when doing a "search in all"
+$fieldstosearchall = array();
+foreach($object->fields as $key => $val)
+{
+ if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
+}
+
+// Definition of fields for list
+$arrayfields=array();
+foreach($object->fields as $key => $val)
+{
+ // If $val['visible']==0, then we never show the field
+ if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
+}
+// Extra fields
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
+{
+ foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
+ {
+ if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
+ $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
+ }
+}
+$object->fields = dol_sort_array($object->fields, 'position');
+$arrayfields = dol_sort_array($arrayfields, 'position');
+
+
+
+/*
+ * Actions
+ */
+
+if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
+if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
+
+$parameters=array();
+$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+if (empty($reshook))
+{
+ // Selection of new fields
+ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
+
+ // Purge search criteria
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') ||GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
+ {
+ foreach($object->fields as $key => $val)
+ {
+ $search[$key]='';
+ }
+ $toselect='';
+ $search_array_options=array();
+ }
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
+ || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
+ {
+ $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
+ }
+
+ // Mass actions
+ $objectclass='Mo';
+ $objectlabel='Mo';
+ $permtoread = $user->rights->mrp->read;
+ $permtodelete = $user->rights->mrp->delete;
+ $uploaddir = $conf->mrp->dir_output;
+ include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
+}
+
+
+
+/*
+ * View
+ */
+
+$form=new Form($db);
+
+$now=dol_now();
+
+//$help_url="EN:Module_Mo|FR:Module_Mo_FR|ES:Módulo_Mo";
+$help_url='';
+$title = $langs->trans('ListOfManufacturingOrders');
+
+
+// Build and execute select
+// --------------------------------------------------------------------
+$sql = 'SELECT ';
+foreach($object->fields as $key => $val)
+{
+ $sql.='t.'.$key.', ';
+}
+// Add fields from extrafields
+if (! empty($extrafields->attributes[$object->table_element]['label']))
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
+// Add fields from hooks
+$parameters=array();
+$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql.=$hookmanager->resPrint;
+$sql=preg_replace('/, $/', '', $sql);
+$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
+if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")";
+else $sql.=" WHERE 1 = 1";
+foreach($search as $key => $val)
+{
+ if ($key == 'status' && $search[$key] == -1) continue;
+ $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
+ if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
+}
+if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
+// Add where from extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
+// Add where from hooks
+$parameters=array();
+$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql.=$hookmanager->resPrint;
+
+/* If a group by is required
+$sql.= " GROUP BY "
+foreach($object->fields as $key => $val)
+{
+ $sql.='t.'.$key.', ';
+}
+// Add fields from extrafields
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
+// Add where from hooks
+$parameters=array();
+$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
+$sql.=$hookmanager->resPrint;
+$sql=preg_replace('/, $/','', $sql);
+*/
+
+$sql.=$db->order($sortfield, $sortorder);
+
+// Count total nb of records
+$nbtotalofrecords = '';
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+{
+ $resql = $db->query($sql);
+ $nbtotalofrecords = $db->num_rows($resql);
+ if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
+ {
+ $page = 0;
+ $offset = 0;
+ }
+}
+// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
+if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
+{
+ $num = $nbtotalofrecords;
+}
+else
+{
+ $sql.= $db->plimit($limit+1, $offset);
+
+ $resql=$db->query($sql);
+ if (! $resql)
+ {
+ dol_print_error($db);
+ exit;
+ }
+
+ $num = $db->num_rows($resql);
+}
+
+// Direct jump if only one record found
+if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
+{
+ $obj = $db->fetch_object($resql);
+ $id = $obj->rowid;
+ header("Location: ".dol_buildpath('/mrp/mo_card.php', 1).'?id='.$id);
+ exit;
+}
+
+
+// Output page
+// --------------------------------------------------------------------
+
+llxHeader('', $title, $help_url);
+
+// Example : Adding jquery code
+print '';
+
+$arrayofselected=is_array($toselect)?$toselect:array();
+
+$param='';
+if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
+foreach($search as $key => $val)
+{
+ if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey);
+ else $param.= '&search_'.$key.'='.urlencode($search[$key]);
+}
+if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
+// Add $param from extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
+
+// List of mass actions available
+$arrayofmassactions = array(
+ //'validate'=>$langs->trans("Validate"),
+ //'generate_doc'=>$langs->trans("ReGeneratePDF"),
+ //'builddoc'=>$langs->trans("PDFMerge"),
+ //'presend'=>$langs->trans("SendByMail"),
+);
+if ($user->rights->mrp->delete) $arrayofmassactions['predelete']=' '.$langs->trans("Delete");
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
+$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
+
+print ''."\n";
+
+if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
+{
+ $hidegeneratedfilelistifempty=1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
+
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+ $formfile = new FormFile($db);
+
+ // Show list of available documents
+ $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource.=str_replace('&', '&', $param);
+
+ $filedir=$diroutputmassaction;
+ $genallowed=$user->rights->mrp->read;
+ $delallowed=$user->rights->mrp->write;
+
+ print $formfile->showdocuments('massfilesarea_mrp', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php
new file mode 100644
index 00000000000..a006f79a609
--- /dev/null
+++ b/htdocs/mrp/mo_note.php
@@ -0,0 +1,165 @@
+
+ * 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 .
+ */
+
+/**
+ * \file mo_note.php
+ * \ingroup mrp
+ * \brief Car with notes on Mo
+ */
+
+// 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 && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
+if (! $res) die("Include of main fails");
+
+dol_include_once('/mrp/class/mo.class.php');
+dol_include_once('/mrp/lib/mrp_mo.lib.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("mrp","companies"));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'alpha');
+$cancel = GETPOST('cancel', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
+// Initialize technical objects
+$object=new Mo($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('monote','globalcard')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Security check - Protection if external user
+//if ($user->societe_id > 0) access_forbidden();
+//if ($user->societe_id > 0) $socid = $user->societe_id;
+//$result = restrictedArea($user, 'mrp', $id);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity] . "/" . $object->id;
+
+$permissionnote=1;
+//$permissionnote=$user->rights->mrp->creer; // Used by the include of actions_setnotes.inc.php
+
+
+
+/*
+ * Actions
+ */
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
+$help_url='';
+llxHeader('', $langs->trans('Mo'), $help_url);
+
+if ($id > 0 || ! empty($ref))
+{
+ $object->fetch_thirdparty();
+
+ $head = moPrepareHead($object);
+
+ dol_fiche_head($head, 'note', $langs->trans("Mo"), -1, $object->picto);
+
+ // Object card
+ // ------------------------------------------------------------
+ $linkback = '' . $langs->trans("BackToList") . ' ';
+
+ $morehtmlref='';
+ /*
+ // Ref customer
+ $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+ // Thirdparty
+ $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref.='
'.$langs->trans('Project') . ' ';
+ if ($user->rights->mrp->creer)
+ {
+ if ($action != 'classify')
+ //$morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ $morehtmlref.=' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='
';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
+ } else {
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.='
';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.=' ';
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ }*/
+ $morehtmlref.='
';
+
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+
+ print '';
+ print '
';
+
+
+ $cssclass="titlefield";
+ include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
+
+ print '
';
+
+ dol_fiche_end();
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/mrp/modulebuilder.txt b/htdocs/mrp/modulebuilder.txt
new file mode 100644
index 00000000000..24ea0d6eac5
--- /dev/null
+++ b/htdocs/mrp/modulebuilder.txt
@@ -0,0 +1,3 @@
+# DO NOT DELETE THIS FILE MANUALLY
+# File to flag module built using official module template.
+# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module.
\ No newline at end of file
diff --git a/htdocs/mrp/sql/llx_mrp_mo.key.sql b/htdocs/mrp/sql/llx_mrp_mo.key.sql
new file mode 100644
index 00000000000..071a663dd56
--- /dev/null
+++ b/htdocs/mrp/sql/llx_mrp_mo.key.sql
@@ -0,0 +1,35 @@
+-- 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 http://www.gnu.org/licenses/.
+
+
+-- BEGIN MODULEBUILDER INDEXES
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_rowid (rowid);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_ref (ref);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_entity (entity);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_qty (qty);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_soc (fk_soc);
+ALTER TABLE llx_mrp_mo ADD CONSTRAINT llx_mrp_mo_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES user(rowid);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_status (status);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_product (fk_product);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_start_planned (date_start_planned);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_end_planned (date_end_planned);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_bom (fk_bom);
+ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_project (fk_project);
+-- END MODULEBUILDER INDEXES
+
+--ALTER TABLE llx_mrp_mo ADD UNIQUE INDEX uk_mrp_mo_fieldxy(fieldx, fieldy);
+
+--ALTER TABLE llx_mrp_mo ADD CONSTRAINT llx_mrp_mo_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mrp_myotherobject(rowid);
+
diff --git a/htdocs/mrp/sql/llx_mrp_mo.sql b/htdocs/mrp/sql/llx_mrp_mo.sql
new file mode 100644
index 00000000000..dbb8b0faa01
--- /dev/null
+++ b/htdocs/mrp/sql/llx_mrp_mo.sql
@@ -0,0 +1,39 @@
+-- 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 http://www.gnu.org/licenses/.
+
+
+CREATE TABLE llx_mrp_mo(
+ -- BEGIN MODULEBUILDER FIELDS
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ ref varchar(128) DEFAULT '(PROV)' NOT NULL,
+ entity integer DEFAULT 1 NOT NULL,
+ label varchar(255),
+ qty real NOT NULL,
+ fk_soc integer,
+ note_public text,
+ note_private text,
+ date_creation datetime NOT NULL,
+ tms timestamp,
+ fk_user_creat integer NOT NULL,
+ fk_user_modif integer,
+ import_key varchar(14),
+ status integer NOT NULL,
+ fk_product integer NOT NULL,
+ date_start_planned datetime,
+ date_end_planned datetime,
+ fk_bom integer,
+ fk_project integer
+ -- END MODULEBUILDER FIELDS
+) ENGINE=innodb;
\ No newline at end of file
diff --git a/htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql b/htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql
new file mode 100644
index 00000000000..5b280acc41f
--- /dev/null
+++ b/htdocs/mrp/sql/llx_mrp_mo_extrafields.key.sql
@@ -0,0 +1,19 @@
+-- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson
+--
+-- 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/.
+
+
+-- BEGIN MODULEBUILDER INDEXES
+ALTER TABLE llx_mrp_myobject_extrafields ADD INDEX idx_fk_object(fk_object);
+-- END MODULEBUILDER INDEXES
diff --git a/htdocs/mrp/sql/llx_mrp_mo_extrafields.sql b/htdocs/mrp/sql/llx_mrp_mo_extrafields.sql
new file mode 100644
index 00000000000..9245ac1c341
--- /dev/null
+++ b/htdocs/mrp/sql/llx_mrp_mo_extrafields.sql
@@ -0,0 +1,23 @@
+-- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see http://www.gnu.org/licenses/.
+
+create table llx_mrp_myobject_extrafields
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp,
+ fk_object integer NOT NULL,
+ import_key varchar(14) -- import key
+) ENGINE=innodb;
+
diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php
index 1cdab974833..cdd8db1a0bd 100644
--- a/htdocs/opensurvey/card.php
+++ b/htdocs/opensurvey/card.php
@@ -171,7 +171,6 @@ if (empty($reshook))
}
if ($action == 'edit') {
-
// Security check
if (!$user->rights->opensurvey->write) accessforbidden();
}
@@ -365,7 +364,6 @@ print ''."\n";
print '';
if ($action != 'edit' && $user->rights->opensurvey->write) {
-
//Modify button
print '
'.$langs->trans("Modify") . ' ';
diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php
index 281c5188ecd..48c633126ce 100644
--- a/htdocs/opensurvey/class/opensurveysondage.class.php
+++ b/htdocs/opensurvey/class/opensurveysondage.class.php
@@ -381,7 +381,6 @@ class Opensurveysondage extends CommonObject
if (! $error)
{
-
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$this->db->escape($numsondage)."'";
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql);
diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php
index ad31d99e645..017779b74f7 100644
--- a/htdocs/opensurvey/results.php
+++ b/htdocs/opensurvey/results.php
@@ -180,7 +180,6 @@ if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format =
// Add column (with format date)
if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
{
-
// Security check
if (!$user->rights->opensurvey->write) accessforbidden();
@@ -189,7 +188,6 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
if (isset($_POST["nouveaujour"]) && $_POST["nouveaujour"] != "vide" &&
isset($_POST["nouveaumois"]) && $_POST["nouveaumois"] != "vide" &&
isset($_POST["nouvelleannee"]) && $_POST["nouvelleannee"] != "vide") {
-
$nouvelledate=dol_mktime(0, 0, 0, $_POST["nouveaumois"], $_POST["nouveaujour"], $_POST["nouvelleannee"]);
if (isset($_POST["nouvelleheuredebut"]) && $_POST["nouvelleheuredebut"]!="vide"){
@@ -622,7 +620,6 @@ print '
'."\n";
// loop to show the delete link
if ($user->rights->opensurvey->write) {
for ($i = 0; isset($toutsujet[$i]); $i++) {
-
print '
'."\n";
}
}
diff --git a/htdocs/opensurvey/wizard/choix_autre.php b/htdocs/opensurvey/wizard/choix_autre.php
index 58d9108708b..a8a1f8248d1 100644
--- a/htdocs/opensurvey/wizard/choix_autre.php
+++ b/htdocs/opensurvey/wizard/choix_autre.php
@@ -86,7 +86,6 @@ if (isset($_POST["confirmecreation"]))
if ($testremplissage != "ok" || (!$toutchoix)) {
setEventMessages($langs->trans("ErrorOpenSurveyOneChoice"), null, 'errors');
} else {
-
//format du sondage AUTRE
$_SESSION["formatsondage"]="A";
diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php
index a05d428b695..3692f79048e 100644
--- a/htdocs/opensurvey/wizard/choix_date.php
+++ b/htdocs/opensurvey/wizard/choix_date.php
@@ -42,7 +42,6 @@ $erreur = false;
// Insert survey
if (GETPOST('confirmation'))
{
-
// We save hours entered
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('nbrecaseshoraires', $_SESSION) === true)
{
@@ -537,8 +536,8 @@ if (issetAndNoEmpty('totalchoixjour', $_SESSION) || $erreur)
//si on voit une erreur, le fond de la case est rouge
if (isset($errheure[$i][$j]) && $errheure[$i][$j]) {
print '
'."\n";
- } else { //sinon la case est vide normalement
-
+ } else {
+ //sinon la case est vide normalement
print '
'."\n";
}
}
diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php
index ae2ea6861c7..8c71ff0fcb7 100644
--- a/htdocs/printing/admin/printing.php
+++ b/htdocs/printing/admin/printing.php
@@ -341,7 +341,6 @@ if ($mode == 'userconf' && $user->admin)
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
$resql = $db->query($sql);
while ($row=$db->fetch_array($resql)) {
-
print '
';
print ''.$row['login'].' ';
print ''.$row['module'].' ';
diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php
index f4105b040bb..299f78c1a7d 100644
--- a/htdocs/product/admin/price_rules.php
+++ b/htdocs/product/admin/price_rules.php
@@ -35,13 +35,11 @@ if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->e
*/
if ($_POST) {
-
$var_percent = GETPOST('var_percent', 'array');
$var_min_percent = GETPOST('var_min_percent', 'array');
$fk_level = GETPOST('fk_level', 'array');
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
-
$check = isset($var_min_percent[$i]);
if ($i != 1) {
@@ -70,7 +68,6 @@ if ($_POST) {
}
if (!$check1 || !$check2) {
-
//If the level is between range but percent fields are empty, then we ensure it does not exist in DB
if ($check1) {
$db->query("DELETE FROM ".MAIN_DB_PREFIX."product_pricerules WHERE level = ".(int) $i);
@@ -83,7 +80,6 @@ if ($_POST) {
".(int) $i.", ".$db->escape($i_fk_level).", ".$i_var_percent.", ".$i_var_min_percent.")";
if (!$db->query($sql)) {
-
//If we could not create, then we try updating
$sql = "UPDATE ".MAIN_DB_PREFIX."product_pricerules
SET fk_level = ".$db->escape($i_fk_level).", var_percent = ".$i_var_percent.", var_min_percent = ".$i_var_min_percent." WHERE level = ".$i;
diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php
index 3f0a8e150d3..5fd289c5514 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -434,7 +434,6 @@ foreach ($dirmodels as $reldir)
{
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);
diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php
index 111992e4c81..4210a3a560a 100644
--- a/htdocs/product/admin/product_tools.php
+++ b/htdocs/product/admin/product_tools.php
@@ -292,7 +292,6 @@ if (empty($mysoc->country_code))
}
else
{
-
print '