Merge branch 'develop' into fixphpcs_2020_12

This commit is contained in:
Laurent Destailleur 2020-12-21 18:08:20 +01:00 committed by GitHub
commit 6d1799eb25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 262 additions and 171 deletions

View File

@ -268,7 +268,7 @@ script:
# Ensure we catch errors
set -e
#parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
parallel-lint --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \

View File

@ -12,6 +12,11 @@ The script initdemo.sh will erase current database with data into mysqldump_doli
Do a chmod 700 initdemo.sh
then run ./initdemo.sh to launch Graphic User Interface.
After loading the demo files, admin login may be:
- admin / admin
or
- admin / adminadmin
*** Save demo

View File

@ -53,7 +53,7 @@ then
DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \
$DIALOG --title "Reset login password" --clear \
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
valret=$?
case $valret in
@ -70,7 +70,7 @@ then
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \
$DIALOG --title "Reset login password" --clear \
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
valret=$?
@ -128,7 +128,7 @@ then
# ---------------------------- confirmation
DIALOG=${DIALOG=dialog}
$DIALOG --title "Init demo login with demo values" --clear \
$DIALOG --title "Reset login password" --clear \
--yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55
case $? in

View File

@ -6,7 +6,7 @@
<exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">build/aps</exclude-pattern>
<exclude-pattern type="relative">dev/namespacemig</exclude-pattern>
<exclude-pattern type="relative">dev/tools/test/namespacemig</exclude-pattern>
<exclude-pattern type="relative">dev/initdata/dbf/includes</exclude-pattern>
<exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>

View File

@ -45,15 +45,15 @@ print load_fiche_titre($langs->trans("InfoDatabase"), '', 'title_setup');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n";
print '</table>';
print '</div>';
@ -62,7 +62,7 @@ print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300"><a href="'.DOL_URL_ROOT.'/admin/system/database-tables.php?mainmenu=home">'.$langs->trans("List").'</a></td></tr>'."\n";
print '<tr class="oddeven"><td width="300"><a href="'.DOL_URL_ROOT.'/admin/system/database-tables.php?mainmenu=home">'.$langs->trans("List").'</a></td></tr>'."\n";
print '</table>';
print '</div>';
@ -104,7 +104,7 @@ if (!count($listofvars) && !count($listofstatus))
print '<td>';
print $param;
print '</td>';
print '<td>';
print '<td class="wordbreak">';
$show = 0; $text = '';
foreach ($arraytest as $key => $val)
{

View File

@ -286,7 +286,10 @@ if ($object->id > 0)
print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td>';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
print '<tr>';

View File

@ -208,7 +208,7 @@ $contracttmp = new Contrat($db);
$sql = 'SELECT';
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") as lower_planned_end_date,";
@ -263,7 +263,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,';
$sql .= " typent.code,";
$sql .= " state.code_departement, state.nom";
// Add fields from extrafields
@ -341,7 +341,7 @@ if ($socid > 0)
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($sall != '') $param .= '&sall='.urlencode($sall);
if ($search_contract != '') $param .= '&search_contract='.urlencode($search_contract);
if ($search_name != '') $param .= '&search_name='.urlencode($search_name);
@ -596,6 +596,10 @@ if (!empty($arrayfields['status']['checked'])) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$totalarray = array();
$typenArray = array();
$cacheCountryIDCode = array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
@ -608,6 +612,24 @@ while ($i < min($num, $limit))
if ($obj->socid > 0) {
$result = $socstatic->fetch($obj->socid);
}
/*$socstatic->id = $obj->socid;
$socstatic->name = $obj->name;
$socstatic->name_alias = $obj->name_alias;
$socstatic->email = $obj->email;
$socstatic->status = $obj->company_status;
$socstatic->logo = $obj->logo;
$socstatic->country_id = $obj->country_id;
$socstatic->country_code = '';
$socstatic->country_label = '';*/
if ($obj->country_id > 0) {
if (!isset($cacheCountryIDCode[$obj->country_id]['code'])) {
$tmparray = getCountry($obj->country_id, 'all');
$cacheCountryIDCode[$obj->country_id] = array('code'=> empty($tmparray['code']) ? '' : $tmparray['code'], 'label' => empty($tmparray['label']) ? '' : $tmparray['label']);
}
$socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code'];
$socstatic->country_label = $cacheCountryIDCode[$obj->country_id]['label'];
}
print '<tr class="oddeven">';
@ -643,9 +665,8 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['s.nom']['checked']))
{
print '<td>';
//print '<a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a>';
if ($obj->socid > 0)
{
if ($obj->socid > 0) {
// TODO Use a cache for this string
print $socstatic->getNomUrl(1, '');
}
print '</td>';
@ -680,8 +701,7 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="center">';
$tmparray = getCountry($obj->fk_pays, 'all');
print $tmparray['label'];
print $socstatic->country_label;
print '</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@ -117,7 +117,7 @@ class box_scheduled_jobs extends ModeleBoxes
$cronstatic->getNomUrl(1),
$cronstatic->datelastrun,
$cronstatic->status,
$cronstatic->getLibStatut(2)
$cronstatic->getLibStatut(3)
);
$line++;
}
@ -135,18 +135,18 @@ class box_scheduled_jobs extends ModeleBoxes
$cronstatic->getNomUrl(1),
$cronstatic->datenextrun,
$cronstatic->status,
$cronstatic->getLibStatut(2)
$cronstatic->getLibStatut(3)
);
}
foreach ($resultarray as $line => $value) {
$this->info_box_contents[$line][] = array(
'td' => 'class="left"',
'td' => 'class="tdoverflowmax200"',
'text' => $resultarray[$line][0]
);
$this->info_box_contents[$line][] = array(
'td' => 'class="left"',
'td' => 'class="nowraponall"',
'textnoformat' => $resultarray[$line][1]
);
$this->info_box_contents[$line][] = array(
@ -154,18 +154,18 @@ class box_scheduled_jobs extends ModeleBoxes
'textnoformat' => (empty($resultarray[$line][2]) ? '' : $form->textwithpicto(dol_print_date($resultarray[$line][2], "dayhoursec"), $langs->trans("CurrentTimeZone")))
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" ',
'td' => 'class="center" ',
'textnoformat' => $resultarray[$line][4]
);
$line++;
}
$this->info_box_contents[$line][] = array(
'td' => 'class="left" colspan="2"',
'td' => 'class="tdoverflowmax300" colspan="3"',
'text' => $langs->trans("NumberScheduledJobError")
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" colspan="2"',
'textnoformat' => ($nbjobsinerror ? '<span class="error"><a href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'">'.$nbjobsinerror.'</a></span>'.img_error() : '<span class="opacitymedium">'.$langs->trans("None").'<span>')
'td' => 'class="center"',
'textnoformat' => ($nbjobsinerror ? '<span class="error"><a href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'">'.$nbjobsinerror.img_error() : '<div class="center badge-status4">0</div></a></span>')
);
} else {
$this->info_box_contents[0][0] = array(

View File

@ -3292,7 +3292,7 @@ abstract class CommonObject
/**
* Fetch array of objects linked to current object (object of enabled modules only). Links are loaded into
* this->linkedObjectsIds array and
* this->linkedObjectsIds array +
* this->linkedObjects array if $loadalsoobjects = 1
* Possible usage for parameters:
* - all parameters empty -> we look all link to current object (current object can be source or target)
@ -3405,6 +3405,7 @@ abstract class CommonObject
{
// Parse element/subelement (ex: project_task, cabinetmed_consultation, ...)
$module = $element = $subelement = $objecttype;
$regs = array();
if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier'
&& preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs))
{

View File

@ -891,7 +891,6 @@ class DolGraph
$color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]);
$color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]);
$this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor : \'#e6e6e6\' }' . "\n";
//$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
$this->stringtoshow .= '});' . "\n";
$this->stringtoshow .= '}' . "\n";
}

View File

@ -4230,7 +4230,7 @@ function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $m
/**
* Get title line of an array
*
* @param string $name Translation key of field
* @param string $name Translation key of field to show or complete HTML string to show
* @param int $thead 0=To use with standard table format, 1=To use inside <thead><tr>, 2=To use with <div>
* @param string $file Url used when we click on sort picto
* @param string $field Field to use for new sorting. Empty if this field is not sortable. Example "t.abc" or "t.abc,t.def"
@ -4277,7 +4277,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
}
$out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
//$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
$out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
$out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
$out .= '>';
if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field

View File

@ -759,7 +759,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter
$regClient = array();
$regClientRef = array();
if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef))
{
$maskrefclient = $regClientRef[1].$regClientRef[2];
@ -791,8 +791,8 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
}
// Extract value for user
if (preg_match('/\{(u+)\}/i', $mask, $regType))
{
$regType = array();
if (preg_match('/\{(u+)\}/i', $mask, $regType)) {
$lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
if (is_object($objuser)) $lastname = $objuser->lastname;
@ -931,12 +931,10 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$sqlwhere .= " (SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp1)."'";
$sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') ";
$sqlwhere .= ')';
} elseif ($resetEveryMonth)
{
} elseif ($resetEveryMonth) {
$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
{
} else { // reset is done on january
$sqlwhere .= '(SUBSTRING('.$field.', '.$yearpos.', '.$yearlen.") = '".$db->escape($yearcomp)."')";
}
}
@ -1040,8 +1038,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
} else dol_print_error($db);
$numFinal = $ref;
} elseif ($mode == 'next')
{
} elseif ($mode == 'next') {
$counter++;
// If value for $counter has a length higher than $maskcounter chars
@ -1184,8 +1181,7 @@ function check_value($mask, $value)
$hasglobalcounter = false;
// Extract value for mask counter, mask raz and mask offset
$reg = array();
if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg))
{
if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) {
$masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : '');
$maskcounter = $reg[1];
$hasglobalcounter = true;
@ -1253,31 +1249,25 @@ function check_value($mask, $value)
if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask';
//print "x".$maskwithonlyymcode." ".$maskraz;
}
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
// Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter)
//
if (function_exists('mb_strrpos')) {
$posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8');
}
else {
$posnumstart = strrpos($maskwithnocode, $maskcounter);
} // Pos of counter in final string (from 0 to ...)
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
// Check length
$len = dol_strlen($maskwithnocode);
if (dol_strlen($value) != $len) $result = -1;
// Check we have a number in $value at position ($posnumstart+1).', '.dol_strlen($maskcounter)
// TODO
// Define $maskLike
/* seems not used
$maskLike = dol_string_nospecial($mask);
$maskLike = str_replace("%","_",$maskLike);
// Replace protected special codes with matching number of _ as wild card caracter
$maskLike = str_replace(dol_string_nospecial('{yyyy}'),'____',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{yy}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
*/
// Check length
$len = dol_strlen($maskwithnocode);
if (dol_strlen($value) != $len) $result = -1;
dol_syslog("functions2::check_value result=".$result, LOG_DEBUG);
return $result;
dol_syslog("functions2::check_value result=".$result, LOG_DEBUG);
return $result;
}
/**

View File

@ -272,7 +272,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -5 Other (see this->error)
* -5 NotConfigured - Setup empty so any value may be ok or not
* -6 Other (see this->error)
*/
public function verif($db, &$code, $soc, $type)
{
@ -299,12 +300,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$this->error = 'NotConfigured';
return -5;
}
$result = check_value($mask, $code);
if (is_string($result))
{
$this->error = $result;
return -5;
return -6;
}
}

View File

@ -187,11 +187,14 @@ if ($object->id > 0)
if ($object->fournisseur)
{
print '<tr>';
print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td>';
print '</tr>';
print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>';
print $object->code_fournisseur;
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>';
print '</tr>';
$langs->load('compta');
print '<tr>';

View File

@ -552,3 +552,6 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1);
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);
ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL;

View File

@ -35,6 +35,7 @@ create table llx_projet
fk_statut integer DEFAULT 0 NOT NULL, -- open or close
fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities
opp_percent double(5,2),
fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose)
date_close datetime DEFAULT NULL,
fk_user_close integer DEFAULT NULL,
note_private text,

View File

@ -96,21 +96,27 @@ if ($socid > 0)
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
if ($object->client)
{
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print '</td></tr>';
}
if ($object->client)
{
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $object->fournisseur && !empty($user->rights->fournisseur->lire))
{
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}

View File

@ -154,9 +154,7 @@ if (empty($reshook))
// Mass actions
$objectclass = 'PaymentSalary';
$objectlabel = 'SalariesPayments';
$permissiontoread = $user->rights->salaries->read;
$permissiontodelete = $user->rights->salaries->delete;
$uploaddir = $conf->bom->dir_output;
$uploaddir = $conf->salaries->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// Validate records
@ -308,7 +306,7 @@ print '<input class="flat" type="text" size="6" name="search_user" value="'.$db-
print '</td>';
// Label
print '<td class="liste_titre"><input type="text" class="flat width150" name="search_label" value="'.$db->escape($search_label).'"></td>';
// Date
// Date payment
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
@ -317,6 +315,9 @@ print '<div class="nowrap">';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
// Date value
print '<td class="liste_titre center">';
print '</td>';
// Type
print '<td class="liste_titre left">';
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
@ -352,7 +353,8 @@ print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
@ -421,6 +423,10 @@ while ($i < ($limit ? min($num, $limit) : $num))
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
if (!$i) $totalarray['nbfield']++;
// Date value
print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
if (!$i) $totalarray['nbfield']++;
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
if (!$i) $totalarray['nbfield']++;

View File

@ -2281,7 +2281,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td>';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td>';
print '</tr>';
}
@ -2292,7 +2295,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<tr><td>';
print $langs->trans('SupplierCode').'</td><td>';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>';
print '</tr>';
}

View File

@ -2969,6 +2969,8 @@ class Societe extends CommonObject
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
* -5 NotConfigured - Setup empty so any value may be ok or not
* -6 Other (see this->error)
*/
public function check_codeclient()
{

View File

@ -130,7 +130,10 @@ if ($object->client)
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql);
@ -153,7 +156,10 @@ if ($object->fournisseur)
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid;
$resql = $db->query($sql);

View File

@ -136,7 +136,10 @@ if ($object->id)
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
@ -145,7 +148,10 @@ if ($object->id)
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}

View File

@ -94,23 +94,27 @@ if ($object->id > 0)
print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
}
if ($object->client)
{
print '<tr><td class="'.$cssclass.'">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print '</td></tr>';
}
if ($object->client) {
print '<tr><td class="'.$cssclass.'">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
if ($object->fournisseur)
{
print '<tr><td class="'.$cssclass.'">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td></tr>';
}
if ($object->fournisseur) {
print '<tr><td class="'.$cssclass.'">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}
print "</table>";

View File

@ -165,23 +165,27 @@ if ($result > 0)
print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
}
if ($object->client)
{
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print '</td></tr>';
}
if ($object->client) {
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire))
{
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td></tr>';
}
if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) {
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}
/*print '<tr><td class="titlefield">'.$langs->trans("NbOfActiveNotifications").'</td>'; // Notification for this thirdparty
print '<td colspan="3">';

View File

@ -808,7 +808,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="2">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql);
@ -860,7 +863,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="2">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
$sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid;
$resql = $db->query($sql);

View File

@ -215,8 +215,10 @@ if ($object->client) {
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() != 0)
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
@ -224,8 +226,10 @@ if ($object->fournisseur) {
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() != 0)
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}

View File

@ -99,7 +99,10 @@ if ($socid)
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
@ -108,7 +111,10 @@ if ($socid)
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}

View File

@ -184,20 +184,26 @@ if ($id > 0 || !empty($ref))
if ($object->client)
{
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print '</td></tr>';
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
if ($object->fournisseur)
{
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td></tr>';
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}
print '</table>';

View File

@ -213,8 +213,10 @@ if ($object->client) {
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() != 0)
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>';
}
@ -222,8 +224,10 @@ if ($object->fournisseur) {
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() != 0)
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td></tr>';
}

View File

@ -426,30 +426,30 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Customer code
if ($socstat->client && !empty($socstat->code_client)) {
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td>';
print $socstat->code_client;
if ($socstat->check_codeclient() != 0) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td>';
print '</tr>';
}
// Supplier code
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td>';
print $socstat->code_fournisseur;
if ($socstat->check_codefournisseur() != 0) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>';
print '</tr>';
}
// Customer code
if ($socstat->client && !empty($socstat->code_client)) {
print '<tr><td class="titlefield">';
print $langs->trans('CustomerCode').'</td><td>';
print $socstat->code_client;
$tmpcheck = $socstat->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td>';
print '</tr>';
}
// Supplier code
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td>';
print $socstat->code_fournisseur;
$tmpcheck = $socstat->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>';
print '</tr>';
}
print '</table>';
print '</div>';