forked from Wavyzz/dolibarr
Clean code
This commit is contained in:
@@ -1235,7 +1235,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
$sqlwhere .= "(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp)."'";
|
||||
$sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')";
|
||||
} else { // reset is done on january
|
||||
$sqlwhere .= '(SUBSTRING('.$field.', '.$yearpos.', '.$yearlen.") = '".$db->escape($yearcomp)."')";
|
||||
$sqlwhere .= "(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp)."')";
|
||||
}
|
||||
}
|
||||
//print "sqlwhere=".$sqlwhere." yearcomp=".$yearcomp."<br>\n"; // sqlwhere and yearcomp defined only if we ask a reset
|
||||
@@ -1250,7 +1250,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
if ($posnumstart < 0) {
|
||||
return 'ErrorBadMaskFailedToLocatePosOfSequence';
|
||||
}
|
||||
$sqlstring = 'SUBSTRING('.$field.', '.($posnumstart + 1).', '.dol_strlen($maskcounter).')';
|
||||
$sqlstring = "SUBSTRING(".$field.", ".($posnumstart + 1).", ".dol_strlen($maskcounter).")";
|
||||
|
||||
// Define $maskLike
|
||||
$maskLike = dol_string_nospecial($mask);
|
||||
@@ -1291,7 +1291,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
$sql .= $where;
|
||||
}
|
||||
if ($sqlwhere) {
|
||||
$sql .= ' AND '.$sqlwhere;
|
||||
$sql .= " AND ".$sqlwhere;
|
||||
}
|
||||
|
||||
//print $sql.'<br>';
|
||||
@@ -1351,7 +1351,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
$sql .= $where;
|
||||
}
|
||||
if ($sqlwhere) {
|
||||
$sql .= ' AND '.$sqlwhere;
|
||||
$sql .= " AND ".$sqlwhere;
|
||||
}
|
||||
|
||||
dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG);
|
||||
@@ -1414,7 +1414,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
if ($sqlwhere) {
|
||||
$maskrefclient_sql .= ' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
||||
}
|
||||
$maskrefclient_sql .= ' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode, $maskrefclient) + 1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$db->escape($maskrefclient_clientcode)."')";
|
||||
$maskrefclient_sql .= " AND (SUBSTRING(".$field.", ".(strpos($maskwithnocode, $maskrefclient) + 1).", ".dol_strlen($maskrefclient_maskclientcode).") = '".$db->escape($maskrefclient_clientcode)."')";
|
||||
|
||||
dol_syslog("functions2::get_next_value maskrefclient", LOG_DEBUG);
|
||||
$maskrefclient_resql = $db->query($maskrefclient_sql);
|
||||
@@ -2250,7 +2250,7 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
|
||||
$listofparentid = array();
|
||||
|
||||
// Get list of all id in array listofid and all parents in array listofparentid
|
||||
$sql = 'SELECT rowid, '.$fieldfkparent.' as parent_id FROM '.MAIN_DB_PREFIX.$tabletocleantree;
|
||||
$sql = "SELECT rowid, ".$fieldfkparent." as parent_id FROM ".MAIN_DB_PREFIX.$tabletocleantree;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
Reference in New Issue
Block a user