mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Fix php-cs
This commit is contained in:
@@ -84,8 +84,12 @@ $permissiontodelete = $user->rights->intracommreport->delete;
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->intracommreport->enabled)) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
if (empty($conf->intracommreport->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$permissiontoread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -401,7 +401,6 @@ class IntracommReport extends CommonObject
|
||||
*/
|
||||
public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i)
|
||||
{
|
||||
|
||||
global $conf;
|
||||
|
||||
if ($type == 'expedition') {
|
||||
|
||||
@@ -67,12 +67,14 @@ if (!$sortorder) {
|
||||
// Initialize context for list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'intracommreportlist';
|
||||
if ((string) $type == '1') {
|
||||
$contextpage = 'DESlist'; if ($search_type == '') {
|
||||
$contextpage = 'DESlist';
|
||||
if ($search_type == '') {
|
||||
$search_type = '1';
|
||||
}
|
||||
}
|
||||
if ((string) $type == '0') {
|
||||
$contextpage = 'DEBlist'; if ($search_type == '') {
|
||||
$contextpage = 'DEBlist';
|
||||
if ($search_type == '') {
|
||||
$search_type = '0';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,13 +599,15 @@ class KnowledgeRecord extends CommonObject
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'knowledgerecord/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'knowledgerecord/".$this->db->escape($this->newref)."'";
|
||||
$sql .= " WHERE filepath = 'knowledgerecord/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
@@ -912,7 +914,9 @@ class KnowledgeRecord extends CommonObject
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
if ($status == self::STATUS_VALIDATED) {
|
||||
$statusType = 'status4';
|
||||
}
|
||||
if ($status == self::STATUS_CANCELED) {
|
||||
$statusType = 'status6';
|
||||
}
|
||||
|
||||
@@ -83,7 +83,8 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
$coyymm = ''; $max = '';
|
||||
$coyymm = '';
|
||||
$max = '';
|
||||
|
||||
$posindice = strlen($this->prefix) + 6;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
@@ -99,7 +100,8 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord
|
||||
if ($resql) {
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) {
|
||||
$coyymm = substr($row[0], 0, 6); $max = $row[0];
|
||||
$coyymm = substr($row[0], 0, 6);
|
||||
$max = $row[0];
|
||||
}
|
||||
}
|
||||
if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
|
||||
|
||||
@@ -37,7 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
|
||||
*/
|
||||
abstract class ModelePDFKnowledgeRecord extends CommonDocGenerator
|
||||
{
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
|
||||
@@ -110,19 +110,23 @@ if (empty($reshook)) {
|
||||
$rate = price2num(GETPOST('rate'));
|
||||
|
||||
if (!$capital) {
|
||||
$error++; $action = 'create';
|
||||
$error++;
|
||||
$action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
|
||||
}
|
||||
if (!$datestart) {
|
||||
$error++; $action = 'create';
|
||||
$error++;
|
||||
$action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
|
||||
}
|
||||
if (!$dateend) {
|
||||
$error++; $action = 'create';
|
||||
$error++;
|
||||
$action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
|
||||
}
|
||||
if ($rate == '') {
|
||||
$error++; $action = 'create';
|
||||
$error++;
|
||||
$action = 'create';
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
@@ -352,7 +352,8 @@ class LoanSchedule extends CommonObject
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@@ -387,7 +388,8 @@ class LoanSchedule extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,7 +567,6 @@ class LoanSchedule extends CommonObject
|
||||
*/
|
||||
public function paimenttorecord($loanid, $datemax)
|
||||
{
|
||||
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT p.rowid";
|
||||
|
||||
@@ -358,7 +358,8 @@ class PaymentLoan extends CommonObject
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@@ -397,7 +398,8 @@ class PaymentLoan extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +410,8 @@ class PaymentLoan extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -196,8 +196,7 @@ if ($action == 'add_payment') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else // Only add fk_bank bank to schedule line (mark as paid)
|
||||
{
|
||||
} else { // Only add fk_bank bank to schedule line (mark as paid)
|
||||
$line->fk_bank = $payment->fk_bank;
|
||||
$line->fk_payment_loan = $payment->id;
|
||||
$result = $line->update($user, 0);
|
||||
|
||||
@@ -80,7 +80,8 @@ if (GETPOST("button_search_x") || GETPOST("button_search")) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
|
||||
@@ -31,7 +31,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
|
||||
@@ -35,7 +35,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
|
||||
@@ -31,7 +31,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
@@ -199,7 +200,9 @@ if ($action == 'updateMask') {
|
||||
$tmpobject->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
|
||||
|
||||
@@ -203,7 +203,8 @@ class ActionsMyModule extends CommonHookActions
|
||||
|
||||
$outputlangs = $langs;
|
||||
|
||||
$ret = 0; $deltemp = array();
|
||||
$ret = 0;
|
||||
$deltemp = array();
|
||||
dol_syslog(get_class($this).'::executeHooks action='.$action);
|
||||
|
||||
/* print_r($parameters); print_r($object); echo "action: " . $action; */
|
||||
@@ -230,7 +231,8 @@ class ActionsMyModule extends CommonHookActions
|
||||
|
||||
$outputlangs = $langs;
|
||||
|
||||
$ret = 0; $deltemp = array();
|
||||
$ret = 0;
|
||||
$deltemp = array();
|
||||
dol_syslog(get_class($this).'::executeHooks action='.$action);
|
||||
|
||||
/* print_r($parameters); print_r($object); echo "action: " . $action; */
|
||||
|
||||
@@ -475,7 +475,9 @@ class MyObject extends CommonObject
|
||||
// single value
|
||||
$sqlwhere[] = $key . " = " . intval($value);
|
||||
} elseif (is_array($value)) {
|
||||
if (empty($value)) continue;
|
||||
if (empty($value)) {
|
||||
continue;
|
||||
}
|
||||
$sqlwhere[] = $key . ' IN (' . $this->db->sanitize(implode(',', array_map('intval', $value))) . ')';
|
||||
}
|
||||
continue;
|
||||
@@ -662,13 +664,15 @@ class MyObject extends CommonObject
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'myobject/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'myobject/".$this->db->escape($this->newref)."'";
|
||||
$sql .= " WHERE filepath = 'myobject/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
|
||||
@@ -913,7 +913,9 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
||||
global $conf, $langs;
|
||||
|
||||
$ltrdirection = 'L';
|
||||
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
|
||||
if ($outputlangs->trans("DIRECTION") == 'rtl') {
|
||||
$ltrdirection = 'R';
|
||||
}
|
||||
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "bills", "propal", "companies"));
|
||||
|
||||
@@ -83,7 +83,8 @@ class mod_myobject_standard extends ModeleNumRefMyObject
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
$coyymm = ''; $max = '';
|
||||
$coyymm = '';
|
||||
$max = '';
|
||||
|
||||
$posindice = strlen($this->prefix) + 6;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
@@ -99,7 +100,8 @@ class mod_myobject_standard extends ModeleNumRefMyObject
|
||||
if ($resql) {
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) {
|
||||
$coyymm = substr($row[0], 0, 6); $max = $row[0];
|
||||
$coyymm = substr($row[0], 0, 6);
|
||||
$max = $row[0];
|
||||
}
|
||||
}
|
||||
if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
|
||||
|
||||
@@ -41,8 +41,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
$trclass = 'oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
||||
$trclass .= ' liste_sub_total';
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("MyObject"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
|
||||
@@ -56,7 +56,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
|
||||
@@ -64,7 +64,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
|
||||
@@ -33,7 +33,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
|
||||
@@ -50,7 +50,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
@@ -150,7 +151,9 @@ if ($enablepermissioncheck) {
|
||||
if (!isModEnabled("mymodule")) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
if (!$permissiontoread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -54,7 +54,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
@@ -501,11 +502,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if (empty($reshook))
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||
print '</table>';
|
||||
|
||||
@@ -31,7 +31,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
@@ -97,7 +98,9 @@ if ($enablepermissioncheck) {
|
||||
if (!isModEnabled("mymodule")) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
if (!$permissiontoread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -52,7 +52,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
|
||||
@@ -203,7 +203,9 @@ if ($enablepermissioncheck) {
|
||||
}
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
@@ -211,7 +213,9 @@ if ($user->socid > 0) accessforbidden();
|
||||
if (!isModEnabled("mymodule")) {
|
||||
accessforbidden('Module mymodule not enabled');
|
||||
}
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
if (!$permissiontoread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -53,7 +53,8 @@ if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
// 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--;
|
||||
$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";
|
||||
@@ -124,7 +125,9 @@ if ($enablepermissioncheck) {
|
||||
if (!isModEnabled("mymodule")) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
if (!$permissiontoread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
|
||||
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
||||
if (!defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions
|
||||
if (!defined('NOSESSION')) {
|
||||
define('NOSESSION', '1');
|
||||
} // On CLI mode, no need to use web sessions
|
||||
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
@@ -68,7 +70,8 @@ $res = 0;
|
||||
// Try master.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--;
|
||||
$i--;
|
||||
$j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/master.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1))."/master.inc.php";
|
||||
@@ -99,7 +102,8 @@ $langs->load("main"); // To load language file for default language
|
||||
// Load user and its permissions
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!($result > 0)) {
|
||||
dol_print_error('', $user->error); exit;
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
||||
|
||||
@@ -50,7 +50,9 @@ if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")";
|
||||
$sql .= " WHERE ps.fk_product = " .((int) $fk_product);
|
||||
if ($warehouse_id > 0) $sql .= " AND fk_entrepot = '" . ((int) $warehouse_id) . "'";
|
||||
if ($warehouse_id > 0) {
|
||||
$sql .= " AND fk_entrepot = '" . ((int) $warehouse_id) . "'";
|
||||
}
|
||||
$sql .= " ORDER BY e.ref, pb.batch";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@@ -74,7 +76,9 @@ if ($action == 'updateselectbatchbywarehouse' && $permissiontoproduce) {
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")";
|
||||
$sql .= " WHERE ps.fk_product = " .((int) $fk_product);
|
||||
if ($batch) $sql.= " AND pb.batch = '" . $db->escape($batch) . "'";
|
||||
if ($batch) {
|
||||
$sql.= " AND pb.batch = '" . $db->escape($batch) . "'";
|
||||
}
|
||||
$sql .= " ORDER BY e.ref, pb.batch";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@@ -739,7 +739,9 @@ class Mo extends CommonObject
|
||||
$moline->fk_mo = $this->id;
|
||||
$moline->origin_id = $line->id;
|
||||
$moline->origin_type = 'bomline';
|
||||
if (!empty($line->fk_unit)) $moline->fk_unit = $line->fk_unit;
|
||||
if (!empty($line->fk_unit)) {
|
||||
$moline->fk_unit = $line->fk_unit;
|
||||
}
|
||||
if ($line->qty_frozen) {
|
||||
$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
|
||||
} else {
|
||||
@@ -755,7 +757,9 @@ class Mo extends CommonObject
|
||||
$moline->position = $line->position;
|
||||
$moline->qty_frozen = $line->qty_frozen;
|
||||
$moline->disable_stock_change = $line->disable_stock_change;
|
||||
if (!empty($line->fk_default_workstation)) $moline->fk_default_workstation = $line->fk_default_workstation;
|
||||
if (!empty($line->fk_default_workstation)) {
|
||||
$moline->fk_default_workstation = $line->fk_default_workstation;
|
||||
}
|
||||
|
||||
$resultline = $moline->create($user, false); // Never use triggers here
|
||||
if ($resultline <= 0) {
|
||||
@@ -792,7 +796,9 @@ class Mo extends CommonObject
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if ($this->status != self::STATUS_DRAFT) return 1;
|
||||
if ($this->status != self::STATUS_DRAFT) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@@ -805,14 +811,18 @@ class Mo extends CommonObject
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$moLine = new MoLine($this->db);
|
||||
$res = $moLine->fetch($obj->rowid);
|
||||
if (!$res) $error++;
|
||||
if (!$res) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($moLine->role == 'toconsume' || $moLine->role == 'toproduce') {
|
||||
if (empty($moLine->qty_frozen)) {
|
||||
$qty = $newQty * $moLine->qty / $oldQty;
|
||||
$moLine->qty = price2num($qty, 'MS');
|
||||
$res = $moLine->update($user);
|
||||
if (!$res) $error++;
|
||||
if (!$res) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1074,13 +1084,15 @@ class Mo extends CommonObject
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'mrp/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'mrp/".$this->db->escape($this->newref)."'";
|
||||
$sql .= " WHERE filepath = 'mrp/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
@@ -1574,7 +1586,9 @@ class Mo extends CommonObject
|
||||
$objectline = new MoLine($this->db);
|
||||
|
||||
$TFilters = array('customsql'=>'fk_mo = '.((int) $this->id));
|
||||
if (!empty($rolefilter)) $TFilters['role'] = $rolefilter;
|
||||
if (!empty($rolefilter)) {
|
||||
$TFilters['role'] = $rolefilter;
|
||||
}
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, $TFilters);
|
||||
|
||||
if (is_numeric($result)) {
|
||||
@@ -1713,7 +1727,9 @@ class Mo extends CommonObject
|
||||
$reshook = 0;
|
||||
if (is_object($hookmanager)) {
|
||||
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
|
||||
if (!empty($line->fk_parent_line)) { $parameters['fk_parent_line'] = $line->fk_parent_line; }
|
||||
if (!empty($line->fk_parent_line)) {
|
||||
$parameters['fk_parent_line'] = $line->fk_parent_line;
|
||||
}
|
||||
$reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
@@ -1798,7 +1814,6 @@ class Mo extends CommonObject
|
||||
*/
|
||||
public function getMoChilds()
|
||||
{
|
||||
|
||||
$TMoChilds = array();
|
||||
$error = 0;
|
||||
|
||||
@@ -1814,8 +1829,11 @@ class Mo extends CommonObject
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$MoChild = new Mo($this->db);
|
||||
$res = $MoChild->fetch($obj->rowid);
|
||||
if ($res > 0) $TMoChilds[$MoChild->id] = $MoChild;
|
||||
else $error++;
|
||||
if ($res > 0) {
|
||||
$TMoChilds[$MoChild->id] = $MoChild;
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1837,16 +1855,22 @@ class Mo extends CommonObject
|
||||
*/
|
||||
public function getAllMoChilds($depth = 0)
|
||||
{
|
||||
if ($depth > 1000) return -1;
|
||||
if ($depth > 1000) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$TMoChilds = array();
|
||||
$error = 0;
|
||||
|
||||
$childMoList = $this->getMoChilds();
|
||||
|
||||
if ($childMoList == -1) return -1;
|
||||
if ($childMoList == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
foreach ($childMoList as $childMo) $TMoChilds[$childMo->id] = $childMo;
|
||||
foreach ($childMoList as $childMo) {
|
||||
$TMoChilds[$childMo->id] = $childMo;
|
||||
}
|
||||
|
||||
foreach ($childMoList as $childMo) {
|
||||
$childMoChildren = $childMo->getAllMoChilds($depth + 1);
|
||||
@@ -1889,7 +1913,9 @@ class Mo extends CommonObject
|
||||
if ($this->db->num_rows($resql) > 0) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$res = $MoParent->fetch($obj->id_moparent);
|
||||
if ($res < 0) $error++;
|
||||
if ($res < 0) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -365,9 +365,7 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
mrpCollapseBomManagement();
|
||||
|
||||
?>
|
||||
mrpCollapseBomManagement(); ?>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
jQuery('#fk_bom').change(function() {
|
||||
@@ -496,8 +494,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if ($action == 'delete') {
|
||||
$numberofmochilds = count($object->getAllMoChilds());
|
||||
|
||||
if ($numberofmochilds > 0)$label = $langs->trans("DeleteMoChild", '('.strval($numberofmochilds).')');
|
||||
else $label = $langs->trans("DeleteMoChild");
|
||||
if ($numberofmochilds > 0) {
|
||||
$label = $langs->trans("DeleteMoChild", '('.strval($numberofmochilds).')');
|
||||
} else {
|
||||
$label = $langs->trans("DeleteMoChild");
|
||||
}
|
||||
|
||||
$formquestion = array(
|
||||
array('type' => 'checkbox', 'name' => 'deletechilds', 'label' => $label, 'value' => 0),
|
||||
|
||||
@@ -686,7 +686,9 @@ while ($i < $imaxinloop) {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif ($key == 'fk_parent_line') {
|
||||
$moparent = $object->getMoParent();
|
||||
if (is_object($moparent)) print $moparent->getNomUrl(1);
|
||||
if (is_object($moparent)) {
|
||||
print $moparent->getNomUrl(1);
|
||||
}
|
||||
} elseif ($key == 'rowid') {
|
||||
print $object->showOutputField($val, $key, $object->id, '');
|
||||
} else {
|
||||
|
||||
@@ -168,7 +168,8 @@ $arrayofselected = array();
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
|
||||
@@ -204,7 +204,9 @@ if (empty($reshook)) {
|
||||
$moline->fk_default_workstation = $tmpproduct->fk_default_workstation;
|
||||
}
|
||||
$moline->disable_stock_change = ($tmpproduct->type == Product::TYPE_SERVICE ? 1 : 0);
|
||||
if ($conf->global->PRODUCT_USE_UNITS) $moline->fk_unit = $tmpproduct->fk_unit;
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
$moline->fk_unit = $tmpproduct->fk_unit;
|
||||
}
|
||||
}
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
@@ -216,7 +218,9 @@ if (empty($reshook)) {
|
||||
unset($_POST["options_".$key]);
|
||||
}
|
||||
}
|
||||
if (is_array($array_options) && count($array_options) > 0) $moline->array_options = $array_options;
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$moline->array_options = $array_options;
|
||||
}
|
||||
|
||||
$resultline = $moline->create($user, false); // Never use triggers here
|
||||
if ($resultline <= 0) {
|
||||
@@ -1307,7 +1311,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<td class="right"><input type="text" class="width50 right" id="qtytoconsume-' . $line->id . '-' . $i . '" name="qty-' . $line->id . '-' . $i . '" value="' . $preselected . '" ' . $disable . '></td>';
|
||||
|
||||
// Unit
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td></td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
// Cost
|
||||
if ($permissiontoupdatecost && getDolGlobalString('MRP_SHOW_COST_FOR_CONSUMPTION')) {
|
||||
@@ -1430,7 +1436,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Qty
|
||||
print '<td class="right">'.$langs->trans("Qty").'</td>';
|
||||
/// Unit
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td class="right">'.$langs->trans("Unit").'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td class="right">'.$langs->trans("Unit").'</td>';
|
||||
}
|
||||
// Cost price
|
||||
if ($permissiontoupdatecost) {
|
||||
if (empty($bomcostupdated)) {
|
||||
@@ -1481,7 +1489,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Qty
|
||||
print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
|
||||
//Unit
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td></td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td></td>';
|
||||
}
|
||||
// Cost price
|
||||
if ($permissiontoupdatecost) {
|
||||
print '<td></td>';
|
||||
@@ -1546,7 +1556,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Qty
|
||||
print '<td class="right">'.$line->qty.'</td>';
|
||||
// Unit
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td class="right">'.measuringUnitString($line->fk_unit, '', '', 1).'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td class="right">'.measuringUnitString($line->fk_unit, '', '', 1).'</td>';
|
||||
}
|
||||
// Cost price
|
||||
if ($permissiontoupdatecost) {
|
||||
// Defined $manufacturingcost
|
||||
@@ -1643,7 +1655,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Qty
|
||||
print '<td></td>';
|
||||
// Unit
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td></td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td></td>';
|
||||
}
|
||||
// Cost price
|
||||
if ($permissiontoupdatecost) {
|
||||
print '<td></td>';
|
||||
@@ -1694,7 +1708,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Qty
|
||||
print '<td class="right"><input type="text" class="width50 right" id="qtytoproduce-'.$line->id.'-'.$i.'" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
|
||||
//Unit
|
||||
if ($conf->global->PRODUCT_USE_UNITS) print '<td class="right"></td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td class="right"></td>';
|
||||
}
|
||||
// Cost
|
||||
if ($permissiontoupdatecost) {
|
||||
// Defined $manufacturingcost
|
||||
@@ -1751,7 +1767,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right" class="splitall">';
|
||||
if (($action == 'consumeorproduce' || $action == 'consumeandproduceall') && $tmpproduct->status_batch == 2) print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" onClick="addDispatchLine('.$line->id.', \'batch\', \'alltoproduce\')"'); //
|
||||
if (($action == 'consumeorproduce' || $action == 'consumeandproduceall') && $tmpproduct->status_batch == 2) {
|
||||
print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" onClick="addDispatchLine('.$line->id.', \'batch\', \'alltoproduce\')"');
|
||||
} //
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
@@ -1778,9 +1796,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline'))) {
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
} ?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
|
||||
@@ -77,7 +77,9 @@ if ($object->element == 'mo') {
|
||||
$k = 0;
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->rowid && $obj->rowid > 0) $k = $obj->rowid;
|
||||
if ($obj->rowid && $obj->rowid > 0) {
|
||||
$k = $obj->rowid;
|
||||
}
|
||||
}
|
||||
echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>';
|
||||
echo '</td>';
|
||||
|
||||
@@ -375,8 +375,9 @@ class MultiCurrencies extends DolibarrApi
|
||||
|
||||
// Clear all fields out of interrest
|
||||
foreach ($object as $key => $value) {
|
||||
if ($key == "id" || $key == "rate" || $key == "date_sync")
|
||||
if ($key == "id" || $key == "rate" || $key == "date_sync") {
|
||||
continue;
|
||||
}
|
||||
unset($object->$key);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,12 @@ if (empty($page) || $page == -1) {
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = "cr.date_sync";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "cr.date_sync";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
|
||||
|
||||
// Initialize technical objects
|
||||
@@ -218,12 +222,19 @@ if ($action == "confirm_delete") {
|
||||
}
|
||||
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
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 ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
@@ -326,14 +337,20 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr ';
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid";
|
||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($search_date_sync && $search_date_sync_end) {
|
||||
$sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')";
|
||||
} elseif ($search_date_sync && !$search_date_sync_end) {
|
||||
$sql .= natural_search('cr.date_sync', $db->idate($search_date_sync));
|
||||
}
|
||||
if ($search_rate) $sql .= natural_search('cr.rate', $search_rate);
|
||||
if ($search_code) $sql .= natural_search('m.code', $search_code);
|
||||
if ($search_rate) {
|
||||
$sql .= natural_search('cr.rate', $search_rate);
|
||||
}
|
||||
if ($search_code) {
|
||||
$sql .= natural_search('m.code', $search_code);
|
||||
}
|
||||
$sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'";
|
||||
|
||||
// Add where from hooks
|
||||
@@ -383,10 +400,18 @@ if ($resql) {
|
||||
$param .= "&sall=".urlencode($sall);
|
||||
}
|
||||
|
||||
if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync;
|
||||
if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end;
|
||||
if ($search_rate) $param = "&search_rate=".urlencode($search_rate);
|
||||
if ($search_code != '') $param.="&search_code=".urlencode($search_code);
|
||||
if ($search_date_sync) {
|
||||
$param = "&search_date_sync=".$search_date_sync;
|
||||
}
|
||||
if ($search_date_sync_end) {
|
||||
$param="&search_date_sync_end=".$search_date_sync_end;
|
||||
}
|
||||
if ($search_rate) {
|
||||
$param = "&search_rate=".urlencode($search_rate);
|
||||
}
|
||||
if ($search_code != '') {
|
||||
$param.="&search_code=".urlencode($search_code);
|
||||
}
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
@@ -529,7 +554,9 @@ if ($resql) {
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print $obj->date_sync;
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// code
|
||||
@@ -539,7 +566,9 @@ if ($resql) {
|
||||
print ' - <span class="opacitymedium">'.$obj->name.'</span>';
|
||||
print "</td>\n";
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// rate
|
||||
@@ -547,7 +576,9 @@ if ($resql) {
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print $obj->rate;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// rate indirect
|
||||
@@ -555,7 +586,9 @@ if ($resql) {
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print $obj->rate_indirect;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -233,7 +233,8 @@ class Opensurveysondage extends CommonObject
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
@@ -435,7 +436,8 @@ class Opensurveysondage extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ function dol_survey_random($car)
|
||||
{
|
||||
$string = "";
|
||||
$chaine = "abcdefghijklmnopqrstuvwxyz123456789";
|
||||
mt_srand((double) microtime() * 1000000);
|
||||
mt_srand((float) microtime() * 1000000);
|
||||
for ($i = 0; $i < $car; $i++) {
|
||||
$string .= $chaine[mt_rand() % strlen($chaine)];
|
||||
}
|
||||
|
||||
@@ -118,7 +118,8 @@ $permissiontodelete = $user->rights->opensurvey->write;
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
|
||||
Reference in New Issue
Block a user