Merge remote-tracking branch 'upstream/develop' into boxindex

This commit is contained in:
Frédéric FRANCE 2021-03-02 20:41:01 +01:00
commit 6cf8a46095
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
264 changed files with 2798 additions and 1450 deletions

View File

@ -52,6 +52,7 @@ if (empty($argv[1])) {
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit -1;
}
parse_str($argv[1]);
$i=0;
@ -60,9 +61,9 @@ while ($i < $argc) {
parse_str($argv[$i]);
}
if (preg_match('/includeconstant=/', $argv[$i])) {
$tmp=explode(':', $includeconstant, 3);
$tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str()
if (count($tmp) != 3) {
print "Error: Bad parameter includeconstant ".$includeconstant."\n";
print "Error: Bad parameter includeconstant=".$includeconstant."\n";
exit -1;
}
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
@ -157,7 +158,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
*/
$regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir='';

View File

@ -390,6 +390,9 @@ if ($nboftargetok) {
$olddir=getcwd();
chdir("$SOURCE");
print "Clean $SOURCE/htdocs\n";
$ret=`rm -f $SOURCE/htdocs/includes/autoload.php`;
$ret=`git ls-files . --exclude-standard --others`;
if ($ret)
{
@ -613,7 +616,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`;
@ -623,7 +625,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;

View File

@ -88,7 +88,8 @@ $tables=array(
'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel')
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'),
'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close')
);
$year=2010;

View File

@ -215,7 +215,7 @@
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" />
<!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> -->
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />

View File

@ -1670,7 +1670,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$linkeduser->fetch($object->user_id);
print $linkeduser->getNomUrl(-1);
} else {
print $langs->trans("NoDolibarrAccess");
print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
}
}
print '</td></tr>';

View File

@ -30,6 +30,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php';
if (!$user->admin) {
accessforbidden();
@ -80,6 +81,30 @@ if ($action == 'set') {
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
$defaultValues = new DefaultValues($db);
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
if (!is_array($result) && $result<0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
} elseif (count($result)>0) {
foreach ($result as $defval) {
$defaultValues->id=$defval->id;
$resultDel = $defaultValues->delete($user);
if ($resultDel<0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
}
}
}
$defaultValues->type='createform';
$defaultValues->entity=$conf->entity;
$defaultValues->user_id=0;
$defaultValues->page='comm/action/card.php';
$defaultValues->param='complete';
$defaultValues->value=GETPOST('AGENDA_EVENT_DEFAULT_STATUS');
$resultCreat=$defaultValues->create($user);
if ($resultCreat<0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
}
} elseif ($action == 'specimen') { // For orders
$modele = GETPOST('module', 'alpha');
@ -325,6 +350,22 @@ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '</td></tr>'."\n";
}
// AGENDA_EVENT_DEFAULT_STATUS
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right nowrap">'."\n";
$defval='na';
$defaultValues = new DefaultValues($db);
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
if (!is_array($result) && $result<0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
} elseif (count($result)>0) {
$defval=reset($result)->value;
}
$formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200');
print '</td></tr>'."\n";
// AGENDA_DEFAULT_FILTER_TYPE
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").'</td>'."\n";

View File

@ -30,6 +30,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php';
// Load translation files required by the page
$langs->loadLangs(array('companies', 'products', 'admin', 'sms', 'other', 'errors'));
@ -42,7 +43,7 @@ $id = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optionscss', 'alphanohtml');
$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus'
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus'
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -75,6 +76,7 @@ $value = GETPOST('value', 'restricthtml');
$hookmanager->initHooks(array('admindefaultvalues', 'globaladmin'));
$object = new DefaultValues($db);
/*
* Actions
*/
@ -136,41 +138,54 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
}
if (!$error) {
$db->begin();
if ($action == 'add' || (GETPOST('add') && $action != 'update')) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."default_values(type, user_id, page, param, value, entity) VALUES ('".$db->escape($mode)."', 0, '".$db->escape($defaulturl)."','".$db->escape($defaultkey)."','".$db->escape($defaultvalue)."', ".$db->escape($conf->entity).")";
$object->type=$mode;
$object->user_id=0;
$object->page=$defaulturl;
$object->param=$defaultkey;
$object->value=$defaultvalue;
$object->entity=$conf->entity;
$result=$object->create($user);
if ($result<0) {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action = "";
$defaulturl = '';
$defaultkey = '';
$defaultvalue = '';
}
}
if (GETPOST('actionmodify')) {
$sql = "UPDATE ".MAIN_DB_PREFIX."default_values SET page = '".$db->escape($urlpage)."', param = '".$db->escape($key)."', value = '".$db->escape($value)."'";
$sql .= " WHERE rowid = ".$id;
}
$result = $db->query($sql);
if ($result > 0) {
$db->commit();
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action = "";
$defaulturl = '';
$defaultkey = '';
$defaultvalue = '';
} else {
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
$action = '';
$object->id=$id;
$object->type=$mode;
$object->page=$urlpage;
$object->param=$key;
$object->value=$value;
$object->entity=$conf->entity;
$result=$object->update($user);
if ($result<0) {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action = "";
$defaulturl = '';
$defaultkey = '';
$defaultvalue = '';
}
}
}
}
// Delete line from delete picto
if ($action == 'delete') {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."default_values WHERE rowid = ".$db->escape($id);
// Delete const
$result = $db->query($sql);
if ($result >= 0) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} else {
dol_print_error($db);
$object->id=$id;
$result=$object->delete($user);
if ($result<0) {
$action = '';
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -338,43 +353,26 @@ print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("
print "</td>\n";
print '</tr>';
$result=$object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
// Show constants
$sql = "SELECT rowid, entity, type, page, param, value";
$sql .= " FROM ".MAIN_DB_PREFIX."default_values";
$sql .= " WHERE type = '".$db->escape($mode)."'";
$sql .= " AND entity IN (".$user->entity.",".$conf->entity.")";
$sql .= $db->order($sortfield, $sortorder);
dol_syslog("translation::select from table", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
if (!is_array($result) && $result<0) {
setEventMessages($object->error, $object->errors, 'errors');
} elseif (count($result)>0) {
foreach ($result as $key=>$defaultvalue) {
print "\n";
print '<tr class="oddeven">';
// Page
print '<td>';
if ($action != 'edit' || GETPOST('rowid', 'int') != $obj->rowid) {
print $obj->page;
} else {
print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">';
}
if ($action != 'edit' || GETPOST('rowid', 'int') != $defaultvalue->id) print $defaultvalue->page;
else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($defaultvalue->page).'">';
print '</td>'."\n";
// Field
print '<td>';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) {
print $obj->param;
} else {
print '<input type="text" name="key" value="'.dol_escape_htmltag($obj->param).'">';
}
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print $defaultvalue->param;
else print '<input type="text" name="key" value="'.dol_escape_htmltag($defaultvalue->param).'">';
print '</td>'."\n";
// Value
@ -385,11 +383,8 @@ if ($result) {
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) {
print dol_escape_htmltag($obj->value);
} else {
print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
}
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value);
else print '<input type="text" name="value" value="'.dol_escape_htmltag($defaultvalue->value).'">';
print '</td>';
}
@ -397,13 +392,13 @@ if ($result) {
// Actions
print '<td class="center">';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) {
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) {
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} else {
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$id.'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : 'none').'"></div>';
print '<div name="'.(!empty($defaultvalue->id) ? $defaultvalue->id : 'none').'"></div>';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
}
@ -413,8 +408,6 @@ if ($result) {
print "\n";
$i++;
}
} else {
dol_print_error($db);
}
print '</table>';

View File

@ -248,7 +248,7 @@ if ($action == 'edit') {
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
}

View File

@ -402,13 +402,13 @@ foreach ($dirmodels as $reldir) {
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
@ -417,7 +417,7 @@ foreach ($dirmodels as $reldir) {
if ($conf->global->PROPALE_ADDON_PDF == "$name") {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';

View File

@ -1072,7 +1072,7 @@ if ($action == 'create') {
// Status
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent = -1;
$percent = GETPOST('complete')!=='' ? GETPOST('complete') : -1;
if (GETPOSTISSET('status')) {
$percent = GETPOST('status');
} elseif (GETPOSTISSET('percentage')) {

View File

@ -720,17 +720,17 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
/*
* Last actions
*/
if ($user->rights->agenda->myactions->read) {
/*if ($user->rights->agenda->myactions->read) {
show_array_last_actions_done($max);
}
}*/
/*
* Actions to do
*/
if ($user->rights->agenda->myactions->read) {
/*if ($user->rights->agenda->myactions->read) {
show_array_actions_to_do($max);
}
}*/
/*

View File

@ -215,8 +215,8 @@ if (empty($reshook)) {
}
}
}
} // Delete proposal
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) {
} elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) {
// Delete proposal
$result = $object->delete($user);
if ($result > 0) {
header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1');
@ -225,8 +225,8 @@ if (empty($reshook)) {
$langs->load("errors");
setEventMessages($object->error, $object->errors, 'errors');
}
} // Remove line
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
} elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
// Remove line
$result = $object->deleteline($lineid);
// reorder lines
if ($result) {
@ -250,8 +250,8 @@ if (empty($reshook)) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit();
} // Validation
elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) {
} elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) {
// Validation
$idwarehouse = GETPOST('idwarehouse', 'int');
$result = $object->valid($user);
if ($result >= 0) {
@ -308,17 +308,17 @@ if (empty($reshook)) {
if ($result < 0) {
dol_print_error($db, $object->error);
}
} // Positionne ref client
elseif ($action == 'setref_client' && $usercancreate) {
} elseif ($action == 'setref_client' && $usercancreate) {
// Positionne ref client
$result = $object->set_ref_client($user, GETPOST('ref_client'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} // Set incoterm
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) {
} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) {
// Set incoterm
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} // Create proposal
elseif ($action == 'add' && $usercancreate) {
} elseif ($action == 'add' && $usercancreate) {
// Create proposal
$object->socid = $socid;
$object->fetch_thirdparty();
@ -554,8 +554,8 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} // Standard creation
else {
} else {
// Standard creation
$id = $object->create($user);
}
@ -616,8 +616,8 @@ if (empty($reshook)) {
}
}
}
} // Classify billed
elseif ($action == 'classifybilled' && $usercanclose) {
} elseif ($action == 'classifybilled' && $usercanclose) {
// Classify billed
$db->begin();
$result = $object->cloture($user, $object::STATUS_BILLED, '');
@ -631,8 +631,8 @@ if (empty($reshook)) {
} else {
$db->rollback();
}
} // Close proposal
elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) {
} elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) {
// Close proposal
if (!(GETPOST('statut', 'int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'closeas';
@ -654,8 +654,8 @@ if (empty($reshook)) {
}
}
}
} // Reopen proposal
elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) {
} elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) {
// Reopen proposal
// prevent browser refresh from reopening proposal several times
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
$db->begin();
@ -672,11 +672,11 @@ if (empty($reshook)) {
$db->rollback();
}
}
} // add lines from objectlinked
elseif ($action == 'import_lines_from_object'
} elseif ($action == 'import_lines_from_object'
&& $user->rights->propal->creer
&& $object->statut == Propal::STATUS_DRAFT
) {
// add lines from objectlinked
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
@ -898,8 +898,8 @@ if (empty($reshook)) {
$tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
}
}
} // If price per customer
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// If price per customer
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
@ -924,8 +924,8 @@ if (empty($reshook)) {
}
}
}
} // If price per quantity
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
// If price per quantity
if ($prod->prices_by_qty[0]) { // yes, this product has some prices per quantity
// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
$pqp = GETPOST('pbq', 'int');
@ -945,8 +945,8 @@ if (empty($reshook)) {
break;
}
}
} // If price per quantity and customer
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
// If price per quantity and customer
if ($prod->prices_by_qty[$object->thirdparty->price_level]) { // yes, this product has some prices per quantity
// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
$pqp = GETPOST('pbq', 'int');
@ -975,9 +975,9 @@ if (empty($reshook)) {
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} // On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
elseif ($tmpvat != $tmpprodvat) {
} elseif ($tmpvat != $tmpprodvat) {
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
@ -1167,8 +1167,8 @@ if (empty($reshook)) {
}
}
}
} // Update a line within proposal
elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) {
} elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) {
// Update a line within proposal
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', GETPOST('tva_tx'))) {
@ -1313,36 +1313,36 @@ if (empty($reshook)) {
} elseif ($action == 'classin' && $usercancreate) {
// Set project
$object->setProject(GETPOST('projectid', 'int'));
} // Delivery time
elseif ($action == 'setavailability' && $usercancreate) {
} elseif ($action == 'setavailability' && $usercancreate) {
// Delivery time
$result = $object->set_availability($user, GETPOST('availability_id', 'int'));
} // Origin of the commercial proposal
elseif ($action == 'setdemandreason' && $usercancreate) {
} elseif ($action == 'setdemandreason' && $usercancreate) {
// Origin of the commercial proposal
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int'));
} // Terms of payment
elseif ($action == 'setconditions' && $usercancreate) {
} elseif ($action == 'setconditions' && $usercancreate) {
// Terms of payment
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
} // Payment choice
elseif ($action == 'setmode' && $usercancreate) {
} elseif ($action == 'setmode' && $usercancreate) {
// Payment choice
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
} // Multicurrency Code
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
} elseif ($action == 'setmulticurrencycode' && $usercancreate) {
// Multicurrency Code
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
} // Multicurrency rate
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
} // bank account
elseif ($action == 'setbankaccount' && $usercancreate) {
} elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
// Multicurrency rate
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
} elseif ($action == 'setbankaccount' && $usercancreate) {
// bank account
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} // shipping method
elseif ($action == 'setshippingmethod' && $usercancreate) {
} elseif ($action == 'setshippingmethod' && $usercancreate) {
// shipping method
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
}// warehouse
elseif ($action == 'setwarehouse' && $usercancreate) {
} elseif ($action == 'setwarehouse' && $usercancreate) {
// warehouse
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
} elseif ($action == 'update_extras') {
$object->oldcopy = dol_clone($object);
@ -1383,15 +1383,15 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} // Toggle the status of a contact
elseif ($action == 'swapstatut') {
} elseif ($action == 'swapstatut') {
// Toggle the status of a contact
if ($object->fetch($id) > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
} else {
dol_print_error($db);
}
} // Delete a contact
elseif ($action == 'deletecontact') {
} elseif ($action == 'deletecontact') {
// Delete a contact
$object->fetch($id);
$result = $object->delete_contact($lineid);
@ -1570,7 +1570,8 @@ if ($action == 'create') {
console.log("We have changed the company - Reload page");
var socid = $(this).val();
// reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val();
$("input[name=action]").val("create");
$("form[name=addprop]").submit();
});
});
</script>';
@ -1907,17 +1908,17 @@ if ($action == 'create') {
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250);
} // Confirm delete
elseif ($action == 'delete') {
} elseif ($action == 'delete') {
// Confirm delete
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
} // Confirm reopen
elseif ($action == 'reopen') {
} elseif ($action == 'reopen') {
// Confirm reopen
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1);
} // Confirmation delete product/service line
elseif ($action == 'ask_deleteline') {
} elseif ($action == 'ask_deleteline') {
// Confirmation delete product/service line
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
} // Confirm validate proposal
elseif ($action == 'validate') {
} elseif ($action == 'validate') {
// Confirm validate proposal
$error = 0;
// We verify whether the object is provisionally numbering
@ -2113,6 +2114,24 @@ if ($action == 'create') {
print '</td>';
print '</tr>';
// Payment mode
print '<tr>';
print '<td class="valuefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td class="valuefieldcreate">';
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';
// Delivery date
$langs->load('deliveries');
print '<tr><td>';
@ -2200,24 +2219,6 @@ if ($action == 'create') {
print '</td>';
print '</tr>';
// Payment mode
print '<tr>';
print '<td class="valuefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td class="valuefieldcreate">';
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
// Multicurrency code
@ -2350,7 +2351,7 @@ if ($action == 'create') {
print '<table class="border tableforfield centpercent">';
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';

View File

@ -1651,7 +1651,8 @@ class Propal 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();
}
if (!$error) {
@ -1891,7 +1892,8 @@ class Propal extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'propale/".$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
@ -2457,7 +2459,8 @@ class Propal extends CommonObject
dol_syslog(get_class($this)."::reopen", 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) {
if (!$notrigger) {

View File

@ -95,6 +95,7 @@ $search_availability = GETPOST('search_availability', 'int');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
$search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int');
$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
@ -189,6 +190,7 @@ $arrayfields = array(
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)),
'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0),
'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
@ -222,7 +224,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@ -277,6 +280,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_categ_cus = 0;
$search_fk_cond_reglement = '';
$search_fk_shipping_method = '';
$search_fk_input_reason = '';
$search_fk_mode_reglement = '';
}
if ($object_statut != '') {
@ -414,7 +418,7 @@ $sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total_tt
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql .= ' u.login';
if (!$user->rights->societe->client->voir && !$socid) {
@ -547,6 +551,9 @@ if ($search_fk_cond_reglement > 0) {
if ($search_fk_shipping_method > 0) {
$sql .= " AND p.fk_shipping_method = ".$db->escape($search_fk_shipping_method);
}
if ($search_fk_input_reason > 0) {
$sql .= " AND p.fk_input_reason = ".$db->escape($search_fk_input_reason);
}
if ($search_fk_mode_reglement > 0) {
$sql .= " AND p.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement);
}
@ -735,6 +742,9 @@ if ($resql) {
if ($search_fk_shipping_method > 0) {
$param .= '&search_fk_shipping_method='.$search_fk_shipping_method;
}
if ($search_fk_input_reason > 0) {
$param .= '&search_fk_input_reason='.$search_fk_input_reason;
}
if ($search_fk_mode_reglement > 0) {
$param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement;
}
@ -983,6 +993,12 @@ if ($resql) {
$form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1);
print '</td>';
}
// Source - Input reason
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print '<td class="liste_titre">';
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1);
print '</td>';
}
// Payment term
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '<td class="liste_titre">';
@ -1169,6 +1185,9 @@ if ($resql) {
if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
}
@ -1473,7 +1492,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
//Shipping Method
// Shipping Method
if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
print '<td>';
$form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
@ -1482,6 +1501,17 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Source - input reason
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($form->cache_demand_reason[$obj->fk_input_reason]['label']).'">';
if ($obj->fk_input_reason > 0) {
print $form->cache_demand_reason[$obj->fk_input_reason]['label'];
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Payment terms
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '<td>';

View File

@ -123,7 +123,8 @@ $px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (!$mesg) {
$px1->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
@ -158,7 +159,8 @@ $px2 = new DolGraph();
$mesg = $px2->isGraphKo();
if (!$mesg) {
$px2->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
@ -202,7 +204,8 @@ $px3 = new DolGraph();
$mesg = $px3->isGraphKo();
if (!$mesg) {
$px3->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;

View File

@ -490,7 +490,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'classifyunbilled' && $usercancreate) {
$ret = $object->classifyUnBilled();
$ret = $object->classifyUnBilled($user);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -540,7 +540,7 @@ if (empty($reshook)) {
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
} elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
// Multicurrency rate
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
} elseif ($action == 'setavailability' && $usercancreate) {
$result = $object->availability(GETPOST('availability_id'));
if ($result < 0) {
@ -1580,7 +1580,8 @@ if ($action == 'create' && $usercancreate) {
console.log("We have changed the company - Reload page");
var socid = $(this).val();
// reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val();
$("input[name=action]").val("create");
$("form[name=crea_commande]").submit();
});
});
</script>';

View File

@ -2962,11 +2962,12 @@ class Commande extends CommonOrder
/**
* Classify the order as not invoiced
*
* @return int <0 if ko, >0 if ok
* @param User $user Object user making the change
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
* @return int <0 if ko, >0 if ok
*/
public function classifyUnBilled()
public function classifyUnBilled(User $user, $notrigger = 0)
{
global $conf, $user, $langs;
$error = 0;
$this->db->begin();
@ -2981,12 +2982,14 @@ class Commande extends CommonOrder
$this->billed = 1;
}
// Call trigger
$result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user);
if ($result < 0) {
$error++;
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
// End call triggers
if (!$error) {
$this->billed = 0;

View File

@ -186,14 +186,14 @@ if ($id > 0 || !empty($ref)) {
$permission = $user->rights->banque->modifier;
$permtoedit = $user->rights->banque->modifier;
$param = '&id='.$object->id.'&num='.urlencode($numref);
$moreparam = '&num='.urlencode($numref); ;
$moreparam = '&num='.urlencode($numref);
$relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/";
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
}
} else {
Header('Location: index.php');
header('Location: index.php');
exit;
}

View File

@ -182,7 +182,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@ -1188,8 +1189,8 @@ if ($resql) {
// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
} // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
else {
} else {
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
$balance = $objforbalance->previoustotal;
}
}

View File

@ -72,7 +72,9 @@ $sql .= " ORDER BY c.label";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0; $total = 0; $totalnb = 0;
$i = 0;
$total = 0;
$totalnb = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);

View File

@ -126,7 +126,8 @@ $sql .= " ORDER BY rowid";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0; $total = 0;
$i = 0;
$total = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);

View File

@ -795,13 +795,17 @@ print '</table>';
// Graphs
if ($mode == 'standard') {
$prevyear = $year; $nextyear = $year;
$prevmonth = $month - 1; $nextmonth = $month + 1;
$prevyear = $year;
$nextyear = $year;
$prevmonth = $month - 1;
$nextmonth = $month + 1;
if ($prevmonth < 1) {
$prevmonth = 12; $prevyear--;
$prevmonth = 12;
$prevyear--;
}
if ($nextmonth > 12) {
$nextmonth = 1; $nextyear++;
$nextmonth = 1;
$nextyear++;
}
// For month
@ -818,7 +822,8 @@ if ($mode == 'standard') {
print '</div>';
// For year
$prevyear = $year - 1; $nextyear = $year + 1;
$prevyear = $year - 1;
$nextyear = $year + 1;
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account.(GETPOST("option") != 'all' ? '' : '&option=all')."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
print '<div class="right clearboth margintoponly">'.$link.'</div>';

View File

@ -272,7 +272,8 @@ $sql .= " WHERE rowid=".$rowid;
$sql .= " ORDER BY dateo ASC";
$result = $db->query($sql);
if ($result) {
$i = 0; $total = 0;
$i = 0;
$total = 0;
if ($db->num_rows($result)) {
$objp = $db->fetch_object($result);

View File

@ -134,7 +134,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@ -490,7 +491,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $
print "</tr>\n";
$totalarray = array(); $found = 0; $i = 0; $lastcurrencycode = '';
$totalarray = array();
$found = 0;
$i = 0;
$lastcurrencycode = '';
foreach ($accounts as $key => $type) {
if ($i >= $limit) {

View File

@ -341,8 +341,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
/* ************************************************************************** */
if ($action == 'create') {
// Update fields properties in realtime
if (!empty($conf->use_javascript_ajax))
{
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
setPaymentType();

View File

@ -413,9 +413,11 @@ if ($action == "create" || $action == "start" || $action == 'close') {
for ($i = 1; $i <= $numterminals; $i++) {
$array[$i] = $i;
}
$selectedposnumber = 0; $showempty = 1;
$selectedposnumber = 0;
$showempty = 1;
if ($conf->global->TAKEPOS_NUM_TERMINALS == '1') {
$selectedposnumber = 1; $showempty = 0;
$selectedposnumber = 1;
$showempty = 0;
}
print $form->selectarray('posnumber', $array, GETPOSTISSET('posnumber') ?GETPOST('posnumber', 'int') : $selectedposnumber, $showempty);
//print '<input name="posnumber" type="text" class="maxwidth50" value="'.(GETPOSTISSET('posnumber')?GETPOST('posnumber', 'alpha'):'0').'">';

View File

@ -140,7 +140,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';

View File

@ -233,10 +233,9 @@ if ($resql) {
} else {
if ($conf->global->$var1 == $bankaccount->id) {
$cash += $objp->amount;
}
//elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
//elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
else {
// } elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
//elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
} else {
$other += $objp->amount;
}
}

View File

@ -134,8 +134,8 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
header("Location: index.php");
exit;
}
} // Update record
elseif ($action == 'update' && $user->rights->deplacement->creer) {
} elseif ($action == 'update' && $user->rights->deplacement->creer) {
// Update record
if (!GETPOST('cancel', 'alpha')) {
$result = $object->fetch($id);
@ -159,15 +159,15 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
} // Set into a project
elseif ($action == 'classin' && $user->rights->deplacement->creer) {
} elseif ($action == 'classin' && $user->rights->deplacement->creer) {
// Set into a project
$object->fetch($id);
$result = $object->setProject(GETPOST('projectid', 'int'));
if ($result < 0) {
dol_print_error($db, $object->error);
}
} // Set fields
elseif ($action == 'setdated' && $user->rights->deplacement->creer) {
} elseif ($action == 'setdated' && $user->rights->deplacement->creer) {
// Set fields
$dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int'));
$object->fetch($id);
$result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY');

View File

@ -110,7 +110,8 @@ $px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (!$mesg) {
$px1->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
@ -140,7 +141,8 @@ $px2 = new DolGraph();
$mesg = $px2->isGraphKo();
if (!$mesg) {
$px2->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
@ -184,7 +186,8 @@ $px3 = new DolGraph();
$mesg = $px3->isGraphKo();
if (!$mesg) {
$px3->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;

View File

@ -133,7 +133,8 @@ $error = 0;
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@ -279,14 +280,14 @@ if (empty($reshook)) {
// Set condition
if ($action == 'setconditions' && $user->rights->facture->creer) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} // Set mode
elseif ($action == 'setmode' && $user->rights->facture->creer) {
} elseif ($action == 'setmode' && $user->rights->facture->creer) {
// Set mode
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
} // Set project
elseif ($action == 'classin' && $user->rights->facture->creer) {
} elseif ($action == 'classin' && $user->rights->facture->creer) {
// Set project
$object->setProject(GETPOST('projectid', 'int'));
} // Set bank account
elseif ($action == 'setref' && $user->rights->facture->creer) {
} elseif ($action == 'setref' && $user->rights->facture->creer) {
// Set bank account
//var_dump(GETPOST('ref', 'alpha'));exit;
$result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
if ($result > 0) {
@ -302,32 +303,32 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} // Set bank account
elseif ($action == 'setbankaccount' && $user->rights->facture->creer) {
} elseif ($action == 'setbankaccount' && $user->rights->facture->creer) {
// Set bank account
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} // Set frequency and unit frequency
elseif ($action == 'setfrequency' && $user->rights->facture->creer) {
} elseif ($action == 'setfrequency' && $user->rights->facture->creer) {
// Set frequency and unit frequency
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
} // Set next date of execution
elseif ($action == 'setdate_when' && $user->rights->facture->creer) {
} elseif ($action == 'setdate_when' && $user->rights->facture->creer) {
// Set next date of execution
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
if (!empty($date)) {
$object->setNextDate($date);
}
} // Set max period
elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) {
} elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) {
// Set max period
$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
} // Set auto validate
elseif ($action == 'setauto_validate' && $user->rights->facture->creer) {
} elseif ($action == 'setauto_validate' && $user->rights->facture->creer) {
// Set auto validate
$object->setAutoValidate(GETPOST('auto_validate', 'int'));
} // Set generate pdf
elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) {
} elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) {
// Set generate pdf
$object->setGeneratepdf(GETPOST('generate_pdf', 'int'));
} // Set model pdf
elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) {
} elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) {
// Set model pdf
$object->setModelpdf(GETPOST('modelpdf', 'alpha'));
} // Set status disabled
elseif ($action == 'disable' && $user->rights->facture->creer) {
} elseif ($action == 'disable' && $user->rights->facture->creer) {
// Set status disabled
$db->begin();
$object->fetch($id);
@ -343,8 +344,8 @@ if (empty($reshook)) {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
} // Set status enabled
elseif ($action == 'enable' && $user->rights->facture->creer) {
} elseif ($action == 'enable' && $user->rights->facture->creer) {
// Set status enabled
$db->begin();
$object->fetch($id);
@ -360,11 +361,11 @@ if (empty($reshook)) {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
} // Multicurrency Code
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
} elseif ($action == 'setmulticurrencycode' && $usercancreate) {
// Multicurrency Code
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
} // Multicurrency rate
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
} elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
// Multicurrency rate
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
}
@ -525,9 +526,9 @@ if (empty($reshook)) {
if (!empty($price_ht)) {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} // On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
elseif ($tmpvat != $tmpprodvat) {
} elseif ($tmpvat != $tmpprodvat) {
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {

View File

@ -233,8 +233,8 @@ if (empty($reshook)) {
$action = '';
}
}
} // Delete line
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
} elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) {
// Delete line
$object->fetch($id);
$object->fetch_thirdparty();
@ -386,7 +386,7 @@ if (empty($reshook)) {
} elseif ($action == 'setinvoicedate' && $usercancreate) {
$object->fetch($id);
$old_date_lim_reglement = $object->date_lim_reglement;
$date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']);
$date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'));
if (empty($date)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
@ -563,8 +563,8 @@ if (empty($reshook)) {
} elseif ($action == 'setref_client' && $usercancreate) {
$object->fetch($id);
$object->set_ref_client(GETPOST('ref_client'));
} // Classify to validated
elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) {
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) {
// Classify to validated
$idwarehouse = GETPOST('idwarehouse', 'int');
$object->fetch($id);
@ -2770,15 +2770,15 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} // bascule du statut d'un contact
elseif ($action == 'swapstatut') {
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
} else {
dol_print_error($db);
}
} // Efface un contact
elseif ($action == 'deletecontact') {
} elseif ($action == 'deletecontact') {
// Efface un contact
$object->fetch($id);
$result = $object->delete_contact($lineid);

View File

@ -1181,6 +1181,7 @@ class Facture extends CommonInvoice
foreach ($object->lines as $i => $line) {
if (($object->lines[$i]->info_bits & 0x02) == 0x02) { // We do not clone line of discounts
unset($object->lines[$i]);
continue;
}
// Bloc to update dates of service (month by month only if previously filled and similare to start and end of month)
@ -1207,7 +1208,7 @@ class Facture extends CommonInvoice
}
}
$object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
$object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
}
// Create clone
@ -1972,7 +1973,8 @@ class Facture extends CommonInvoice
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();
}
if (!$error) {
@ -2807,7 +2809,8 @@ class Facture extends CommonInvoice
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'facture/".$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

View File

@ -145,7 +145,8 @@ class PaymentTerm // 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) {
@ -317,7 +318,8 @@ class PaymentTerm // 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
@ -355,7 +357,8 @@ class PaymentTerm // 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();
}
// Commit or rollback

View File

@ -170,7 +170,8 @@ if ($socid > 0) {
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';

View File

@ -248,7 +248,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';

View File

@ -576,7 +576,9 @@ if ($object->id > 0) {
print dol_get_fiche_end();
$numopen = 0; $pending = 0; $numclosed = 0;
$numopen = 0;
$pending = 0;
$numclosed = 0;
// How many Direct debit opened requests ?

View File

@ -133,7 +133,8 @@ $px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (!$mesg) {
$px1->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
@ -168,7 +169,8 @@ $px2 = new DolGraph();
$mesg = $px2->isGraphKo();
if (!$mesg) {
$px2->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
@ -212,7 +214,8 @@ $px3 = new DolGraph();
$mesg = $px3->isGraphKo();
if (!$mesg) {
$px3->SetData($data);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;

View File

@ -88,7 +88,8 @@ $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_starty
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
}
$name = $langs->trans("SellsJournal");

View File

@ -51,7 +51,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$q = GETPOST("q");
if (empty($q)) {
if (GETPOST("month")) {
$date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false);
$date_start = dol_get_first_day($year_start, GETPOST("month"), false);
$date_end = dol_get_last_day($year_start, GETPOST("month"), false);
} else {
$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) {
@ -64,16 +65,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
}
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
}
@ -206,7 +211,8 @@ if ($calc == 0 || $calc == 2) {
$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list)) {
$total = 0; $totalamount = 0;
$total = 0;
$totalamount = 0;
$i = 1;
foreach ($coll_list as $coll) {
if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) {
@ -270,7 +276,8 @@ if ($calc == 0 || $calc == 1) {
$reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list)) {
$total = 0; $totalamount = 0;
$total = 0;
$totalamount = 0;
$i = 1;
foreach ($coll_list as $coll) {
if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) {

View File

@ -50,23 +50,28 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$q = GETPOST("q", "int");
if (empty($q)) {
if (GETPOST("month", "int")) {
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
} else {
$date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false);
$date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
}
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
}
@ -286,8 +291,12 @@ $tmp = dol_getdate($date_end);
$yend = $tmp['year'];
$mend = $tmp['mon'];
$total = 0; $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
$i = 0; $mcursor = 0;
$total = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $mcursor is to avoid too large loop
//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
if ($m == 13) {
@ -537,7 +546,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$i++; $m++;
$i++;
$m++;
if ($i > 2) {
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
@ -546,7 +556,9 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotal = 0;
}
}
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';

View File

@ -61,7 +61,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$q = GETPOST("q", "int");
if (empty($q)) {
if (GETPOST("month", "int")) {
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
} else {
$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) {
@ -74,16 +75,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
}
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
}

View File

@ -559,12 +559,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$alreadypayedlabel = $langs->trans('Received');
$multicurrencyalreadypayedlabel = $langs->trans('MulticurrencyReceived');
if ($facture->type == 2) {
$alreadypayedlabel = $langs->trans("PaidBack"); $multicurrencyalreadypayedlabel = $langs->trans("MulticurrencyPaidBack");
$alreadypayedlabel = $langs->trans("PaidBack");
$multicurrencyalreadypayedlabel = $langs->trans("MulticurrencyPaidBack");
}
$remaindertopay = $langs->trans('RemainderToTake');
$multicurrencyremaindertopay = $langs->trans('MulticurrencyRemainderToTake');
if ($facture->type == 2) {
$remaindertopay = $langs->trans("RemainderToPayBack"); $multicurrencyremaindertopay = $langs->trans("MulticurrencyRemainderToPayBack");
$remaindertopay = $langs->trans("RemainderToPayBack");
$multicurrencyremaindertopay = $langs->trans("MulticurrencyRemainderToPayBack");
}
$i = 0;

View File

@ -235,8 +235,8 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
exit;
}
} // Remove file in doc form
elseif ($action == 'remove_file' && $user->rights->banque->cheque) {
} elseif ($action == 'remove_file' && $user->rights->banque->cheque) {
// Remove file in doc form
if ($object->fetch($id) > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -335,9 +335,8 @@ class Paiement extends CommonObject
dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice, nor situation invoice. We do nothing more.");
} elseif ($remaintopay) {
dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
}
//else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
else {
// } else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
} else {
// If invoice is a down payment, we also convert down payment to discount
if ($invoice->type == Facture::TYPE_DEPOSIT) {
$amount_ht = $amount_tva = $amount_ttc = array();

View File

@ -111,19 +111,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
} else {
$month_end = $month_start;
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}

View File

@ -79,19 +79,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
} else {
$month_end = $month_start;
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}

View File

@ -91,19 +91,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
} else {
$month_end = $month_start;
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}

View File

@ -612,7 +612,8 @@ if ($id > 0) {
$totalpaye = 0;
$num = $db->num_rows($resql);
$i = 0; $total = 0;
$i = 0;
$total = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder paymenttable">';

View File

@ -356,7 +356,8 @@ class ChargeSociales extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {

View File

@ -369,7 +369,8 @@ class PaymentSocialContribution 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
@ -420,7 +421,8 @@ class PaymentSocialContribution 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();
}
}

View File

@ -74,19 +74,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$year_end++;
}
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
}
@ -175,17 +180,21 @@ if ($modetax == 2) {
$calcmode .= '<br>('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')';
// Set period
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$prevyear = $year_start; $prevquarter = $q;
$prevyear = $year_start;
$prevquarter = $q;
if ($prevquarter > 1) {
$prevquarter--;
} else {
$prevquarter = 4; $prevyear--;
$prevquarter = 4;
$prevyear--;
}
$nextyear = $year_start; $nextquarter = $q;
$nextyear = $year_start;
$nextquarter = $q;
if ($nextquarter < 4) {
$nextquarter++;
} else {
$nextquarter = 1; $nextyear++;
$nextquarter = 1;
$nextyear++;
}
$description .= $fsearch;
$builddate = dol_now();

View File

@ -119,19 +119,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$year_end++;
}
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
} else {

View File

@ -100,19 +100,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$year_end++;
}
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
} else {
// TODO We define q

View File

@ -120,19 +120,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$year_end++;
}
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
} else {
// TODO We define q

View File

@ -73,19 +73,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
} else {
$month_end = $month_start;
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}

View File

@ -69,19 +69,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
} else {
$month_end = $month_start;
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}

View File

@ -114,19 +114,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$year_end++;
}
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
} else {

View File

@ -114,19 +114,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$year_end++;
}
}
$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
$date_start = dol_get_first_day($year_start, $month_start, false);
$date_end = dol_get_last_day($year_end, $month_end, false);
}
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
} else {
// TODO We define q

View File

@ -630,7 +630,8 @@ if ($id) {
$totalpaye = 0;
$num = $db->num_rows($resql);
$i = 0; $total = 0;
$i = 0;
$total = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder paymenttable">';

View File

@ -372,7 +372,8 @@ class PaymentVAT 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
@ -423,7 +424,8 @@ class PaymentVAT 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();
}
}

View File

@ -66,7 +66,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$q = GETPOST("q", "int");
if (empty($q)) {
if (GETPOST("month", 'int')) {
$date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false);
$date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false);
$date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false);
} else {
if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter
$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm');
@ -90,16 +91,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
}
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
}

View File

@ -59,7 +59,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$q = GETPOST("q", "int");
if (empty($q)) {
if (GETPOST("month", "int")) {
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
} else {
if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter
$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm');
@ -83,16 +84,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
}
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
}
@ -301,8 +306,12 @@ $tmp = dol_getdate($date_end);
$yend = $tmp['year'];
$mend = $tmp['mon'];
//var_dump($m);
$total = 0; $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
$i = 0; $mcursor = 0;
$total = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $mcursor is to avoid too large loop
//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
@ -535,7 +544,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$i++; $m++;
$i++;
$m++;
if ($i > 2) {
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
@ -544,7 +554,9 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotal = 0;
}
}
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';

View File

@ -66,7 +66,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$q = GETPOST("q", "int");
if (empty($q)) {
if (GETPOST("month", "int")) {
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
} else {
if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter
$date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm');
@ -90,16 +91,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
}
} else {
if ($q == 1) {
$date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false);
$date_start = dol_get_first_day($year_start, 1, false);
$date_end = dol_get_last_day($year_start, 3, false);
}
if ($q == 2) {
$date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false);
$date_start = dol_get_first_day($year_start, 4, false);
$date_end = dol_get_last_day($year_start, 6, false);
}
if ($q == 3) {
$date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false);
$date_start = dol_get_first_day($year_start, 7, false);
$date_end = dol_get_last_day($year_start, 9, false);
}
if ($q == 4) {
$date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false);
$date_start = dol_get_first_day($year_start, 10, false);
$date_end = dol_get_last_day($year_start, 12, false);
}
}
}
@ -179,7 +184,8 @@ if ($modetax == 2) {
$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')</span>';
// Set period
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$prevyear = $year_start; $prevquarter = $q;
$prevyear = $year_start;
$prevquarter = $q;
if ($prevquarter > 1) {
$prevquarter--;
} else {

View File

@ -108,7 +108,9 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$trackid = GETPOST('trackid', 'aZ09');
}
$subject = ''; $actionmsg = ''; $actionmsg2 = '';
$subject = '';
$actionmsg = '';
$actionmsg2 = '';
$langs->load('mails');

View File

@ -84,7 +84,8 @@ if ($action == 'setModuleOptions') {
$tmpdir = trim($tmpdir);
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (!$tmpdir) {
unset($listofdir[$key]); continue;
unset($listofdir[$key]);
continue;
}
if (!is_dir($tmpdir)) {
if (empty($nomessageinsetmoduleoptions)) {

View File

@ -284,9 +284,8 @@ if ($type == 'directory') {
$perm = $user->rights->ecm->upload;
$formfile->list_of_autoecmfiles($upload_dir, $filearray, $module, $param, 1, '', $perm, 1, $textifempty, $maxlengthname, $url, 1);
}
// Manual list
else {
} else {
// Manual list
if ($module == 'medias') {
/*
$_POST is array like

View File

@ -237,17 +237,14 @@ if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_
// If directory is son of expanded directory, we show line
if (in_array($val['id_mere'], $expandedsectionarray)) {
$showline = 4;
}
// If directory is brother of selected directory, we show line
elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) {
} elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) {
// If directory is brother of selected directory, we show line
$showline = 3;
}
// If directory is parent of selected directory or is selected directory, we show line
elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) {
} elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) {
// If directory is parent of selected directory or is selected directory, we show line
$showline = 2;
}
// If we are level one we show line
elseif ($val['level'] < 2) {
} elseif ($val['level'] < 2) {
// If we are level one we show line
$showline = 1;
}

View File

@ -71,9 +71,8 @@ if ($action == 'firstpingok') {
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);
print 'First ping OK saved for entity '.$conf->entity;
}
// If ko
elseif ($action == 'firstpingko') {
} elseif ($action == 'firstpingko') {
// If ko
// Note: pings are by installation, done on entity 1.
dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt'); // erase last value
print 'First ping KO saved for entity '.$conf->entity;

View File

@ -122,7 +122,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) {
$shownb = 1; $showtot = 1;
$shownb = 1;
$showtot = 1;
}
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) {
@ -154,7 +155,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
$px1->SetData($data1);
unset($data1);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
@ -197,7 +199,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
$px2->SetData($data2);
unset($data2);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

View File

@ -119,7 +119,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) {
$shownb = 1; $showtot = 1;
$shownb = 1;
$showtot = 1;
}
$nowarray = dol_getdate(dol_now(), true);
if (empty($year)) {
@ -197,7 +198,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$px2->SetData($data2);
unset($data2);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

View File

@ -122,7 +122,8 @@ class box_graph_orders_permonth extends ModeleBoxes
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) {
$shownb = 1; $showtot = 1;
$shownb = 1;
$showtot = 1;
}
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) {
@ -193,7 +194,8 @@ class box_graph_orders_permonth extends ModeleBoxes
if (!$mesg) {
$px2->SetData($data2);
unset($data2);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

View File

@ -121,7 +121,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) {
$shownb = 1; $showtot = 1;
$shownb = 1;
$showtot = 1;
}
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) {
@ -192,7 +193,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
if (!$mesg) {
$px2->SetData($data2);
unset($data2);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

View File

@ -101,7 +101,9 @@ class box_graph_product_distribution extends ModeleBoxes
$showordernb = (!empty($tmparray['showordernb']) ? $tmparray['showordernb'] : '');
}
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) {
$showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1;
$showpropalnb = 1;
$showinvoicenb = 1;
$showordernb = 1;
}
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
$showinvoicenb = 0;
@ -154,7 +156,8 @@ class box_graph_product_distribution extends ModeleBoxes
$langs->load("propal");
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
$showpointvalue = 1; $nocolor = 0;
$showpointvalue = 1;
$nocolor = 0;
$stats_proposal = new PropaleStats($this->db, $socid, ($userid > 0 ? $userid : 0));
$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
if (empty($data2)) {
@ -169,7 +172,8 @@ class box_graph_product_distribution extends ModeleBoxes
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
if (!$mesg) {
$i = 0; $legend = array();
$i = 0;
$legend = array();
foreach ($data2 as $key => $val) {
$data2[$key][0] = dol_trunc($data2[$key][0], 32);
@ -210,7 +214,8 @@ class box_graph_product_distribution extends ModeleBoxes
$langs->load("orders");
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
$showpointvalue = 1; $nocolor = 0;
$showpointvalue = 1;
$nocolor = 0;
$mode = 'customer';
$stats_order = new CommandeStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
@ -226,7 +231,8 @@ class box_graph_product_distribution extends ModeleBoxes
$px3 = new DolGraph();
$mesg = $px3->isGraphKo();
if (!$mesg) {
$i = 0; $legend = array();
$i = 0;
$legend = array();
foreach ($data3 as $key => $val) {
$data3[$key][0] = dol_trunc($data3[$key][0], 32);
@ -268,7 +274,8 @@ class box_graph_product_distribution extends ModeleBoxes
$langs->load("bills");
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$showpointvalue = 1; $nocolor = 0;
$showpointvalue = 1;
$nocolor = 0;
$mode = 'customer';
$stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
@ -284,7 +291,8 @@ class box_graph_product_distribution extends ModeleBoxes
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (!$mesg) {
$i = 0; $legend = array();
$i = 0;
$legend = array();
foreach ($data1 as $key => $val) {
$data1[$key][0] = dol_trunc($data1[$key][0], 32);

View File

@ -122,7 +122,8 @@ class box_graph_propales_permonth extends ModeleBoxes
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) {
$shownb = 1; $showtot = 1;
$shownb = 1;
$showtot = 1;
}
$nowarray = dol_getdate(dol_now(), true);
if (empty($endyear)) {
@ -149,7 +150,8 @@ class box_graph_propales_permonth extends ModeleBoxes
$px1->SetType($datatype1);
$px1->SetData($data1);
unset($data1);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
@ -195,7 +197,8 @@ class box_graph_propales_permonth extends ModeleBoxes
$px2->SetType($datatype2);
$px2->SetData($data2);
unset($data2);
$i = $startyear; $legend = array();
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);

View File

@ -578,7 +578,8 @@ class CMailFile
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('mail'));
$parameters = array(); $action = '';
$parameters = array();
$action = '';
$reshook = $hookmanager->executeHooks('sendMail', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->error = "Error in hook maildao sendMail ".$reshook;
@ -815,7 +816,8 @@ class CMailFile
$this->smtps->setHost($server);
$this->smtps->setPort($port); // 25, 465...;
$loginid = ''; $loginpass = '';
$loginid = '';
$loginpass = '';
if (!empty($conf->global->$keyforsmtpid)) {
$loginid = $conf->global->$keyforsmtpid;
$this->smtps->setID($loginid);
@ -946,7 +948,8 @@ class CMailFile
return 'Bad value for sendmode';
}
$parameters = array(); $action = '';
$parameters = array();
$action = '';
$reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->error = "Error in hook maildao sendMailAfter ".$reshook;

View File

@ -151,7 +151,8 @@ class CSMSFile
}
} elseif (!empty($conf->global->MAIN_SMS_SENDMODE)) { // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module'
$tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE);
$classfile = $tmp[0]; $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
$classfile = $tmp[0];
$module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
dol_include_once('/'.$module.'/class/'.$classfile.'.class.php');
try {
$classname = ucfirst($classfile);

View File

@ -130,7 +130,8 @@ class Ccountry // 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) {
@ -246,7 +247,8 @@ class Ccountry // 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
@ -284,7 +286,8 @@ class Ccountry // 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();
}
// Commit or rollback

View File

@ -141,7 +141,8 @@ class Comment 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) {
@ -268,7 +269,8 @@ class Comment 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();
}
if (!$error) {
@ -318,7 +320,8 @@ class Comment extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {

View File

@ -632,9 +632,8 @@ abstract class CommonInvoice extends CommonObject
$datelim = $this->date + ($cdr_nbjour * 3600 * 24);
$datelim += ($cdr_decalage * 3600 * 24);
}
// 1 : application of the "end of the month" rule
elseif ($cdr_type == 1) {
} elseif ($cdr_type == 1) {
// 1 : application of the "end of the month" rule
$datelim = $this->date + ($cdr_nbjour * 3600 * 24);
$mois = date('m', $datelim);
@ -650,9 +649,8 @@ abstract class CommonInvoice extends CommonObject
$datelim -= (3600 * 24);
$datelim += ($cdr_decalage * 3600 * 24);
}
// 2 : application of the rule, the N of the current or next month
elseif ($cdr_type == 2 && !empty($cdr_decalage)) {
} elseif ($cdr_type == 2 && !empty($cdr_decalage)) {
// 2 : application of the rule, the N of the current or next month
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$datelim = $this->date + ($cdr_nbjour * 3600 * 24);

View File

@ -762,7 +762,8 @@ abstract class CommonObject
$out .= img_picto($langs->trans("Address"), 'map-marker-alt');
$out .= '</a> ';
}
$out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++;
$out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
$outdone++;
$outdone++;
// List of extra languages
@ -1181,7 +1182,8 @@ abstract class CommonObject
if (!$notrigger) {
$result = $this->call_trigger(strtoupper($this->element).'_DELETE_CONTACT', $user);
if ($result < 0) {
$this->db->rollback(); return -1;
$this->db->rollback();
return -1;
}
}
@ -3154,9 +3156,8 @@ abstract class CommonObject
return $this->getRangOfLine($fk_parent_line);
}
}
}
// If not, search the last rang of element
else {
} else {
// If not, search the last rang of element
$sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE '.$this->fk_element.' = '.$this->id;
@ -3745,42 +3746,60 @@ abstract class CommonObject
if ($objecttype == 'facture') {
$classpath = 'compta/facture/class';
} elseif ($objecttype == 'facturerec') {
$classpath = 'compta/facture/class'; $module = 'facture';
$classpath = 'compta/facture/class';
$module = 'facture';
} elseif ($objecttype == 'propal') {
$classpath = 'comm/propal/class';
} elseif ($objecttype == 'supplier_proposal') {
$classpath = 'supplier_proposal/class';
} elseif ($objecttype == 'shipping') {
$classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon';
$classpath = 'expedition/class';
$subelement = 'expedition';
$module = 'expedition_bon';
} elseif ($objecttype == 'delivery') {
$classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'delivery_note';
$classpath = 'delivery/class';
$subelement = 'delivery';
$module = 'delivery_note';
} elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') {
$classpath = 'fourn/class'; $module = 'fournisseur';
$classpath = 'fourn/class';
$module = 'fournisseur';
} elseif ($objecttype == 'fichinter') {
$classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter';
$classpath = 'fichinter/class';
$subelement = 'fichinter';
$module = 'ficheinter';
} elseif ($objecttype == 'subscription') {
$classpath = 'adherents/class'; $module = 'adherent';
$classpath = 'adherents/class';
$module = 'adherent';
} elseif ($objecttype == 'contact') {
$module = 'societe';
}
// Set classfile
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
$classfile = strtolower($subelement);
$classname = ucfirst($subelement);
if ($objecttype == 'order') {
$classfile = 'commande'; $classname = 'Commande';
$classfile = 'commande';
$classname = 'Commande';
} elseif ($objecttype == 'invoice_supplier') {
$classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur';
$classfile = 'fournisseur.facture';
$classname = 'FactureFournisseur';
} elseif ($objecttype == 'order_supplier') {
$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
$classfile = 'fournisseur.commande';
$classname = 'CommandeFournisseur';
} elseif ($objecttype == 'supplier_proposal') {
$classfile = 'supplier_proposal'; $classname = 'SupplierProposal';
$classfile = 'supplier_proposal';
$classname = 'SupplierProposal';
} elseif ($objecttype == 'facturerec') {
$classfile = 'facture-rec'; $classname = 'FactureRec';
$classfile = 'facture-rec';
$classname = 'FactureRec';
} elseif ($objecttype == 'subscription') {
$classfile = 'subscription'; $classname = 'Subscription';
$classfile = 'subscription';
$classname = 'Subscription';
} elseif ($objecttype == 'project' || $objecttype == 'projet') {
$classpath = 'projet/class'; $classfile = 'project'; $classname = 'Project';
$classpath = 'projet/class';
$classfile = 'project';
$classname = 'Project';
}
// Here $module, $classfile and $classname are set
@ -4618,7 +4637,8 @@ abstract class CommonObject
$element = $this->element;
$text = ''; $description = '';
$text = '';
$description = '';
// Line in view mode
if ($action != 'editline' || $selected != $line->id) {
@ -4985,7 +5005,8 @@ abstract class CommonObject
if (!$notrigger) {
$result = $this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
if ($result < 0) {
$this->db->rollback(); return -1;
$this->db->rollback();
return -1;
}
}
$this->db->commit();
@ -5106,7 +5127,8 @@ abstract class CommonObject
$tmpdir = trim($tmpdir);
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (!$tmpdir) {
unset($listofdir[$key]); continue;
unset($listofdir[$key]);
continue;
}
if (is_dir($tmpdir)) {
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0);
@ -6343,6 +6365,7 @@ abstract class CommonObject
$out = '';
$type = '';
$isDependList=0;
$param = array();
$param['options'] = array();
$reg = array();
@ -6381,6 +6404,7 @@ abstract class CommonObject
$type = $this->fields[$key]['type'];
}
$label = $this->fields[$key]['label'];
//$elementtype=$this->fields[$key]['elementtype']; // Seems not used
$default = $this->fields[$key]['default'];
@ -6529,7 +6553,6 @@ abstract class CommonObject
// 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
$keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid');
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
$keyList = 'main.'.$InfoFieldList[2].' as rowid';
@ -6633,6 +6656,7 @@ abstract class CommonObject
if (!empty($InfoFieldList[3]) && $parentField) {
$parent = $parentName.':'.$obj->{$parentField};
$isDependList=1;
}
$out .= '<option value="'.$obj->rowid.'"';
@ -6787,6 +6811,7 @@ abstract class CommonObject
if (!empty($InfoFieldList[3]) && $parentField) {
$parent = $parentName.':'.$obj->{$parentField};
$isDependList=1;
}
$data[$obj->rowid] = $labeltoshow;
@ -6875,6 +6900,10 @@ abstract class CommonObject
if (!empty($hidden)) {
$out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>';
}
if ($isDependList==1) {
$out .= $this->getJSListDependancies('_common');
}
/* Add comments
if ($type == 'date') $out.=' (YYYY-MM-DD)';
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
@ -7472,10 +7501,28 @@ abstract class CommonObject
$out .= "\n";
// Add code to manage list depending on others
if (!empty($conf->use_javascript_ajax)) {
$out .= '
$out .= $this->getJSListDependancies();
}
$out .= '<!-- /showOptionals --> '."\n";
}
}
$out .= $hookmanager->resPrint;
return $out;
}
/**
* @param string $type Type for prefix
* @return string Javacript code to manage dependency
*/
public function getJSListDependancies($type = '_extra')
{
$out .= '
<script>
jQuery(document).ready(function() {
function showOptions(child_list, parent_list, orig_select)
function showOptions'.$type.'(child_list, parent_list, orig_select)
{
var val = $("select[name=\""+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
@ -7499,7 +7546,7 @@ abstract class CommonObject
$("select[name=\""+child_list+"\"]").append(options);
}
}
function setListDependencies() {
function setListDependencies'.$type.'() {
jQuery("select option[parent]").parent().each(function() {
var orig_select = {};
var child_list = $(this).attr("name");
@ -7524,7 +7571,7 @@ abstract class CommonObject
//When we change parent list
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list, orig_select[child_list]);
showOptions'.$type.'(child_list, parent_list, orig_select[child_list]);
//Select the value 0 on child list after a change on the parent list
$("#"+child_list).val(0).trigger("change");
//Hide child lists if the parent value is set to 0
@ -7534,21 +7581,13 @@ abstract class CommonObject
});
});
}
setListDependencies();
setListDependencies'.$type.'();
});
</script>'."\n";
}
$out .= '<!-- /showOptionals --> '."\n";
}
}
$out .= $hookmanager->resPrint;
return $out;
}
/**
* Returns the rights used for this class
* @return stdClass

View File

@ -80,6 +80,9 @@ class Conf
'syslog' => array(),
);
// An array to store cache results ->cache['nameofcache']=...
public $cache = array();
public $logbuffer = array();
/**
@ -196,13 +199,13 @@ class Conf
$this->modules_parts[$partname] = array();
}
$this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array
}
// If this is constant for all generic part activated by a module. It initializes
// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
// modules_parts['models'], modules_parts['theme']
// modules_parts['sms'],
// modules_parts['css'], ...
elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
} elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) {
// If this is constant for all generic part activated by a module. It initializes
// modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'],
// modules_parts['models'], modules_parts['theme']
// modules_parts['sms'],
// modules_parts['css'], ...
$modulename = strtolower($reg[1]);
$partname = strtolower($reg[2]);
if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) {
@ -221,9 +224,8 @@ class Conf
$value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe
}
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array
}
// If this is a module constant (must be at end)
elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
} elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) {
// If this is a module constant (must be at end)
$modulename = strtolower($reg[1]);
if ($modulename == 'propale') {
$modulename = 'propal';

View File

@ -123,7 +123,8 @@ class Cstate // 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) {
@ -229,7 +230,8 @@ class Cstate // 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
@ -266,7 +268,8 @@ class Cstate // 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();
}
// Commit or rollback

View File

@ -130,7 +130,8 @@ class Ctypent // 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) {
@ -244,7 +245,8 @@ class Ctypent // 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
@ -282,7 +284,8 @@ class Ctypent // 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();
}
// Commit or rollback

View File

@ -133,7 +133,8 @@ class CUnits // 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) {
@ -351,7 +352,8 @@ class CUnits // 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
@ -389,7 +391,8 @@ class CUnits // 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();
}
// Commit or rollback

View File

@ -0,0 +1,352 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Florian HENRY <florian.henry@scopen.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/code/class/defaultvalues.class.php
* \brief This file is a CRUD class file for DefaultValues (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 MyObject
*/
class DefaultValues extends CommonObject
{
/**
* @var string ID to identify managed object.
*/
public $element = 'defaultvalues';
/**
* @var string Name of table without prefix where object is stored. This is also the key used for extrafields management.
*/
public $table_element = 'default_values';
/**
* @var int Does this object support multicompany module ?
* 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table
*/
public $ismultientitymanaged = 1;
/**
* @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 0;
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = '';
/**
* 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key.
* 'picto' is code of a picto to show before value in forms
* 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM)
* 'position' is the sort order of field.
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). 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)
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* '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' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
* 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
*
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
*/
// 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, 'notnull'=>1, 'position'=>10),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
'type' =>array('type'=>'varchar(10)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
'user_id' =>array('type'=>'integer', 'label'=>'Userid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'page' =>array('type'=>'varchar(255)', 'label'=>'RelativeURL', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'param' =>array('type'=>'varchar(255)', 'label'=>'Field', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'value' =>array('type'=>'varchar(128)', 'label'=>'Value', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
);
/**
* @var int ID
*/
public $rowid;
/**
* @var int Entity
*/
public $entity;
/**
* @var string Type
*/
public $type;
/**
* @var int User Id
*/
public $user_id;
/**
* @var string Page
*/
public $page;
/**
* @var string Param
*/
public $param;
/**
* @var string Value
*/
public $value;
// END MODULEBUILDER PROPERTIES
/**
* 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
if (is_object($langs)) {
foreach ($this->fields as $key => $val) {
if (!empty($val['arrayofkeyval']) && 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();
// Reset some properties
unset($object->id);
// Create clone
$object->context['createfromclone'] = 'createfromclone';
$result = $object->createCommon($user);
if ($result < 0) {
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
}
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
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id)
{
$result = $this->fetchCommon($id, null);
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';
$sql .= ' WHERE 1 = 1';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.rowid' || ($key == 't.entity' && !is_array($value)) || ($key == 't.user_id' && !is_array($value))) {
$sqlwhere[] = $key.'='.$value;
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
} elseif ($key == 't.page' || $key == 't.param' || $key == 't.type') {
$sqlwhere[] = $key.' = \''.$this->db->escape($value).'\'';
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
} elseif (is_array($value)) {
$sqlwhere[] = $key.' IN ('.implode(',', $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 < ($limit ? min($limit, $num) : $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);
}
/**
* Initialise object with example values
* Id must be 0 if object instance is a specimen
*
* @return void
*/
public function initAsSpecimen()
{
$this->initAsSpecimenCommon();
}
}

View File

@ -61,7 +61,8 @@ class DolGeoIP
require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
}
} else {
print 'ErrorBadParameterInConstructor'; return 0;
print 'ErrorBadParameterInConstructor';
return 0;
}
// Here, function exists (embedded into PHP or exists because we made include)
@ -129,7 +130,7 @@ class DolGeoIP
}
} else {
if (!function_exists('geoip_country_code_by_addr')) {
return strtolower(geoip_country_code_by_name($this->gi, $ip));
return strtolower(geoip_country_code_by_name($ip));
}
return strtolower(geoip_country_code_by_addr($this->gi, $ip));
}

View File

@ -908,9 +908,8 @@ class DolGraph
$this->stringtoshow .= 'legend: {show: ' . ($showlegend ? 'true' : 'false') . ', position: \'ne\' }
});
}' . "\n";
}
// Other cases, graph of type 'bars', 'lines'
else {
} else {
// Other cases, graph of type 'bars', 'lines'
// Add code to support tooltips
// TODO: remove js css and use graph-tooltip-inner class instead by adding css in each themes
$this->stringtoshow .= '
@ -1262,9 +1261,8 @@ class DolGraph
$this->stringtoshow .= ']' . "\n";
$this->stringtoshow .= '}' . "\n";
$this->stringtoshow .= '});' . "\n";
}
// Other cases, graph of type 'bars', 'lines', 'linesnopoint'
else {
} else {
// Other cases, graph of type 'bars', 'lines', 'linesnopoint'
$type = 'bar';
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') {

View File

@ -147,7 +147,8 @@ class Events // extends CommonObject
// Check parameters
if (empty($this->description)) {
$this->error = 'ErrorBadValueForParameterCreateEventDesc'; return -1;
$this->error = 'ErrorBadValueForParameterCreateEventDesc';
return -1;
}
// Insert request

View File

@ -251,7 +251,8 @@ class ExtraFields
}
if ($type == 'separate') {
$unique = 0; $required = 0;
$unique = 0;
$required = 0;
} // Force unique and not required if this is a separator field to avoid troubles.
if ($elementtype == 'thirdparty') {
$elementtype = 'societe';

View File

@ -70,7 +70,8 @@ class FileUpload
$element = $pathname = 'projet';
$dir_output = $conf->$element->dir_output;
} elseif ($element == 'project_task') {
$pathname = 'projet'; $filename = 'task';
$pathname = 'projet';
$filename = 'task';
$dir_output = $conf->projet->dir_output;
$parentForeignKey = 'fk_project';
$parentClass = 'Project';
@ -80,20 +81,24 @@ class FileUpload
$element = 'ficheinter';
$dir_output = $conf->$element->dir_output;
} elseif ($element == 'order_supplier') {
$pathname = 'fourn'; $filename = 'fournisseur.commande';
$pathname = 'fourn';
$filename = 'fournisseur.commande';
$dir_output = $conf->fournisseur->commande->dir_output;
} elseif ($element == 'invoice_supplier') {
$pathname = 'fourn'; $filename = 'fournisseur.facture';
$pathname = 'fourn';
$filename = 'fournisseur.facture';
$dir_output = $conf->fournisseur->facture->dir_output;
} elseif ($element == 'product') {
$dir_output = $conf->product->multidir_output[$conf->entity];
} elseif ($element == 'productbatch') {
$dir_output = $conf->productbatch->multidir_output[$conf->entity];
} elseif ($element == 'action') {
$pathname = 'comm/action'; $filename = 'actioncomm';
$pathname = 'comm/action';
$filename = 'actioncomm';
$dir_output = $conf->agenda->dir_output;
} elseif ($element == 'chargesociales') {
$pathname = 'compta/sociales'; $filename = 'chargesociales';
$pathname = 'compta/sociales';
$filename = 'chargesociales';
$dir_output = $conf->tax->dir_output;
} else {
$dir_output = $conf->$element->dir_output;

View File

@ -228,11 +228,14 @@ class HookManager
}
// Init return properties
$this->resPrint = ''; $this->resArray = array(); $this->resNbOfHooks = 0;
$this->resPrint = '';
$this->resArray = array();
$this->resNbOfHooks = 0;
// Loop on each hook to qualify modules that have declared context
$modulealreadyexecuted = array();
$resaction = 0; $error = 0;
$resaction = 0;
$error = 0;
foreach ($this->hooks as $context => $modules) { // $this->hooks is an array with context as key and value is an array of modules that handle this context
if (!empty($modules)) {
foreach ($modules as $module => $actionclassinstance) {
@ -265,7 +268,8 @@ class HookManager
$resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if ($resaction < 0 || !empty($actionclassinstance->error) || (!empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) {
$error++;
$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
$this->error = $actionclassinstance->error;
$this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
}
@ -275,9 +279,8 @@ class HookManager
if (!empty($actionclassinstance->resprints)) {
$this->resPrint .= $actionclassinstance->resprints;
}
}
// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
else {
} else {
// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
// TODO. this test should be done into the method of hook by returning nothing
if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) {
continue;
@ -294,14 +297,16 @@ class HookManager
}
if (is_numeric($resaction) && $resaction < 0) {
$error++;
$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
$this->error = $actionclassinstance->error;
$this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
}
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
if (!is_array($resaction) && !is_numeric($resaction)) {
dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
if (empty($actionclassinstance->resprints)) {
$this->resPrint .= $resaction; $resaction = 0;
$this->resPrint .= $resaction;
$resaction = 0;
}
}
}

View File

@ -488,7 +488,8 @@ class Form
$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
$tmp = explode(':', $inputType);
$inputType = $tmp[0]; $loadmethod = $tmp[1];
$inputType = $tmp[0];
$loadmethod = $tmp[1];
if (!empty($tmp[2])) {
$savemethod = $tmp[2];
}
@ -502,7 +503,8 @@ class Form
$cols = (empty($tmp[2]) ? '80' : $tmp[2]);
} elseif (preg_match('/^ckeditor/', $inputType)) {
$tmp = explode(':', $inputType);
$inputType = $tmp[0]; $toolbar = $tmp[1];
$inputType = $tmp[0];
$toolbar = $tmp[1];
if (!empty($tmp[2])) {
$width = $tmp[2];
}
@ -594,15 +596,18 @@ class Form
$extrastyle = '';
if ($direction < 0) {
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-left: 3px !important;';
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-left: 3px !important;';
}
if ($direction > 0) {
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-right: 3px !important;';
$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
$extrastyle = 'padding: 0px; padding-right: 3px !important;';
}
$classfortooltip = 'classfortooltip';
$s = ''; $textfordialog = '';
$s = '';
$textfordialog = '';
if ($tooltiptrigger == '') {
$htmltext = str_replace('"', '&quot;', $htmltext);
@ -2084,7 +2089,8 @@ class Form
if ($nbassignetouser) {
$out .= '<ul class="attendees">';
}
$i = 0; $ownerid = 0;
$i = 0;
$ownerid = 0;
foreach ($assignedtouser as $key => $value) {
if ($value['id'] == $ownerid) {
continue;
@ -2094,7 +2100,8 @@ class Form
$userstatic->fetch($value['id']);
$out .= $userstatic->getNomUrl(-1);
if ($i == 0) {
$ownerid = $value['id']; $out .= ' ('.$langs->trans("Owner").')';
$ownerid = $value['id'];
$out .= ' ('.$langs->trans("Owner").')';
}
if ($nbassignetouser > 1 && $action != 'view') {
$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
@ -3729,15 +3736,17 @@ class Form
* @param string $htmlname Nom de la zone select
* @param string $exclude To exclude a code value (Example: SRC_PROP)
* @param int $addempty Add an empty entry
* @param string $morecss Add more css to the HTML select component
* @param int $notooltip Do not show the tooltip for admin
* @return void
*/
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0)
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0, $morecss = '', $notooltip = 0)
{
global $langs, $user;
$this->loadCacheInputReason();
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
if ($addempty) {
print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
}
@ -3756,7 +3765,7 @@ class Form
print '</option>';
}
print '</select>';
if ($user->admin) {
if ($user->admin && empty($notooltip)) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox('select_'.$htmlname);
@ -5296,8 +5305,8 @@ class Form
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
print '<select name="calculation_mode">';
print '<option value="1">'.$currency.' > '.$conf->currency.'</option>';
print '<option value="2">'.$conf->currency.' > '.$currency.'</option>';
print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
print '</select> ';
print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
@ -5811,7 +5820,8 @@ class Form
}
// Disabled if seller is not subject to VAT
$disabled = false; $title = '';
$disabled = false;
$title = '';
if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") {
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
// of using supplier invoices (this is a very bad idea !)
@ -5991,10 +6001,12 @@ class Form
$stepminutes = 1;
}
if ($empty == 1) {
$emptydate = 1; $emptyhours = 1;
$emptydate = 1;
$emptyhours = 1;
}
if ($empty == 2) {
$emptydate = 0; $emptyhours = 1;
$emptydate = 0;
$emptyhours = 1;
}
$orig_set_time = $set_time;
@ -6149,9 +6161,8 @@ class Form
} else {
$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
}
}
// Show date with combo selects
else {
} else {
// Show date with combo selects
// Day
$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
@ -6448,7 +6459,8 @@ class Form
$retstring = '';
$hourSelected = 0; $minSelected = 0;
$hourSelected = 0;
$minSelected = 0;
// Hours
if ($iSecond != '') {
@ -6914,7 +6926,8 @@ class Form
$style = empty($tmpvalue['css']) ? ' class="'.$tmpvalue['css'].'"' : '';
} else {
$value = $tmpvalue;
$disabled = ''; $style = '';
$disabled = '';
$style = '';
}
if (!empty($disablebademail)) {
if (($disablebademail == 1 && !preg_match('/&lt;.+@.+&gt;/', $value))
@ -7725,9 +7738,8 @@ class Form
//$linktoelem.=($linktoelem?' &nbsp; ':'');
if ($num > 0) {
$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
}
//else $linktoelem.=$langs->trans($possiblelink['label']);
else {
// } else $linktoelem.=$langs->trans($possiblelink['label']);
} else {
$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
}
}
@ -7782,7 +7794,8 @@ class Form
{
global $langs;
$yes = "yes"; $no = "no";
$yes = "yes";
$no = "no";
if ($option) {
$yes = "1";
$no = "0";
@ -8098,7 +8111,13 @@ class Form
$entity = (!empty($object->entity) ? $object->entity : $conf->entity);
$id = (!empty($object->id) ? $object->id : $object->rowid);
$ret = ''; $dir = ''; $file = ''; $originalfile = ''; $altfile = ''; $email = ''; $capture = '';
$ret = '';
$dir = '';
$file = '';
$originalfile = '';
$altfile = '';
$email = '';
$capture = '';
if ($modulepart == 'societe') {
$dir = $conf->societe->multidir_output[$entity];
if (!empty($object->logo)) {

View File

@ -227,7 +227,8 @@ class FormActions
print '<!-- formactions->showactions -->'."\n";
print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter);
$page = 0; $param = '';
$page = 0;
$param = '';
print '<div class="div-table-responsive-no-min">';
print '<table class="centpercent noborder'.($morecss ? ' '.$morecss : '').'">';

View File

@ -547,7 +547,8 @@ class FormCompany extends Form
$num = $this->db->num_rows($resql);
if ($num) {
$i = 0;
$country = ''; $arraydata = array();
$country = '';
$arraydata = array();
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
@ -622,7 +623,8 @@ class FormCompany extends Form
// Use Ajax search
$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2);
$socid = 0; $name = '';
$socid = 0;
$name = '';
if ($selected > 0) {
$tmpthirdparty = new Societe($this->db);
$result = $tmpthirdparty->fetch($selected);
@ -937,7 +939,8 @@ class FormCompany extends Form
$maxlength = $formlength;
if (empty($formlength)) {
$formlength = 24; $maxlength = 128;
$formlength = 24;
$maxlength = 128;
}
$out = '';

View File

@ -659,9 +659,8 @@ class FormFile
$file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
if (file_exists($file)) {
$res = include_once $file;
}
// For normalized external modules.
else {
} else {
// For normalized external modules.
$file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
$res = include_once $file;
}
@ -699,7 +698,8 @@ class FormFile
$out .= '<tr class="liste_titre">';
$addcolumforpicto = ($delallowed || $printer || $morepicto);
$colspan = (3 + ($addcolumforpicto ? 1 : 0)); $colspanmore = 0;
$colspan = (3 + ($addcolumforpicto ? 1 : 0));
$colspanmore = 0;
$out .= '<th colspan="'.$colspan.'" class="formdoc liste_titre maxwidthonsmartphone center">';
@ -1221,7 +1221,9 @@ class FormFile
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
}
$i = 0; $nboflines = 0; $lastrowid = 0;
$i = 0;
$nboflines = 0;
$lastrowid = 0;
foreach ($filearray as $key => $file) { // filearray must be only files here
if ($file['name'] != '.'
&& $file['name'] != '..'
@ -1639,19 +1641,24 @@ class FormFile
// Define relative path used to store the file
$relativefile = preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']);
$id = 0; $ref = '';
$id = 0;
$ref = '';
// To show ref or specific information according to view to show (defined by $module)
$reg = array();
if ($modulepart == 'company' || $modulepart == 'tax') {
preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : '');
preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg);
$id = (isset($reg[1]) ? $reg[1] : '');
} elseif ($modulepart == 'invoice_supplier') {
preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) {
$id = $ref; $ref = '';
preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
$ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) {
$id = $ref;
$ref = '';
}
} // $ref may be also id with old supplier invoices
elseif ($modulepart == 'user' || $modulepart == 'holiday') {
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : '');
} elseif ($modulepart == 'user' || $modulepart == 'holiday') {
// $ref may be also id with old supplier invoices
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$id = (isset($reg[1]) ? $reg[1] : '');
} elseif (in_array($modulepart, array(
'invoice',
'propal',
@ -1666,7 +1673,8 @@ class FormFile
'recruitment-recruitmentcandidature',
'mrp-mo',
'banque'))) {
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : '');
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$ref = (isset($reg[1]) ? $reg[1] : '');
} else {
$parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
@ -1703,10 +1711,13 @@ class FormFile
}
if ($result > 0) { // Save object loaded into a cache
$found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance;
$found = 1;
$this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance;
}
if ($result == 0) {
$found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound'; unset($filearray[$key]);
$found = 1;
$this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound';
unset($filearray[$key]);
}
}

View File

@ -441,7 +441,7 @@ class FormMail extends Form
$out .= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n";
$out .= '<a id="formmail" name="formmail"></a>';
$out .= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
$out .= '<input style="display:none" type="submit" id="sendmailhidden" name="sendmail">';
$out .= '<input type="hidden" name="token" value="'.newToken().'" />';
$out .= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
}
@ -911,7 +911,8 @@ class FormMail extends Form
}
// Complete substitution array with the url to make online payment
$paymenturl = ''; $validpaymentmethod = array();
$paymenturl = '';
$validpaymentmethod = array();
if (empty($this->substit['__REF__'])) {
$paymenturl = '';
} else {

View File

@ -1211,7 +1211,8 @@ class FormOther
}
// Define boxlista and boxlistb
$boxlista = ''; $boxlistb = '';
$boxlista = '';
$boxlistb = '';
$nbboxactivated = count($boxidactivatedforuser);
if ($nbboxactivated) {
@ -1357,7 +1358,8 @@ class FormOther
{
global $langs;
$automatic = "automatic"; $manual = "manual";
$automatic = "automatic";
$manual = "manual";
if ($option) {
$automatic = "1";
$manual = "0";

View File

@ -393,7 +393,8 @@ class FormProjets
continue;
}
$labeltoshow = ''; $titletoshow = '';
$labeltoshow = '';
$titletoshow = '';
$disabled = 0;
if ($obj->fk_statut == Project::STATUS_DRAFT) {

View File

@ -200,7 +200,8 @@ function limitChars(textarea, limit, infodiv)
}
} elseif (!empty($conf->global->MAIN_SMS_SENDMODE)) { // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module'
$tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE);
$classfile = $tmp[0]; $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
$classfile = $tmp[0];
$module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]);
dol_include_once('/'.$module.'/class/'.$classfile.'.class.php');
try {
$classname = ucfirst($classfile);

Some files were not shown because too many files have changed in this diff Show More