Merge branch 'develop' into master

This commit is contained in:
Laurent Destailleur 2020-01-27 02:17:14 +01:00 committed by GitHub
commit 0271a43e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
216 changed files with 2935 additions and 1353 deletions

View File

@ -33,6 +33,7 @@ NEW: Add button "Save and Stay" in website editor of pages.
NEW: Accountancy - Can add specific widget in this accountancy area.
NEW: Accountancy - Add export model LDCompta V9 & higher
NEW: Accountancy - Add permission on export, delete operations in ledger
NEW: Can defined alternative profiles (email and signatures) for users.
NEW: add ability to edit price without tax before adding a line of a predefined product.
NEW: Add a tab to setup "Opening hours" of company (information only).
NEW: Add attendee to ical export + cleanup.

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries"));
@ -183,6 +184,7 @@ if (empty($reshook))
*/
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans("ListAccounts"));
@ -201,10 +203,43 @@ if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_accou
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
$sql .= " WHERE asy.rowid = ".$pcgver;
//print $sql;
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
if (strlen(trim($search_account))) {
$lengthpaddingaccount = 0;
if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_account_tmp = $search_account;
$weremovedsomezero = 0;
if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
for($i = 0; $i < $lengthpaddingaccount; $i++) {
if (preg_match('/0$/', $search_account_tmp)) {
$weremovedsomezero++;
$search_account_tmp = preg_replace('/0$/', '', $search_account_tmp);
}
}
}
//var_dump($search_account); exit;
if ($search_account_tmp) {
if ($weremovedsomezero) {
$search_account_tmp_clean = $search_account_tmp;
$search_account_clean = $search_account;
$startchar = '%';
if (strpos($search_account_tmp, '^') === 0)
{
$startchar = '';
$search_account_tmp_clean = preg_replace('/^\^/', '', $search_account_tmp);
$search_account_clean = preg_replace('/^\^/', '', $search_account);
}
$sql .= " AND (aa.account_number LIKE '".$startchar.$search_account_tmp_clean."'";
$sql .= " OR aa.account_number LIKE '".$startchar.$search_account_clean."%')";
}
else $sql .= natural_search("aa.account_number", $search_account_tmp);
}
}
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
if (strlen(trim($search_labelshort))) $sql .= natural_search("aa.labelshort", $search_labelshort);
if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent);
if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2);
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
$sql .= $db->order($sortfield, $sortorder);
@ -237,7 +272,7 @@ if ($resql)
if ($search_account) $param .= '&search_account='.urlencode($search_account);
if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_labelshort) $param.= '&search_labelshort='.urlencode($search_labelshort);
if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent);
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
@ -322,8 +357,12 @@ if ($resql)
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_labelshort" value="' . $search_labelshort . '"></td>';
if (!empty($arrayfields['aa.account_parent']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="'.$search_accountparent.'"></td>';
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
if (!empty($arrayfields['aa.account_parent']['checked'])) {
print '<td class="liste_titre">';
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
print '</td>';
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>';
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre maxwidthsearch">';
@ -346,6 +385,7 @@ if ($resql)
$accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);
$totalarray = array();
$i = 0;
while ($i < min($num, $limit))
{

View File

@ -32,6 +32,8 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
/**
* Manage the different format accountancy export
@ -742,10 +744,10 @@ class AccountancyExport
print $line->label_operation.$separator;
// FEC:Debit
print price2num($line->debit).$separator;
print price2fec($line->debit).$separator;
// FEC:Credit
print price2num($line->credit).$separator;
print price2fec($line->credit).$separator;
// FEC:EcritureLet
print $line->lettering_code.$separator;

View File

@ -342,11 +342,12 @@ if ($action == 'create')
print '</td></tr>';
// Morphy
$morphys = array();
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"]) ? $_POST["morphy"] : $object->morphy);
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
print "</td></tr>";
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
@ -354,12 +355,12 @@ if ($action == 'create')
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote", 0, 1);
print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
print '<input name="duration_value" size="5" value="'.$_POST["duration_value"].'"> ';
print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1);
print '<input name="duration_value" size="5" value="'.GETPOST('duraction_unit', 'aZ09').'"> ';
print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1);
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';

View File

@ -235,7 +235,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/action/doc/");
$dir = dol_buildpath($reldir."core/modules/action/doc");
if (is_dir($dir))
{
@ -257,7 +257,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print (empty($module->name) ? $name : $module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.$file;
require_once $dir.'/'.$file;
$module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info'))
print $module->info($langs);

View File

@ -350,7 +350,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
$realpath = $reldir."core/modules/bom".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -382,7 +383,6 @@ foreach ($dirmodels as $reldir)
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
@ -425,7 +425,9 @@ foreach ($dirmodels as $reldir)
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);

View File

@ -403,7 +403,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/commande".$valdir);
$realpath = $reldir."core/modules/commande".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -472,19 +473,21 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';

View File

@ -339,7 +339,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/contract".$valdir);
$realpath = $reldir."core/modules/contract".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -407,18 +408,20 @@ foreach ($dirmodels as $reldir)
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';

View File

@ -1298,7 +1298,6 @@ if ($id)
// Determines the name of the field in relation to the possible names
// in data dictionaries
$showfield = 1; // By defaut
$align = "left";
$cssprefix = '';
$sortable = 1;
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
@ -1310,23 +1309,23 @@ if ($id)
if ($fieldlist[$field] == 'taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow = $langs->trans("Rate");
else $valuetoshow = $langs->trans("Amount");
$align = 'center';
$cssprefix = 'center ';
}
if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $align = "center"; $sortable = 0; }
if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $align = "center"; $sortable = 0; }
if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $align = "center"; $sortable = 0; }
if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $align = "center"; $sortable = 0; }
if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $cssprefix = "center "; $sortable = 0; }
if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $cssprefix = "center "; $sortable = 0; }
if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $cssprefix = "center "; $sortable = 0; }
if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $cssprefix = "center "; $sortable = 0; }
if ($fieldlist[$field] == 'organization') { $valuetoshow = $langs->trans("Organization"); }
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'position') { $align = 'right'; }
if ($fieldlist[$field] == 'position') { $cssprefix = 'right '; }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Label"); }
if ($fieldlist[$field] == 'libelle_facture') { $valuetoshow = $langs->trans("LabelOnDocuments"); }
if ($fieldlist[$field] == 'country') { $valuetoshow = $langs->trans("Country"); }
if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $align = "center"; }
if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $cssprefix = "center "; }
if ($fieldlist[$field] == 'nbjour') { $valuetoshow = $langs->trans("NbOfDays"); }
if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $align = "center"; }
if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $cssprefix = "center "; }
if ($fieldlist[$field] == 'decalage') { $valuetoshow = $langs->trans("Offset"); }
if ($fieldlist[$field] == 'width' || $fieldlist[$field] == 'nx') { $valuetoshow = $langs->trans("Width"); }
if ($fieldlist[$field] == 'height' || $fieldlist[$field] == 'ny') { $valuetoshow = $langs->trans("Height"); }
@ -1368,7 +1367,7 @@ if ($id)
// Show field title
if ($showfield)
{
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder, $cssprefix);
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
}
}
// Favorite - Only activated on country dictionary
@ -1424,8 +1423,8 @@ if ($id)
foreach ($fieldlist as $field => $value)
{
//var_dump($fieldlist);
$class = '';
$showfield = 1;
$align = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($fieldlist[$field] == 'entity') {
@ -1457,13 +1456,13 @@ if ($id)
}
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
$valuetoshow = yn($valuetoshow);
$align = "center";
$class = "center";
}
elseif ($fieldlist[$field] == 'type_cdr') {
if (empty($valuetoshow)) $valuetoshow = $langs->trans('None');
elseif ($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth');
elseif ($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext');
$align = "center";
$class = "center";
} elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
$valuetoshow = price($valuetoshow);
}
@ -1577,20 +1576,20 @@ if ($id)
$valuetoshow = $localtax_typeList[$valuetoshow];
else
$valuetoshow = '';
$align = "center";
$class = "center";
}
elseif ($fieldlist[$field] == 'localtax2_type') {
if ($obj->localtax2 != 0)
$valuetoshow = $localtax_typeList[$valuetoshow];
else
$valuetoshow = '';
$align = "center";
$class = "center";
}
elseif ($fieldlist[$field] == 'taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$align = "center";
$class = "center";
} elseif (in_array($fieldlist[$field], array('recuperableonly'))) {
$align = "center";
$class = "center";
}
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow);
@ -1622,14 +1621,14 @@ if ($id)
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
}
$class = 'tddict';
$class .= ($class ? ' ' : '').'tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200';
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';
if ($fieldlist[$field] == 'position') $class .= ' right';
if ($fieldlist[$field] == 'localtax1_type') $class .= ' nowrap';
if ($fieldlist[$field] == 'localtax2_type') $class .= ' nowrap';
// Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
}
}
@ -1908,9 +1907,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '</td>';
}
elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
$align = "left";
if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $align = "center"; // Fields aligned on right
print '<td class="'.$align.'">';
$class = "left";
if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $class = "center"; // Fields aligned on right
print '<td class="'.$class.'">';
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>';
}

View File

@ -486,7 +486,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/facture".$valdir);
$realpath = $reldir."core/modules/facture".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -555,19 +556,21 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';

View File

@ -409,7 +409,8 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/fichinter/doc/");
$realpath = $reldir."core/modules/fichinter/doc";
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -480,6 +481,8 @@ foreach ($dirmodels as $reldir)
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);

View File

@ -355,7 +355,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
$realpath = $reldir."core/modules/holiday".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -429,7 +430,9 @@ foreach ($dirmodels as $reldir)
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);

View File

@ -377,6 +377,7 @@ print '</table>'."\n";
print '<br>';
// Other
print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LoginPage").'</td><td></td>';
print '<td width="20">&nbsp;</td>';
@ -427,7 +428,7 @@ print '</div>';
print '</td></tr>';
print '</table>'."\n";
print '</div>';
print '<br>';
print '<div class="center">';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
@ -467,24 +467,6 @@ if ($action == 'edit')
$liste = array();
$liste['user'] = $langs->trans('UserEmail');
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
/*
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i=0;
while($i < $num)
{
$obj = $db->fetch_object($resql);
if ($obj)
{
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
}
$i++;
}
}
else dol_print_error($db);*/
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0);
@ -655,7 +637,8 @@ else
$liste = array();
$liste['user'] = $langs->trans('UserEmail');
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
$sql.= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
$resql = $db->query($sql);
if ($resql)
{

View File

@ -38,14 +38,14 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'emailsenderprofilelist'; // To manage different context of search
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'emailsenderprofilelist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
@ -69,13 +69,14 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
if (!$sortorder) $sortorder = "ASC";
// Protection if external user
// Security check
$socid = 0;
if ($user->socid > 0)
if ($user->socid > 0) // Protection if external user
{
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'mymodule', $id, '');
// Initialize array of search criterias
$search_all = trim(GETPOST("search_all", 'alpha'));
@ -97,7 +98,7 @@ $arrayfields = array();
foreach ($object->fields as $key => $val)
{
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']);
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
@ -161,8 +162,6 @@ if (empty($reshook))
// Mass actions
$objectclass = 'EmailSenderProfile';
$objectlabel = 'EmailSenderProfile';
$permissiontoread = $user->admin;
$permissiontodelete = $user->admin;
$uploaddir = $conf->admin->dir_output.'/senderprofiles';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@ -185,8 +184,6 @@ if (empty($reshook))
* View
*/
$limit = (GETPOSTISSET('limit') ? $limit : 0);
$form = new Form($db);
$now = dol_now();
@ -196,7 +193,7 @@ $help_url = '';
$title = $langs->trans("EMailsSetup");
llxHeader();
llxHeader('', $title);
$linkback = '';
$titlepicto = 'title_setup';
@ -234,6 +231,10 @@ foreach ($search as $key => $val)
{
if ($key == 'status' && $search[$key] == -1) continue;
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') $search[$key] = '';
$mode_search = 2;
}
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
@ -254,6 +255,7 @@ foreach($object->fields as $key => $val)
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
@ -375,9 +377,12 @@ if ($action != 'create') {
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
print $doleditor->Create(1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("User").'</td><td>';
print $form->select_dolusers((GETPOSTISSET('private') ? GETPOST('private', 'int') : -1), 'private', 1, null, 0, ($user->admin ? '' : $user->id));
print '</td></tr>';
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectyesno('active', GETPOST('active', 'int'), 1);
print $form->selectarray('active', $object->fields['active']['arrayofkeyval'], GETPOST('active', 'int'), 0);
print '</td></tr>';
print '</table>';
print '<br>';
@ -443,7 +448,10 @@ foreach ($object->fields as $key => $val)
{
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
}
elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '</td>';
}
}
@ -509,11 +517,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
if (empty($obj)) break; // Should not happen
// Store properties in $object
$object->id = $obj->rowid;
foreach ($object->fields as $key => $val)
{
if (property_exists($obj, $key)) $object->$key = $obj->$key;
}
$object->setVarsFromFetchObj($obj);
// Show here line of result
print '<tr class="oddeven">';
@ -532,21 +536,20 @@ while ($i < ($limit ? min($num, $limit) : $num))
{
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5);
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
else print $object->showOutputField($val, $key, $obj->$key, '');
else print $object->showOutputField($val, $key, $object->$key, '');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!empty($val['isameasure']))
{
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key;
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@ -562,8 +565,8 @@ while ($i < ($limit ? min($num, $limit) : $num))
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
if (in_array($object->id, $arrayofselected)) $selected = 1;
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) $totalarray['nbfield']++;

View File

@ -351,7 +351,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/mrp".$valdir);
$realpath = $reldir."core/modules/mrp".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -383,7 +384,6 @@ foreach ($dirmodels as $reldir)
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
@ -421,14 +421,16 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';

View File

@ -70,7 +70,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = order_admin_prepare_head();

View File

@ -71,7 +71,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = order_admin_prepare_head();

View File

@ -271,7 +271,7 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/propale/");
$dir = dol_buildpath($reldir."core/modules/propale");
if (is_dir($dir))
{
@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir)
{
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
require_once $dir.'/'.$file.'.php';
$module = new $file;
@ -399,7 +399,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/propale".$valdir);
$realpath = $reldir."core/modules/propale".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -474,7 +475,9 @@ foreach ($dirmodels as $reldir)
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);

View File

@ -221,7 +221,7 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/reception/");
$dir = dol_buildpath($reldir."core/modules/reception");
if (is_dir($dir))
{
@ -353,7 +353,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/reception".$valdir);
$realpath = $reldir."core/modules/reception".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -427,7 +428,9 @@ foreach ($dirmodels as $reldir)
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);

View File

@ -461,6 +461,7 @@ print "</tr>\n";
print '</table>';
/*
print '<br>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
@ -471,7 +472,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '</tr>'."\n";
// Example with a yes / no select
/*print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
@ -481,10 +482,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL);
}
print '</td></tr>';
*/
// Example with a yes / no select
/*print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
@ -494,7 +495,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA);
}
print '</td></tr>';
*/
// Example with a yes / no select
print '<tr class="oddeven">';
@ -507,8 +508,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT);
}
print '</td></tr>';
print '</table>';
}
*/
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.

View File

@ -90,7 +90,7 @@ if ($action == 'specimen') // For invoices
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -230,7 +230,7 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
$dir = dol_buildpath($reldir."core/modules/supplier_invoice");
if (is_dir($dir))
{
@ -243,7 +243,7 @@ foreach ($dirmodels as $reldir)
{
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
require_once $dir.'/'.$file.'.php';
$module = new $file;
@ -360,7 +360,8 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/");
$realpath = $reldir."core/modules/supplier_invoice/doc";
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -385,7 +386,7 @@ foreach ($dirmodels as $reldir)
print (empty($module->name) ? $name : $module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.$file;
require_once $dir.'/'.$file;
$module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
@ -434,6 +435,8 @@ foreach ($dirmodels as $reldir)
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);

View File

@ -86,7 +86,7 @@ elseif ($action == 'specimen') // For orders
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/supplier_order/pdf/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -388,7 +388,8 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/");
$realpath = $reldir."core/modules/supplier_order/doc";
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -411,7 +412,7 @@ foreach ($dirmodels as $reldir)
print (empty($module->name) ? $name : $module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.$file;
require_once $dir.'/'.$file;
$module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
@ -456,6 +457,8 @@ foreach ($dirmodels as $reldir)
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);

View File

@ -332,7 +332,8 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_payment/doc/");
$realpath = $reldir."core/modules/supplier_payment/doc";
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -356,7 +357,7 @@ foreach ($dirmodels as $reldir)
print (empty($module->name) ? $name : $module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.$file;
require_once $dir.'/'.$file;
$module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
@ -405,6 +406,8 @@ foreach ($dirmodels as $reldir)
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
print '<td class="center">';

View File

@ -239,7 +239,7 @@ print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_proposal/");
$dir = dol_buildpath($reldir."core/modules/supplier_proposal");
if (is_dir($dir))
{
@ -252,7 +252,7 @@ foreach ($dirmodels as $reldir)
{
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
require_once $dir.'/'.$file.'.php';
$module = new $file;
@ -366,7 +366,8 @@ foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_proposal".$valdir);
$realpath = $reldir."core/modules/supplier_proposal".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
@ -440,7 +441,9 @@ foreach ($dirmodels as $reldir)
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);

View File

@ -209,7 +209,7 @@ print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/ticket/");
$dir = dol_buildpath($reldir."core/modules/ticket");
if (is_dir($dir)) {
$handle = opendir($dir);
@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
$file = $reg[1];
$classname = substr($file, 4);
include_once $dir.$file.'.php';
include_once $dir.'/'.$file.'.php';
$module = new $file;

View File

@ -205,9 +205,9 @@ if ($result)
$i = 0;
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_code) $param.='&search_code='.urlencode($search_code);
if ($search_ip) $param.='&search_ip='.urlencode($search_ip);
if ($search_user) $param.='&search_user='.urlencode($search_user);
@ -332,13 +332,14 @@ if ($result)
// Description
print '<td>';
$text=$langs->trans($obj->description);
$reg = array();
if (preg_match('/\((.*)\)(.*)/i', $obj->description, $reg))
{
$val=explode(',', $reg[1]);
$text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:'');
if (! empty($reg[2])) $text.=$reg[2];
}
print $text;
print dol_escape_htmltag($text);
print '</td>';
if (! empty($arrayfields['e.user_agent']['checked']))
@ -359,8 +360,8 @@ if ($result)
// More informations
print '<td class="right">';
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent?$obj->user_agent:$langs->trans("Unknown"));
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session?$obj->prefix_session:$langs->trans("Unknown"));
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent ? dol_string_nohtmltag($obj->user_agent) : $langs->trans("Unknown"));
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session ? dol_string_nohtmltag($obj->prefix_session) : $langs->trans("Unknown"));
print $form->textwithpicto('', $htmltext);
print '</td>';

View File

@ -264,7 +264,7 @@ $form = new Form($db);
llxHeader('', $langs->trans("BarCodePrintsheet"));
print load_fiche_titre($langs->trans("BarCodePrintsheet"));
print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode');
print '<br>';
print $langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'<br>';

View File

@ -47,7 +47,7 @@ class BOM extends CommonObject
public $ismultientitymanaged = 1;
/**
* @var int Does bom support extrafields ? 0=No, 1=Yes
* @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 1;
@ -746,6 +746,9 @@ class BOM extends CommonObject
$label = '<u>'.$langs->trans("BillOfMaterials").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->status)) {
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;

View File

@ -791,16 +791,16 @@ class ActionComm extends CommonObject
*/
public function fetchResources()
{
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
$this->userassigned = array();
$this->socpeopleassigned = array();
$sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm_resources';
$sql .= ' WHERE fk_actioncomm = '.$this->id;
$sql .= " AND element_type IN ('user', 'socpeople')";
$resql = $this->db->query($sql);
if ($resql)
{
$this->userassigned = array();
$this->socpeopleassigned = array();
// If owner is known, we must but id first into list
if ($this->userownerid > 0) $this->userassigned[$this->userownerid] = array('id'=>$this->userownerid); // Set first so will be first into list.
@ -1378,13 +1378,13 @@ class ActionComm extends CommonObject
* Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option ''=Link to action, 'birthday'=Link to contact
* @param int $overwritepicto 1=Overwrite picto
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
* @param int $overwritepicto 1 = Overwrite picto
* @param int $notooltip 1 = Disable tooltip
* @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
@ -1393,7 +1393,11 @@ class ActionComm extends CommonObject
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
$canread = 0;
if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) $canread = 1; // Can read my event
if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) $canread = 1; // Can read my event i am assigned
if ($user->rights->agenda->allactions->read) $canread = 1; // Can read all event of other
if (! $canread)
{
$option = 'nolink';
}
@ -1451,6 +1455,8 @@ class ActionComm extends CommonObject
$url = '';
if ($option == 'birthday')
$url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
elseif ($option == 'holiday')
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;
else
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
if ($option !== 'nolink')

View File

@ -757,6 +757,95 @@ if ($showbirthday)
}
}
if($conf->global->AGENDA_SHOW_HOLIDAYS)
{
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = x.fk_user";
$sql.= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
$sql.= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
if($action == 'show_day')
{
// Request only leaves for the current selected day
$sql.= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin";
}
elseif($action == 'show_week')
{
// TODO: Add filter to reduce database request
}
elseif($action == 'show_month')
{
// TODO: Add filter to reduce database request
}
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$dateStartArray = dol_getdate(dol_stringtotime($obj->date_start, 1), true);
$dateEndArray = dol_getdate(dol_stringtotime($obj->date_end, 1), true);
$event = new ActionComm($db);
// Need the id of the leave object for link to it
$event->id = $obj->rowid;
$event->type_code = 'HOLIDAY';
$event->datep = dol_mktime(0, 0, 0, $dateStartArray['mon'], $dateStartArray['mday'], $dateStartArray['year'], true);
$event->datef = dol_mktime(0, 0, 0, $dateEndArray['mon'], $dateEndArray['mday'], $dateEndArray['year'], true);
$event->date_start_in_calendar = $event->datep;
$event->date_end_in_calendar = $event->datef;
if($obj->status == 3)
{
// Show no symbol for leave with state "leave approved"
$event->percentage = -1;
}
elseif($obj->status == 2)
{
// Show TO-DO symbol for leave with state "leave wait for approval"
$event->percentage = 0;
}
if($obj->halfday == 1)
{
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
}
elseif($obj->halfday == -1)
{
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
}
else
{
$event->label = $obj->lastname;
}
$annee = date('Y', $event->date_start_in_calendar);
$mois = date('m', $event->date_start_in_calendar);
$jour = date('d', $event->date_start_in_calendar);
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee);
do
{
$eventarray[$daykey][] = $event;
$daykey += 60*60*24;
}
while ($daykey <= $event->date_end_in_calendar);
$i++;
}
}
}
// Complete $eventarray with external import Ical
if (count($listofextcals))
{
@ -1512,7 +1601,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
{
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
}
if ($event->type_code != 'BIRTHDAY')
elseif ($event->type_code == 'HOLIDAY')
{
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user');
}
elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY')
{
// Picto
if (empty($event->fulldayevent))
@ -1568,13 +1661,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$titletoshow = $daterange;
$titletoshow .= ($titletoshow ? ' ' : '').($event->label ? $event->label : $event->libelle);
if ($event->type_code == 'ICALEVENT') print $titletoshow;
else
{
if ($event->type_code != 'ICALEVENT') {
$savlabel = $event->label ? $event->label : $event->libelle;
$event->label = $titletoshow;
$event->libelle = $titletoshow;
print $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
$titletoshow = $event->getNomUrl(0, $maxnbofchar, 'cal_event', '', 0, 0);
$event->label = $savlabel;
$event->libelle = $savlabel;
}
@ -1595,6 +1687,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
}
print $titletoshow;
print $listofusertoshow;
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
@ -1740,6 +1834,17 @@ function dol_color_minus($color, $minus, $minusunit = 16)
*/
function sort_events_by_date($a, $b)
{
// Sort holidays at first
if($a->type_code === 'HOLIDAY')
{
return -1;
}
if($b->type_code === 'HOLIDAY')
{
return 1;
}
// datep => Event start time
// datef => Event end time

View File

@ -554,7 +554,10 @@ if ($resql)
$actionstatic->type_picto = $obj->type_picto;
$actionstatic->label = $obj->label;
$actionstatic->location = $obj->location;
$actionstatic->note = dol_htmlentitiesbr($obj->note);
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
$actionstatic->fetchResources();
print '<tr class="oddeven">';
@ -656,7 +659,6 @@ if ($resql)
if (!empty($arrayfields['a.fk_contact']['checked'])) {
print '<td>';
$actionstatic->fetchResources();
if (!empty($actionstatic->socpeopleassigned))
{
$contactList = array();

View File

@ -1047,7 +1047,7 @@ if ($object->id > 0)
$sql .= " AND f.entity = ".$conf->entity;
$sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
$sql .= ' f.suspended,';
$sql .= ' f.suspended, f.date_when,';
$sql .= ' s.nom, s.rowid';
$sql .= " ORDER BY f.date_last_gen, f.datec DESC";

View File

@ -722,6 +722,7 @@ class Propal extends CommonObject
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
@ -757,7 +758,7 @@ class Propal extends CommonObject
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new PropaleLigne($this->db);
$line->fetch($rowid);
$line->fetch_optionals(); // Fetch extrafields for oldcopy
$line->fetch_optionals();
$staticline = clone $line;
@ -808,7 +809,10 @@ class Propal extends CommonObject
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
// Multicurrency
@ -3346,7 +3350,7 @@ class Propal extends CommonObject
*/
public function initAsSpecimen()
{
global $langs;
global $conf, $langs;
// Load array of products prodids
$num_prods = 0;
@ -3385,6 +3389,10 @@ class Propal extends CommonObject
$this->demand_reason_code = 'SRC_00';
$this->note_public = 'This is a comment (public)';
$this->note_private = 'This is a comment (private)';
$this->multicurrency_tx = 1;
$this->multicurrency_code = $conf->currency;
// Lines
$nbp = 5;
$xnbp = 0;

View File

@ -959,6 +959,7 @@ class Commande extends CommonOrder
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
dol_print_error($this->db);
}
$this->db->rollback();
@ -1434,6 +1435,7 @@ class Commande extends CommonOrder
{
$langs->load("errors");
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
$this->errors[] = $this->error;
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback();
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
@ -3072,6 +3074,7 @@ class Commande extends CommonOrder
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new OrderLine($this->db);
$line->fetch($rowid);
$line->fetch_optionals();
if (!empty($line->fk_product))
{
@ -3083,6 +3086,7 @@ class Commande extends CommonOrder
{
$langs->load("errors");
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref);
$this->errors[] = $this->error;
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback();
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
@ -3143,7 +3147,10 @@ class Commande extends CommonOrder
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
$result = $this->line->update($user, $notrigger);
@ -3715,7 +3722,7 @@ class Commande extends CommonOrder
*/
public function initAsSpecimen()
{
global $langs;
global $conf, $langs;
dol_syslog(get_class($this)."::initAsSpecimen");
@ -3749,8 +3756,13 @@ class Commande extends CommonOrder
$this->mode_reglement_code = 'CHQ';
$this->availability_code = 'DSP';
$this->demand_reason_code = 'SRC_00';
$this->note_public = 'This is a comment (public)';
$this->note_private = 'This is a comment (private)';
$this->multicurrency_tx = 1;
$this->multicurrency_code = $conf->currency;
// Lines
$nbp = 5;
$xnbp = 0;

View File

@ -75,6 +75,7 @@ $search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int');
$search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
$search_login=GETPOST('search_login', 'alpha');
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
$optioncss = GETPOST('optioncss', 'alpha');
$billed = GETPOST('billed', 'int');
@ -140,6 +141,7 @@ $arrayfields = array(
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
@ -195,6 +197,7 @@ if (empty($reshook))
$search_total_ht = '';
$search_total_vat = '';
$search_total_ttc = '';
$search_login='';
$search_dateorder_start = '';
$search_dateorder_end = '';
$search_datedelivery_start = '';
@ -246,10 +249,11 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
$sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql.= " u.login";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label']))
@ -268,6 +272,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
// We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($search_user > 0)
@ -322,6 +328,7 @@ if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$s
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
if ($search_login) $sql .= natural_search("u.login", $search_login);
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
@ -417,6 +424,7 @@ if ($resql)
if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
if ($search_login) $param.='&search_login='.urlencode($search_login);
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
if ($search_town != '') $param .= '&search_town='.urlencode($search_town);
if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip);
@ -689,6 +697,13 @@ if ($resql)
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
print '</td>';
}
if (! empty($arrayfields['u.login']['checked']))
{
// Author
print '<td class="liste_titre" align="center">';
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
@ -760,6 +775,8 @@ if ($resql)
if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -781,7 +798,7 @@ if ($resql)
$generic_commande = new Commande($db);
$generic_product = new Product($db);
$userstatic = new User($db);
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
@ -1080,6 +1097,19 @@ if ($resql)
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
}
$userstatic->id=$obj->fk_user_author;
$userstatic->login=$obj->login;
// Author
if (! empty($arrayfields['u.login']['checked']))
{
print '<td align="center">';
if ($userstatic->id) print $userstatic->getLoginUrl(1);
else print '&nbsp;';
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook

View File

@ -104,7 +104,7 @@ if ($id > 0 || !empty($ref)) {
// Onglets
$head = account_statement_prepare_head($object, $num);
dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), -1, 'account');
dol_fiche_head($head, 'document', $langs->trans("AccountStatement"), -1, 'account');
// Build file list
@ -118,7 +118,7 @@ if ($id > 0 || !empty($ref)) {
$title = $langs->trans("AccountStatement").' '.$num.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
print load_fiche_titre($title, '', 'title_bank.png');
print load_fiche_titre($title, '', '');
print '<div class="fichecenter">';

View File

@ -573,11 +573,13 @@ if ($page >= $nbtotalofpages)
if (empty($search_account)) $mode_balance_ok = false;
// If a search is done $mode_balance_ok=false
if (!empty($search_ref)) $mode_balance_ok = false;
if (!empty($req_nb)) $mode_balance_ok = false;
if (!empty($search_description)) $mode_balance_ok = false;
if (!empty($search_type)) $mode_balance_ok = false;
if (!empty($debit)) $mode_balance_ok = false;
if (!empty($credit)) $mode_balance_ok = false;
if (!empty($thirdparty)) $mode_balance_ok = false;
if (!empty($search_debit)) $mode_balance_ok = false;
if (!empty($search_credit)) $mode_balance_ok = false;
if (!empty($search_thirdparty)) $mode_balance_ok = false;
if ($search_conciliated != '') $mode_balance_ok = false;
if (!empty($search_num_releve)) $mode_balance_ok = false;
$sql .= $db->plimit($limit + 1, $offset);
//print $sql;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Patrick Delcroix <pmpdelcroix@gmail.com>
@ -364,12 +364,12 @@ if (empty($numref))
else
{
/**
* Show list of bank statements
* Show list of record into a bank statement
*/
// Onglets
$head = account_statement_prepare_head($object, $numref);
dol_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account');
dol_fiche_head($head, 'statement', $langs->trans("AccountStatement"), -1, 'account');
$mesprevnext = '';
@ -382,7 +382,7 @@ else
$mesprevnext .= '</ul></div>';
$title = $langs->trans("AccountStatement").' '.$numref.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
print load_fiche_titre($title, $mesprevnext, 'title_bank.png');
print load_fiche_titre($title, $mesprevnext, '');
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, 0, $nbtotalofrecords, 'title_bank.png', 0, '', '', 0, 1);
print "<form method=\"post\" action=\"releve.php\">";
@ -444,12 +444,11 @@ else
// Date de valeur
print '<td valign="center" class="center nowrap">';
print dol_print_date($db->jdate($objp->dv), "day").' ';
print '<a href="releve.php?action=dvprev&amp;num='.$numref.'&amp;account='.$object->id.'&amp;dvid='.$objp->rowid.'">';
print '<a class="ajax reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;num='.$numref.'&amp;account='.$object->id.'&amp;dvid='.$objp->rowid.'">';
print img_edit_remove()."</a> ";
print '<a href="releve.php?action=dvnext&amp;num='.$numref.'&amp;account='.$object->id.'&amp;dvid='.$objp->rowid.'">';
print '<a class="ajax reposition" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;num='.$numref.'&amp;account='.$object->id.'&amp;dvid='.$objp->rowid.'">';
print img_edit_add()."</a>";
print "</td>\n";
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
// Type and num
if ($objp->fk_type == 'SOLD') {
@ -466,7 +465,8 @@ else
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq ? $objp->num_chq : '').$link.'</td>';
// Description
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'">';
print '<td valign="center">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'">';
$reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) print $langs->trans($reg[1]);

View File

@ -56,7 +56,7 @@ if (!$sortfield) $sortfield = 'rowid';
if (!$sortorder) $sortorder = 'ASC';
// Security check
if (!$user->rights->cashdesk->use && !$user->rights->takepos->use)
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run)
{
accessforbidden();
}
@ -82,8 +82,8 @@ $hookmanager->initHooks(array('cashcontrolcard', 'globalcard'));
* Actions
*/
$permissiontoadd = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use) || ($permissiontoadd && $object->status == 0);
$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
@ -544,14 +544,16 @@ if (empty($action) || $action == "view")
print $object->posmodule;
print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("CashDesk").' ID</td><td>';
print '<tr><td valign="middle">'.$langs->trans("Terminal").'</td><td>';
print $object->posnumber;
print "</td></tr>";
print '<tr><td class="nowrap">';
print $langs->trans("Period");
print '</td><td>';
print $object->year_close."-".$object->month_close."-".$object->day_close;
print $object->year_close;
print ($object->month_close ? "-" : "").$object->month_close;
print ($object->day_close ? "-" : "").$object->day_close;
print '</td></tr>';
print '</table>';
@ -570,7 +572,6 @@ if (empty($action) || $action == "view")
print '<tr><td valign="middle">'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td><td>';
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
print "</td></tr>";
foreach ($arrayofpaymentmode as $key => $val)
{
print '<tr><td valign="middle">'.$langs->trans($val).'</td><td>';

View File

@ -168,8 +168,8 @@ if (empty($reshook))
// Mass actions
$objectclass = 'CashControl';
$objectlabel = 'CashControl';
$permissiontoread = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permissiontoread = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run);
//$uploaddir = '';
//include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';

View File

@ -59,7 +59,7 @@ class CashControl extends CommonObject
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15),
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>18),
'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>19),
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20),
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'Terminal', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20, 'css'=>'center'),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),

View File

@ -33,11 +33,13 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
$langs->load("bills");
$id = GETPOST('id', 'int');
$_GET['optioncss']="print";
include_once 'class/cashcontrol.class.php';
$cashcontrol= new CashControl($db);
$cashcontrol->fetch($id);
@ -50,7 +52,8 @@ $arrayfields=array(
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Number"), 'checked'=>1),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'cp.code'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
);
@ -128,7 +131,6 @@ if ($resql)
$invoicetmp = new Facture($db);
print "<div style='text-align: right'><h2>";
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash")." : ".price($cashcontrol->opening);
print "</h2></div>";
@ -136,13 +138,16 @@ if ($resql)
print '<div class="div-table-responsive">';
print '<table class="tagtable liste">'."\n";
$param = '';
// Fields title
print '<tr class="liste_titre">';
print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '"', $sortfield, $sortorder, 'center ');
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['cp.code']['label'], $_SERVER['PHP_SELF'], 'cp.code', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
print "</tr>\n";
$posconciliatecol = 0;
@ -151,7 +156,9 @@ if ($resql)
$sign = 1;
$cash=$bank=$cheque=$other=0;
$totalarray=array();
$totalarray = array();
$cachebankaccount = array();
$amountpertype = array();
while ($i < $num)
{
$objp = $db->fetch_object($resql);
@ -168,7 +175,9 @@ if ($resql)
$bankaccount = $cachebankaccount[$objp->bankid];
}
/*if ($first == "yes")
$invoicetmp->fetch($objp->facid);
/*if ($first == "yes")
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
@ -181,12 +190,10 @@ if ($resql)
// Ref
print '<td class="nowrap left">';
$invoicetmp->fetch($objp->facid);
print $invoicetmp->getNomUrl(1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
// Date ope
print '<td class="nowrap left">';
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
@ -197,26 +204,38 @@ if ($resql)
print '<td class="nowrap right">';
print $bankaccount->getNomUrl(1);
if ($cashcontrol->posmodule=="takepos"){
if ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber}==$bankaccount->id) $cash+=$objp->amount;
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$cashcontrol->posnumber}==$bankaccount->id) $bank+=$objp->amount;
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$cashcontrol->posnumber}==$bankaccount->id) $cheque+=$objp->amount;
else $other+=$objp->amount;
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber;
}
else{
if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
else $other+=$objp->amount;
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH';
}
if ($objp->code == 'CHQ') {
$cheque += $objp->amount;
} elseif ($objp->code == 'CB') {
$bank += $objp->amount;
} 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 $other += $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
// Debit
// Type
print '<td class="right">';
print $objp->code;
if (empty($amountpertype[$objp->code])) $amountpertype[$objp->code] = 0;
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
// Debit
print '<td class="right">';
if ($objp->amount < 0)
{
print price($objp->amount * -1);
$totalarray['val']['totaldebfield'] += $objp->amount;
$amountpertype[$objp->code] += $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
@ -228,6 +247,7 @@ if ($resql)
{
print price($objp->amount);
$totalarray['val']['totalcredfield'] += $objp->amount;
$amountpertype[$objp->code] -= $objp->amount;
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
@ -243,12 +263,34 @@ if ($resql)
print "</table>";
$cash=$cash+$cashcontrol->opening;
//$cash = $amountpertype['LIQ'] + $cashcontrol->opening;
$cash = $cash + $cashcontrol->opening;
print "<div style='text-align: right'><h2>";
print $langs->trans("Cash").": ".price($cash)."<br><br>";
print $langs->trans("PaymentTypeCB").": ".price($bank)."<br><br>";
print $langs->trans("PaymentTypeCHQ").": ".price($cheque)."<br><br>";
if ($other) print $langs->trans("Other").": ".price($other)."<br><br>";
print $langs->trans("Cash").": ".price($cash);
if ($cash != $cashcontrol->cash) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cash).'</span>';
}
print "<br><br>";
//print '<br>';
print $langs->trans("PaymentTypeCHQ").": ".price($cheque);
if ($cheque != $cashcontrol->cheque) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cheque).'</span>';
}
print "<br><br>";
//print '<br>';
print $langs->trans("PaymentTypeCB").": ".price($bank);
if ($bank != $cashcontrol->card) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->card).'</span>';
}
print "<br><br>";
// print '<br>';
if ($other) {
print '<br>'.$langs->trans("Other").": ".price($other)."<br><br>";
}
print "</h2></div>";
//save totals to DB

View File

@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products'));
$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products', 'banks'));
$action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha');
@ -1030,6 +1030,8 @@ if ($action == 'create')
// Only on template invoices
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')';
$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count");
$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber");
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
foreach ($substitutionarray as $key => $val)
@ -1446,8 +1448,6 @@ else
print '</tr>';
// Bank Account
$langs->load('banks');
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
@ -1468,8 +1468,6 @@ else
print '</tr>';
// Model pdf
$langs->load('banks');
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('Model');

View File

@ -137,6 +137,7 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
/*
* Actions
*/
@ -289,6 +290,39 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors');
$action = '';
}
// Also negative lines should not be allowed on 'non Credit notes' invoices. A test is done when adding or updating lines but we must
// do it again in validation to avoid cases where invoice is created from another object that allow negative lines.
// Note that we can accept the negative line if sum with other lines with same vat is positivie: Because all the lines will be merged together
// when converted into 'available credit' and we will get a positive available credit line.
// Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only).
$array_of_pu_ht_per_vat_rate = array();
$array_of_pu_ht_devise_per_vat_rate = array();
foreach($object->lines as $line) {
if (empty($array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
if (empty($array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
$array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->subprice;
$array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_subprice;
}
//var_dump($array_of_pu_ht_per_vat_rate);exit;
foreach($array_of_pu_ht_per_vat_rate as $vatrate => $tmpvalue)
{
$pu_ht = $array_of_pu_ht_per_vat_rate[$vatrate];
$pu_ht_devise = $array_of_pu_ht_devise_per_vat_rate[$vatrate];
if (($pu_ht < 0 || $pu_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{
$langs->load("errors");
if ($object->type == $object::TYPE_DEPOSIT) {
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
} else {
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
}
$error++;
$action = '';
}
}
}
}
@ -1822,7 +1856,12 @@ if (empty($reshook))
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
if ($object->type == $object::TYPE_DEPOSIT) {
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
} else {
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
}
$error++;
}
else
@ -2203,7 +2242,12 @@ if (empty($reshook))
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
if ($object->type == $object::TYPE_DEPOSIT) {
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
} else {
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
}
$error++;
}
else
@ -5106,6 +5150,7 @@ elseif ($id > 0 || !empty($ref))
// For situation invoice with excess received
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& $usercancreate
&& !$objectidnext

View File

@ -448,10 +448,12 @@ class Facture extends CommonInvoice
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y');
$substitutionarray['__INVOICE_YEAR__'] = dol_print_date($this->date, '%Y');
$substitutionarray['__INVOICE_NEXT_YEAR__'] = dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y');
// Only for tempalte invoice
// Only for template invoice
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = dol_print_date($originaldatewhen, 'dayhour');
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($nextdatewhen, 'dayhour');
$substitutionarray['__INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__'] = dol_print_date($previousdaynextdatewhen, 'dayhour');
$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $_facrec->nb_gen_done;
$substitutionarray['__INVOICE_COUNTER_MAX__'] = $_facrec->nb_gen_max;
//var_dump($substitutionarray);exit;
@ -3103,6 +3105,7 @@ class Facture extends CommonInvoice
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new FactureLigne($this->db);
$line->fetch($rowid);
$line->fetch_optionals();
if (!empty($line->fk_product))
{
@ -3171,7 +3174,10 @@ class Facture extends CommonInvoice
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
$result = $this->line->update($user, $notrigger);
@ -4046,7 +4052,7 @@ class Facture extends CommonInvoice
*/
public function initAsSpecimen($option = '')
{
global $langs;
global $conf, $langs;
$now = dol_now();
$arraynow = dol_getdate($now);
@ -4088,9 +4094,14 @@ class Facture extends CommonInvoice
$this->date_lim_reglement = $this->calculate_date_lim_reglement();
$this->mode_reglement_id = 0; // Not forced to show payment mode CHQ + VIR
$this->mode_reglement_code = ''; // Not forced to show payment mode CHQ + VIR
$this->note_public = 'This is a comment (public)';
$this->note_private = 'This is a comment (private)';
$this->note = 'This is a comment (private)';
$this->multicurrency_tx = 1;
$this->multicurrency_code = $conf->currency;
$this->fk_incoterms = 0;
$this->location_incoterms = '';

View File

@ -226,7 +226,7 @@ if ($object->id > 0)
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Type
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">';
@ -282,7 +282,7 @@ if ($object->id > 0)
// Date invoice
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateInvoice');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
@ -309,7 +309,7 @@ if ($object->id > 0)
// Payment condition
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
@ -334,7 +334,7 @@ if ($object->id > 0)
// Date payment term
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateMaxPayment');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
@ -362,7 +362,7 @@ if ($object->id > 0)
// Payment mode
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
@ -409,7 +409,7 @@ if ($object->id > 0)
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{

View File

@ -397,7 +397,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="110" class="nobordernopadding nowrap">';
print '<td class="nobordernopadding nowraponall">';
print $facturestatic->getNomUrl(1, '');
print '</td>';
print '<td width="20" class="nobordernopadding nowrap">';
@ -509,7 +509,7 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->
//$thirdpartystatic->code_compta = $obj->code_compta;
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td>';
print '<tr class="oddeven nowraponall"><td>';
print $facstatic->getNomUrl(1, '');
print '</td>';
print '<td>';

View File

@ -63,7 +63,7 @@ $object = new BonPrelevement($db, "");
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard'));
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
/*
* Actions
@ -362,10 +362,19 @@ if ($id > 0 || $ref)
$urladd = "&amp;id=".$id;
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print '<form method="get" action="' . $_SERVER ['PHP_SELF'] . '" name="search_form">' . "\n";
print '<input type="hidden" name="id" value="' . $id . '"/>';
print '<input type="hidden" name="socid" value="' . $socid . '"/>';
if (! empty($page)) {
print '<input type="hidden" name="page" value="' . $page . '"/>';
}
if (! empty($limit)) {
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
}
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
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" width="100%" cellspacing="0" cellpadding="4">';
print '<table class="noborder liste" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Lines", $_SERVER["PHP_SELF"], "pl.rowid", '', $urladd);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);
@ -375,7 +384,7 @@ if ($id > 0 || $ref)
$total = 0;
while ($i < min($num, $conf->liste_limit))
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
@ -433,6 +442,7 @@ if ($id > 0 || $ref)
print "</table>";
print '</div>';
print '</form>';
$db->free($result);
}

View File

@ -196,6 +196,7 @@ else
print "</form>\n";
print "</div>\n";
print '</form>';
print '<br>';
@ -224,6 +225,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql.= $db->plimit($limit+1, $offset);
@ -239,11 +245,12 @@ if ($resql)
if($socid) $param .= '&socid='.urlencode($socid);
if($option) $param .= "&option=".urlencode($option);
if(! empty($page) && $num <= $nbtotalofrecords) $page = 0;
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page" value="'.$page.'">';
if (! empty($limit)) {
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
}
print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);

View File

@ -43,6 +43,9 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjec
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_facture = GETPOST('search_facture', 'alpha');
$search_societe = trim(GETPOST('search_societe', 'alpha'));
// Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -57,6 +60,26 @@ if (! $sortfield) $sortfield="f.ref";
$massactionbutton = '';
$hookmanager->initHooks(array('withdrawalstodolist'));
/*
* Actions
*/
$parameters = array('socid' => $socid, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_facture = '';
$search_societe = '';
$search_array_options = array();
}
/*
* View
@ -98,10 +121,8 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql.= " AND pfd.fk_facture = f.rowid";
if (dol_strlen(trim(GETPOST('search_societe', 'alpha'))))
{
$sql.= natural_search("s.nom", 'search_societe');
}
if ($search_facture) $sql.= natural_search("f.ref", $search_facture);
if ($search_societe) $sql.= natural_search("s.nom", $search_societe);
$sql.=$db->order($sortfield, $sortorder);
@ -140,9 +161,7 @@ else
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
@ -152,6 +171,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
print '<table class="liste centpercent">';
@ -164,13 +184,13 @@ print_liste_field_titre('');
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag(GETPOST('search_facture', 'alpha')).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag(GETPOST('search_societe', 'alpha')).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag($search_facture).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre" class="middle">';
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
@ -141,7 +141,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
if (!$dateech)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$action = 'create';
}
elseif (!$dateperiod)
@ -193,7 +193,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
if (! $dateech)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$action = 'edit';
}
elseif (! $dateperiod)
@ -337,26 +337,26 @@ if ($action == 'create')
print '</td>';
print '</tr>';
// Date end period
// Date
print '<tr>';
print '<td class="fieldrequired">';
print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"));
print '</td>';
print '<td>';
print $form->selectDate(!empty($dateperiod) ? $dateperiod : '-1', 'period', 0, 0, 0, 'charge', 1);
print '</td>';
print '</tr>';
// Date due
print '<tr>';
print '<td class="fieldrequired">';
print $langs->trans("DateDue");
print $langs->trans("Date");
print '</td>';
print '<td>';
print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1);
print '</td>';
print "</tr>\n";
// Date end period
print '<tr>';
print '<td class="fieldrequired">';
print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"));
print '</td>';
print '<td>';
print $form->selectDate(!empty($dateperiod) ? $dateperiod : '-1', 'period', 0, 0, 0, 'charge', 1);
print '</td>';
print '</tr>';
// Amount
print '<tr>';
print '<td class="fieldrequired">';
@ -434,11 +434,11 @@ if ($id > 0)
}
else
{
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("DateDue"), 'value' => -1);
}
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240);
}
@ -515,9 +515,20 @@ if ($id > 0)
print '<table class="border centpercent">';
// Type
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_label."</td>";
print '<tr><td class="titlefield">';
print $langs->trans("Type")."</td><td>".$object->type_label."</td>";
print "</tr>";
// Date
if ($action == 'edit')
{
print '<tr><td>'.$langs->trans("Date")."</td><td>";
print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
print "</td></tr>";
} else {
print "<tr><td>".$langs->trans("Date")."</td><td>".dol_print_date($object->date_ech, 'day')."</td></tr>";
}
// Period end date
print "<tr><td>".$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"))."</td>";
print "<td>";
@ -531,16 +542,6 @@ if ($id > 0)
}
print "</td></tr>";
// Due date
if ($action == 'edit')
{
print '<tr><td>'.$langs->trans("DateDue")."</td><td>";
print $form->selectDate($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
print "</td></tr>";
} else {
print "<tr><td>".$langs->trans("DateDue")."</td><td>".dol_print_date($object->date_ech, 'day')."</td></tr>";
}
// Amount
if ($action == 'edit')
{

View File

@ -499,16 +499,20 @@ class ChargeSociales extends CommonObject
// Load translation files required by the page
$langs->loadLangs(array("customers","bills"));
// We reinit status array to force to redefine them because label may change according to properties values.
$this->labelStatus = array();
$this->labelStatusShort = array();
if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs;
//$langs->load("mymodule");
$this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid');
$this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid');
if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
$this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft');
$this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled');
if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
$this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Unpaid');
$this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Paid');
if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
}
$statusType = 'status1';

View File

@ -121,7 +121,7 @@ $sql .= " AND cs.entity = ".$conf->entity;
// Search criteria
if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref);
if ($search_label) $sql .= natural_search("cs.libelle", $search_label);
if ($search_amount) $sql .= natural_search("cs.amount", price2num(trim($search_amount)), 1);
if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1);
if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status);
$sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim);
//$sql.= dolSqlDateFilter("cs.periode", 0, 0, $year);
@ -217,7 +217,9 @@ if ($resql)
print '<td class="liste_titre" align="left">';
$formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone');
print '</td>';
// Period end date
// Date
print '<td class="liste_titre">&nbsp;</td>';
// Period end date
print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
@ -227,7 +229,6 @@ if ($resql)
print '<td class="liste_titre right">';
print '<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
// Status
print '<td class="liste_titre maxwidthonsmartphone right">';
$liststatus = array('0'=>$langs->trans("Unpaid"), '1'=>$langs->trans("Paid"));
@ -244,9 +245,9 @@ if ($resql)
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cs.paye", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
@ -276,6 +277,10 @@ if ($resql)
print "<td>".$obj->type_label."</td>\n";
if (!$i) $totalarray['nbfield']++;
// Date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
// Date end period
print '<td class="center">';
if ($obj->periode)
@ -295,10 +300,6 @@ if ($resql)
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
$totalarray['val']['totalttcfield'] += $obj->amount;
// Due date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
if (!$i) $totalarray['nbfield']++;

View File

@ -49,7 +49,7 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', $id, 'vat', 'charges');
$result = restrictedArea($user, 'tax', '', 'vat', 'charges');
// Get parameters

View File

@ -155,23 +155,7 @@ if (empty($reshook))
}
}
// Si ajout champ produit libre
if (GETPOST('mode') == 'libre')
{
$date_start_sl = '';
$date_end_sl = '';
if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('date_start_slyear'))
{
$date_start_sl = dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear'));
}
if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('date_end_slyear'))
{
$date_end_sl = dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear'));
}
}
// Param dates
$date_contrat = '';
$date_start_update = '';
$date_end_update = '';
$date_start_real_update = '';
@ -612,7 +596,7 @@ if (empty($reshook))
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST ['prod_entry_mode']);
unset($_POST['prod_entry_mode']);
unset($_POST['qty']);
unset($_POST['type']);
@ -626,8 +610,8 @@ if (empty($reshook))
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST ['np_marginRate']);
unset($_POST ['np_markRate']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
@ -665,11 +649,12 @@ if (empty($reshook))
if (!$error)
{
$objectline = new ContratLigne($db);
if ($objectline->fetch(GETPOST('elrowid')) < 0)
if ($objectline->fetch(GETPOST('elrowid', 'int')) < 0)
{
setEventMessages($objectline->error, $objectline->errors, 'errors');
$error++;
}
$objectline->fetch_optionals();
}
$db->begin();
@ -693,6 +678,7 @@ if (empty($reshook))
$txtva = $vat_rate;
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
@ -735,7 +721,13 @@ if (empty($reshook))
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($objectline->table_element);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
$objectline->array_options = $array_options;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$objectline->array_options[$key] = $array_options[$key];
}
}
// TODO verifier price_min si fk_product et multiprix
@ -1114,6 +1106,7 @@ if ($action == 'create')
if (GETPOST('origin') && GETPOST('originid'))
{
// Parse element/subelement (ex: project_task)
$regs = array();
$element = $subelement = GETPOST('origin');
if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'), $regs))
{
@ -1544,7 +1537,7 @@ else
$sql .= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
$sql .= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
$sql .= " cd.fk_unit,";
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity, p.tosell, p.tobuy, p.tobatch";
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql .= " WHERE cd.rowid = ".$object->lines[$cursorline - 1]->id;
@ -1577,12 +1570,16 @@ else
// Label
if ($objp->fk_product > 0)
{
print '<td>';
$productstatic->id = $objp->fk_product;
$productstatic->type = $objp->ptype;
$productstatic->ref = $objp->pref;
$productstatic->entity = $objp->pentity;
$productstatic->label = $objp->plabel;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->status_batch = $objp->tobatch;
print '<td>';
$text = $productstatic->getNomUrl(1, '', 32);
if ($objp->plabel)
{

View File

@ -9,7 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -73,6 +73,11 @@ class Contrat extends CommonObject
*/
public $ismultientitymanaged = 1;
/**
* @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 1;
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
@ -189,6 +194,36 @@ class Contrat extends CommonObject
protected $lines_id_index_mapper = array();
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20),
'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'Ref supplier', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')),
'mise_en_service' =>array('type'=>'datetime', 'label'=>'Mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'fin_validite' =>array('type'=>'datetime', 'label'=>'Fin validite', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'date_cloture' =>array('type'=>'datetime', 'label'=>'Date cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
'fk_user_mise_en_service' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
);
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
const STATUS_CLOSED = 2;
@ -675,18 +710,18 @@ class Contrat extends CommonObject
{
$this->id = $obj->rowid;
$this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref;
$this->ref_customer = $obj->ref_customer;
$this->ref_supplier = $obj->ref_supplier;
$this->ref_customer = $obj->ref_customer;
$this->ref_supplier = $obj->ref_supplier;
$this->ref_ext = $obj->ref_ext;
$this->entity = $obj->entity;
$this->statut = $obj->statut;
$this->mise_en_service = $this->db->jdate($obj->datemise);
$this->date_contrat = $this->db->jdate($obj->datecontrat);
$this->date_creation = $this->db->jdate($obj->datecontrat);
$this->date_contrat = $this->db->jdate($obj->datecontrat);
$this->date_creation = $this->db->jdate($obj->datecontrat);
$this->fin_validite = $this->db->jdate($obj->fin_validite);
$this->date_cloture = $this->db->jdate($obj->date_cloture);
$this->fin_validite = $this->db->jdate($obj->fin_validite);
$this->date_cloture = $this->db->jdate($obj->date_cloture);
$this->user_author_id = $obj->fk_user_author;
@ -696,9 +731,9 @@ class Contrat extends CommonObject
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->modelpdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf;
$this->fk_projet = $obj->fk_project; // deprecated
$this->fk_projet = $obj->fk_project; // deprecated
$this->fk_project = $obj->fk_project;
$this->socid = $obj->fk_soc;
@ -708,7 +743,7 @@ class Contrat extends CommonObject
$this->db->free($resql);
// Retreive all extrafields
// Retrieve all extrafields
// fetch optionals attributes and labels
$this->fetch_optionals();
@ -1381,10 +1416,10 @@ class Contrat extends CommonObject
/**
* Ajoute une ligne de contrat en base
*
* @param string $desc Description de la ligne
* @param float $pu_ht Prix unitaire HT
* @param int $qty Quantite
* @param float $txtva Taux tva
* @param string $desc Description of line
* @param float $pu_ht Unit price net
* @param int $qty Quantity
* @param float $txtva Vat rate
* @param float $txlocaltax1 Local tax 1 rate
* @param float $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id produit
@ -1739,8 +1774,14 @@ class Contrat extends CommonObject
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
$contractline->array_options = $array_options;
$contractline->id = $rowid;
$contractline->fetch($rowid);
$contractline->fetch_optionals();
// We replace values in $contractline->array_options only for entries defined into $array_options
foreach($array_options as $key => $value) {
$contractline->array_options[$key] = $array_options[$key];
}
$result = $contractline->insertExtraFields();
if ($result < 0)
{
@ -3004,6 +3045,7 @@ class ContratLigne extends CommonObjectLine
$this->oldcopy = new ContratLigne($this->db);
$this->oldcopy->fetch($this->id);
$this->oldcopy->fetch_optionals();
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";

View File

@ -248,9 +248,17 @@ if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract).
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
$filter_dateouvertureprevue=dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
if ($filter_dateouvertureprevue != '' && $filter_opouvertureprevue == -1) $filter_opouvertureprevue = '=';
$filter_date1=dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
if ($filter_date1 != '' && $filter_op1 == -1) $filter_op1 = '=';
$filter_date2=dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
if ($filter_date2 != '' && $filter_op2 == -1) $filter_op2 = '=';
$filter_datecloture=dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
if ($filter_datecloture != '' && $filter_opcloture == -1) $filter_opcloture = '=';
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'";
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'";
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
@ -259,6 +267,8 @@ if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$sql .= $db->order($sortfield, $sortorder);
//print $sql;
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{

View File

@ -352,6 +352,7 @@ if (!$error && $massaction == 'confirm_presend')
{
$langs->load("commercial");
$reg = array();
$fromtype = GETPOST('fromtype');
if ($fromtype === 'user') {
$from = $user->getFullName($langs).' <'.$user->email.'>';

View File

@ -273,6 +273,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$langs->load("commercial");
$reg = array();
$fromtype = GETPOST('fromtype', 'alpha');
if ($fromtype === 'robot') {
$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
@ -292,7 +293,8 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$from = trim($tmp[($reg[1] - 1)]);
}
elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1];
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
$sql .= ' WHERE rowid = '.(int) $reg[1];
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
if ($obj)

View File

@ -34,11 +34,15 @@ if ($action == 'update' && is_array($arrayofparameters))
$ok=true;
foreach($arrayofparameters as $key => $val)
{
$result=dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result < 0)
// Modify constant only if key was posted (avoid resetting key to the null value)
if (GETPOSTISSET($key))
{
$ok=false;
break;
$result=dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result < 0)
{
$ok=false;
break;
}
}
}

View File

@ -109,7 +109,7 @@ class box_factures_imp extends ModeleBoxes
$sql.= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql.= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
$sql.= " ORDER BY datelimite ASC, f.ref ASC ";

View File

@ -94,6 +94,7 @@ class box_services_expired extends ModeleBoxes
if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
$sql.= ", s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
$sql .= " ORDER BY date_line ASC";
$sql .= $this->db->plimit($max, 0);

View File

@ -1123,7 +1123,7 @@ abstract class CommonDocGenerator
*/
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
{
global $hookmanager;
global $hookmanager, $conf;
foreach ($this->cols as $colKey => $colDef) {
$parameters = array(
@ -1153,6 +1153,14 @@ abstract class CommonDocGenerator
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
global $outputlangsbis;
if (is_object($outputlangsbis)) {
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] + 4);
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
$pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']);
}
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
}
}

View File

@ -4199,6 +4199,7 @@ abstract class CommonObject
$product_static->ref = $line->ref; //can change ref in hook
$product_static->label = $line->label; //can change label in hook
$text = $product_static->getNomUrl(1);
// Define output language and label
@ -5186,7 +5187,6 @@ abstract class CommonObject
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey];
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
if ($attributeRequired)
{
$mandatorypb = false;
@ -5217,7 +5217,6 @@ abstract class CommonObject
}
}
switch ($attributeType)
{
case 'int':
@ -6124,7 +6123,7 @@ abstract class CommonObject
$param_list_array = explode(':', $param_list[0]);
$showempty = (($required && $default != '') ? 0 : 1);
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, empty($val['disabled']) ? 0 : 1);
$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1);
if (!empty($param_list_array[2])) // If we set to add a create button
{
@ -6612,7 +6611,7 @@ abstract class CommonObject
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue;
// @todo Add test also on 'enabled' (different than 'list' that is 'visibility')
$enabled = 1;
//$enabled = 1;
$visibility = 1;
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key]))
@ -7523,7 +7522,10 @@ abstract class CommonObject
}
// If field is an implicit foreign key field
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) $values[$key] = 'null';
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) {
if (isset($this->fields[$key]['default'])) $values[$key] = $this->fields[$key]['default'];
else $values[$key] = 'null';
}
if (!empty($this->fields[$key]['foreignkey']) && empty($values[$key])) $values[$key] = 'null';
}

View File

@ -225,7 +225,8 @@ class DolEditor
breakAfterClose : true
});
}
}';
},
disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER)?'true':'false');
if ($this->uselocalbrowser)
{

View File

@ -1145,8 +1145,8 @@ class DolGraph
/**
* Output HTML string to show graph
*
* @param int $shownographyet Show graph to say there is not enough data
* @return string HTML string to show graph
* @param int|string $shownographyet Show graph to say there is not enough data or the message in $shownographyet if it is a string.
* @return string HTML string to show graph
*/
public function show($shownographyet = 0)
{
@ -1155,7 +1155,13 @@ class DolGraph
if ($shownographyet)
{
$s = '<div class="nographyet" style="width:'.(preg_match('/%/', $this->width) ? $this->width : $this->width.'px').'; height:'.(preg_match('/%/', $this->height) ? $this->height : $this->height.'px').';"></div>';
$s .= '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
$s .= '<div class="nographyettext">';
if (is_numeric($shownographyet)) {
$s .= $langs->trans("NotEnoughDataYet");
} else {
$s .= $shownographyet;
}
$s .= '</div>';
return $s;
}

View File

@ -105,6 +105,7 @@ require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/autoload.php';
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
use Mike42\Escpos\PrintConnectors\DummyPrintConnector;
use Mike42\Escpos\CapabilityProfile;
use Mike42\Escpos\Printer;
use Mike42\Escpos\EscposImage;
@ -529,7 +530,13 @@ class dolReceiptPrinter extends Printer
$this->printer->text("Most simple example\n");
$this->printer->feed();
$this->printer->cut();
//print '<pre>'.print_r($this->connector, true).'</pre>';
// If is DummyPrintConnector send to log to debugging
if($this->printer->connector instanceof DummyPrintConnector)
{
$data = $this->printer->connector-> getData();
dol_syslog($data);
}
$this->printer->close();
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
@ -713,9 +720,13 @@ class dolReceiptPrinter extends Printer
break;
}
}
// Close and print
// uncomment next line to see content sent to printer
//print '<pre>'.print_r($this->connector, true).'</pre>';
// If is DummyPrintConnector send to log to debugging
if($this->printer->connector instanceof DummyPrintConnector)
{
$data = $this->printer->connector->getData();
dol_syslog($data);
}
// Close and print
$this->printer->close();
}
return $error;
@ -783,7 +794,6 @@ class dolReceiptPrinter extends Printer
try {
switch ($obj['fk_type']) {
case 1:
require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/src/DummyPrintConnector.php';
$this->connector = new DummyPrintConnector();
break;
case 2:

View File

@ -20,8 +20,8 @@
*/
/**
* \file class/emailsenderprofile.class.php
* \ingroup monmodule
* \file core/class/emailsenderprofile.class.php
* \ingroup core
* \brief This file is a CRUD class file for EmailSenderProfile (Create/Read/Update/Delete)
*/
@ -30,6 +30,7 @@ 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 EmailSenderProfile
*/
@ -60,24 +61,29 @@ class EmailSenderProfile extends CommonObject
const STATUS_ENABLED = 1;
/**
* 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', '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.
* 'enabled' is a condition when the field must be managed.
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
* '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).
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
* '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_...).
* 'position' is the sort order of field.
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
* 'help' is a string visible as a tooltip on field
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* '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")
* '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
@ -90,12 +96,12 @@ class EmailSenderProfile extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>-1, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1),
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')),
);
/**

View File

@ -2147,23 +2147,27 @@ class ExtraFields
if (in_array($key_type, array('date', 'datetime')))
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)."year") continue; // Value was not provided, we should not set it.
// Clean parameters
$value_key = dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
$value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'));
}
elseif (in_array($key_type, array('checkbox', 'chkbxlst')))
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
// Make sure we get an array even if there's only one checkbox
$value_arr = (array) $value_arr;
$value_key = implode(',', $value_arr);
}
elseif (in_array($key_type, array('price', 'double')))
elseif (in_array($key_type, array('price', 'double', 'int')))
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key = price2num($value_arr);
}
else
{
if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
$value_key = GETPOST($keysuffix."options_".$key.$keyprefix);
}

View File

@ -690,18 +690,19 @@ class Form
/**
* Return combo list of activated countries, into language of user
*
* @param string $selected Id or Code or Label of preselected country
* @param string $htmlname Name of html select object
* @param string $htmloption More html options on select object
* @param integer $maxlength Max length for labels (0=no limit)
* @param string $morecss More css class
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
* @param int $showempty Show empty choice
* @param int $disablefavorites 1=Disable favorites,
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
* @return string HTML string with select
* @param string $selected Id or Code or Label of preselected country
* @param string $htmlname Name of html select object
* @param string $htmloption More html options on select object
* @param integer $maxlength Max length for labels (0=no limit)
* @param string $morecss More css class
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
* @param int $showempty Show empty choice
* @param int $disablefavorites 1=Disable favorites,
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
* @param array $exclude_country_code Array of country code (iso2) to exclude
* @return string HTML string with select
*/
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0)
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array())
{
// phpcs:enable
global $conf, $langs, $mysoc;
@ -733,6 +734,7 @@ class Form
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$countryArray[$i]['rowid'] = $obj->rowid;
$countryArray[$i]['code_iso'] = $obj->code_iso;
$countryArray[$i]['code_iso3'] = $obj->code_iso3;
@ -765,6 +767,7 @@ class Form
{
//if (empty($showempty) && empty($row['rowid'])) continue;
if (empty($row['rowid'])) continue;
if (is_array($exclude_country_code) && count($exclude_country_code) && in_array($row['code_iso'], $exclude_country_code)) continue; // exclude some countries
if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) $atleastonefavorite++;
if (empty($row['favorite']) && $atleastonefavorite)
@ -2361,6 +2364,7 @@ class Form
$objp->price_ttc = price2num($objp->price_ttc, 'MU');
}
}
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel, $filterkey);
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
@ -2511,7 +2515,7 @@ class Form
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
$sql .= " LIMIT 1";
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level.'', LOG_DEBUG);
$result2 = $this->db->query($sql);
if ($result2)
{
@ -2639,7 +2643,7 @@ class Form
$langs->load("stocks");
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->rowid);
$tmpproduct->fetch($objp->rowid, '', '', '', 1, 1, 1); // Load product without lang and prices arrays (we just need to make ->virtual_stock() after)
$tmpproduct->load_virtual_stock();
$virtualstock = $tmpproduct->stock_theorique;
@ -5169,11 +5173,11 @@ class Form
{
if ($societe_vendeuse->id == $mysoc->id)
{
$return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</div>';
$return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</font>';
}
else
{
$return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</div>';
$return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</font>';
}
return $return;
}
@ -6235,7 +6239,12 @@ class Form
$out .= '<option value="'.$key.'"';
$out .= $style.$disabled;
if ($id != '' && $id == $key && !$disabled) $out .= ' selected'; // To preselect a value
if (is_array($id)) {
if (in_array($key, $id) && !$disabled) $out .= ' selected'; // To preselect a value
} else {
$id = (string) $id; // if $id = 0, then $id = '0'
if ($id != '' && $id == $key && !$disabled) $out .= ' selected'; // To preselect a value
}
if ($nohtmlescape) $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
if (is_array($tmpvalue))
{
@ -8012,4 +8021,23 @@ class Form
return -1;
}
}
/**
* Output the component to make advanced search criteries
*
* @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...)
* @param array $search_component_params Array of selected search criterias
* @return string HTML component for advanced search
*/
public function searchComponent($arrayofcriterias, $search_component_params)
{
$ret = '';
return $ret;
}
}

View File

@ -309,7 +309,7 @@ class FormAccounting extends Form
return -1;
}
$selected = 0;
$selected = $selectid; // selectid can be -1, 0, 123
while ($obj = $this->db->fetch_object($resql))
{
if (empty($obj->labelshort))

View File

@ -1712,8 +1712,8 @@ class FormFile
if (count($filearray) == 0)
{
print '<tr class="oddeven"><td colspan="5">';
if (empty($textifempty)) print $langs->trans("NoFileFound");
else print $textifempty;
if (empty($textifempty)) print '<span class="opacitymedium">'.$langs->trans("NoFileFound").'</span>';
else print '<span class="opacitymedium">'.$textifempty.'</span>';
print '</td></tr>';
}
print "</table>";

View File

@ -569,7 +569,9 @@ class FormMail extends Form
}
// Add also email aliases from the c_email_senderprofile table
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1 ORDER BY position';
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
$sql .= ' ORDER BY position';
$resql = $this->db->query($sql);
if ($resql)
{

View File

@ -508,7 +508,7 @@ class SMTPs
// The error here just means the ID/password combo doesn't work.
$_retVal = $this->socket_send_str(base64_encode("\0" . $this->_smtpsID . "\0" . $this->_smtpsPW), '235');
break;
case 'LOGIN':
case 'LOGIN': // most common case
default:
$this->socket_send_str('AUTH LOGIN', '334');
// User name will not return any error, server will take anything we give it.
@ -588,7 +588,11 @@ class SMTPs
// From this point onward most server response codes should be 250
// Specify who the mail is from....
// This has to be the raw email address, strip the "name" off
$this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
$resultmailfrom = $this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
if (! $resultmailfrom) {
fclose($this->socket);
return false;
}
// 'RCPT TO:' must be given a single address, so this has to loop
// through the list of addresses, regardless of TO, CC or BCC
@ -1792,6 +1796,7 @@ class SMTPs
$_retVal = false;
break;
}
$this->log .= $server_response;
$limit++;
}

View File

@ -8,7 +8,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra))
}
// Add extra fields
$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')';
$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC';
//print $sql;
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)

View File

@ -1818,7 +1818,7 @@ function email_admin_prepare_head()
$head[$h][2] = 'templates';
$h++;
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && !empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
{
$head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php";
$head[$h][1] = $langs->trans("EmailSenderProfiles");

View File

@ -172,7 +172,7 @@ function account_statement_prepare_head($object, $num)
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$object->id.'&num='.$num;
$head[$h][1] = $langs->trans("AccountStatements");
$head[$h][1] = $langs->trans("AccountStatement");
$head[$h][2] = 'statement';
$h++;

View File

@ -82,16 +82,16 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
$hookmanager->initHooks(array('fileslib'));
$parameters = array(
'path' => $newpath,
'types'=> $types,
'recursive' => $recursive,
'filter' => $filter,
'excludefilter' => $excludefilter,
'sortcriteria' => $sortcriteria,
'sortorder' => $sortorder,
'loaddate' => $loaddate,
'loadsize' => $loadsize,
'mode' => $mode
'path' => $newpath,
'types'=> $types,
'recursive' => $recursive,
'filter' => $filter,
'excludefilter' => $excludefilter,
'sortcriteria' => $sortcriteria,
'sortorder' => $sortorder,
'loaddate' => $loaddate,
'loadsize' => $loadsize,
'mode' => $mode
);
$reshook = $hookmanager->executeHooks('getDirList', $parameters, $object);
}
@ -146,14 +146,14 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
$level1name = (isset($reg[1]) ? $reg[1] : '');
$file_list[] = array(
"name" => $file,
"path" => $path,
"level1name" => $level1name,
"relativename" => ($relativename ? $relativename.'/' : '').$file,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
"type" => 'dir'
"name" => $file,
"path" => $path,
"level1name" => $level1name,
"relativename" => ($relativename ? $relativename.'/' : '').$file,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
"type" => 'dir'
);
}
}
@ -179,14 +179,14 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
$level1name = (isset($reg[1]) ? $reg[1] : '');
$file_list[] = array(
"name" => $file,
"path" => $path,
"level1name" => $level1name,
"relativename" => ($relativename ? $relativename.'/' : '').$file,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
"type" => 'file'
"name" => $file,
"path" => $path,
"level1name" => $level1name,
"relativename" => ($relativename ? $relativename.'/' : '').$file,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
"type" => 'file'
);
}
}
@ -197,7 +197,7 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
// Obtain a list of columns
if (! empty($sortcriteria) && $sortorder)
{
$file_list = dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ? 'asc' : 'desc'));
$file_list = dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ? 'asc' : 'desc'));
}
}
}
@ -445,8 +445,8 @@ function dol_is_dir($folder)
*/
function dol_is_dir_empty($dir)
{
if (!is_readable($dir)) return false;
return (count(scandir($dir)) == 2);
if (!is_readable($dir)) return false;
return (count(scandir($dir)) == 2);
}
/**
@ -514,7 +514,7 @@ function dol_dir_is_emtpy($folder)
else return false;
}
else
return true; // Dir does not exists
return true; // Dir does not exists
}
/**
@ -624,14 +624,14 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask
if (empty($arrayreplacementisregex))
{
$content = make_substitutions($content, $arrayreplacement, null);
$content = make_substitutions($content, $arrayreplacement, null);
}
else
{
foreach ($arrayreplacement as $key => $value)
{
$content = preg_replace($key, $value, $content);
}
foreach ($arrayreplacement as $key => $value)
{
$content = preg_replace($key, $value, $content);
}
}
file_put_contents($newpathoftmpdestfile, $content);
@ -1044,8 +1044,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
$checkvirusarray = dolCheckVirus($src_file);
if (count($checkvirusarray))
{
dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING);
return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray);
dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING);
return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray);
}
}
@ -1141,7 +1141,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
global $hookmanager;
// Load translation files required by the page
$langs->loadLangs(array('other', 'errors'));
$langs->loadLangs(array('other', 'errors'));
dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook);
@ -1158,10 +1158,10 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
$hookmanager->initHooks(array('fileslib'));
$parameters = array(
'GET' => $_GET,
'file' => $file,
'disableglob'=> $disableglob,
'nophperrors' => $nophperrors
'GET' => $_GET,
'file' => $file,
'disableglob'=> $disableglob,
'nophperrors' => $nophperrors
);
$reshook = $hookmanager->executeHooks('deleteFile', $parameters, $object);
}
@ -1458,9 +1458,9 @@ function dol_meta_create($object)
fputs($fp, $meta);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
@chmod($file, octdec($conf->global->MAIN_UMASK));
return 1;
return 1;
}
else
{
@ -1830,19 +1830,19 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
global $langs;
if (class_exists('Imagick'))
{
$image = new Imagick();
$image = new Imagick();
try {
$filetoconvert = $fileinput.(($page != '') ? '['.$page.']' : '');
//var_dump($filetoconvert);
$ret = $image->readImage($filetoconvert);
$filetoconvert = $fileinput.(($page != '') ? '['.$page.']' : '');
//var_dump($filetoconvert);
$ret = $image->readImage($filetoconvert);
} catch (Exception $e) {
$ext = pathinfo($fileinput, PATHINFO_EXTENSION);
dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install php-imagick ghostscript' and check there is no policy to disable ".$ext." convertion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING);
$ext = pathinfo($fileinput, PATHINFO_EXTENSION);
dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install php-imagick ghostscript' and check there is no policy to disable ".$ext." convertion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING);
return 0;
}
if ($ret)
{
$ret = $image->setImageFormat($ext);
$ret = $image->setImageFormat($ext);
if ($ret)
{
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
@ -1850,13 +1850,13 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
$count = $image->getNumberImages();
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
{
try {
try {
$ret = $image->writeImages($fileoutput, true);
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_WARNING);
}
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_WARNING);
}
}
else
{
@ -2106,16 +2106,16 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
elseif ($mode == 'zip')
{
/*if (defined('ODTPHP_PATHTOPCLZIP'))
{
$foundhandler=0; // TODO implement this
{
$foundhandler=0; // TODO implement this
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
$archive = new PclZip($outputfile);
$archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile));
//$archive->add($inputfile);
return 1;
}
else*/
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
$archive = new PclZip($outputfile);
$archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile));
//$archive->add($inputfile);
return 1;
}
else*/
//if (class_exists('ZipArchive') && ! empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS))
if (class_exists('ZipArchive'))
{
@ -2532,14 +2532,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
$original_file=$conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
}
elseif ($modulepart == 'massfilesarea_sendings')
{
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed=1;
}
$original_file=$conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file;
}
elseif ($modulepart == 'massfilesarea_sendings')
{
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed=1;
}
$original_file=$conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file;
}
elseif ($modulepart == 'massfilesarea_invoices')
{
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file))
@ -2963,18 +2963,21 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
exit;
}
$perm = GETPOST('perm');
$subperm = GETPOST('subperm');
if ($perm || $subperm)
{
if (($perm && !$subperm && $fuser->rights->$modulepart->$perm) || ($perm && $subperm && $fuser->rights->$modulepart->$perm->$subperm)) $accessallowed = 1;
$original_file = $conf->$modulepart->dir_output.'/'.$original_file;
}
else
{
if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1;
$original_file = $conf->$modulepart->dir_output.'/'.$original_file;
}
/*$perm = GETPOST('perm', 'aZ09');
$subperm = GETPOST('subperm', 'aZ09');
if ($perm || $subperm)
{
if (($perm && !$subperm && $fuser->rights->$modulepart->$perm) || ($perm && $subperm && $fuser->rights->$modulepart->$perm->$subperm)) $accessallowed = 1;
}
else
{*/
// Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read
$partsofdirinoriginalfile = explode('/', $original_file);
$partofdirinoriginalfile = $partsofdirinoriginalfile[0];
if ($partofdirinoriginalfile && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) $accessallowed = 1;
if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1;
//}
$original_file = $conf->$modulepart->dir_output.'/'.$original_file;
}
// For modules who wants to manage different levels of permissions for documents

View File

@ -1140,7 +1140,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
{
$limittitle = 30;
$out .= '<a class="tabTitle">';
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' ';
if ($picto) $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle').' ';
$out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>';
$out .= '</a>';
}
@ -2064,7 +2064,7 @@ function dol_now($mode = 'gmt')
$tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
$ret = (int) (dol_now('gmt') + ($tzsecond * 3600));
}
/*else if ($mode == 'tzref') // Time for now with parent company timezone is added
/*elseif ($mode == 'tzref') // Time for now with parent company timezone is added
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time
@ -3060,7 +3060,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
@ -4605,7 +4605,6 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
return $amount;
}
/**
* Output a dimension with best unit
*
@ -6090,6 +6089,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object) ? $object->address : '');
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object) ? $object->zip : '');
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object) ? $object->town : '');
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = (is_object($object) ? $object->country_id : '');
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = (is_object($object) ? $object->country_code : '');
$substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object) ? $object->idprof1 : '');
$substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object) ? $object->idprof2 : '');
$substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object) ? $object->idprof3 : '');
@ -6113,6 +6114,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object->thirdparty) ? $object->thirdparty->address : '');
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object->thirdparty) ? $object->thirdparty->zip : '');
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object->thirdparty) ? $object->thirdparty->town : '');
$substitutionarray['__THIRDPARTY_COUNTRY_ID__'] = (is_object($object->thirdparty) ? $object->thirdparty->country_id : '');
$substitutionarray['__THIRDPARTY_COUNTRY_CODE__'] = (is_object($object->thirdparty) ? $object->thirdparty->country_code : '');
$substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof1 : '');
$substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof2 : '');
$substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object->thirdparty) ? $object->thirdparty->idprof3 : '');
@ -8499,7 +8502,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
*/
function isAFileWithExecutableContent($filename)
{
if (preg_match('/\.(htm|html|js|php|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename))
if (preg_match('/\.(htm|html|js|php|php\d+|phtml|pl|py|cgi|ksh|sh|bash|bat|cmd|wpk|exe|dmg)$/i', $filename))
{
return true;
}

View File

@ -2613,3 +2613,32 @@ function convertBackOfficeMediasLinksToPublicLinks($notetoshow)
$notetoshow = preg_replace('/src="[a-zA-Z0-9_\/\-\.]*(viewimage\.php\?modulepart=medias[^"]*)"/', 'src="'.$urlwithroot.'/\1"', $notetoshow);
return $notetoshow;
}
/**
* Function to format a value into a defined format for French administration (no thousand separator & decimal separator force to ',' with two decimals)
* Function used into accountancy FEC export
*
* @param float $amount Amount to format
* @return string Chain with formatted upright
* @see price2num() Format a numeric into a price for FEC files
*/
function price2fec($amount)
{
global $conf;
// Clean parameters
if (empty($amount)) $amount=0; // To have a numeric value if amount not defined or = ''
$amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number)
// Output decimal number by default
$nbdecimal = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH) ? 2 : $conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH);
// Output separators by default
$dec = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR) ? ',' : $conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR);
$thousand = (empty($conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR) ? '' : $conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR);
// Format number
$output = number_format($amount, $nbdecimal, $dec, $thousand);
return $output;
}

View File

@ -10,6 +10,7 @@
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2019 Lenin Rivas <lenin.rivas@servcom-it.com>
*
* 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
@ -2153,6 +2154,17 @@ function pdf_getLinkedObjects($object, $outputlangs)
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs);
}
}
elseif ($objecttype == 'fichinter')
{
$outputlangs->load('interventions');
foreach($objects as $elementobject)
{
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("InterRef");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("InterDate");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->datec, 'day', '', $outputlangs);
}
}
elseif ($objecttype == 'shipping')
{
$outputlangs->loadLangs(array("orders", "sendings"));

View File

@ -935,7 +935,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
// Warning
print '<td class="right">';
/*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
else if ($disabledtask)
elseif ($disabledtask)
{
$titleassigntask = $langs->trans("AssignTaskToMe");
if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...');

View File

@ -283,7 +283,7 @@ if (! function_exists('dol_loginfunction'))
// Set jquery theme
$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
$favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png';
$favicon = DOL_URL_ROOT.'/theme/dolibarr_logo_256x256.png';
if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;

View File

@ -1474,7 +1474,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Cash Control
if (!empty($conf->takepos->enabled) || !empty($conf->cashdesk->enabled))
{
$permtomakecashfence = ($user->rights->cashdesk->use || $user->rights->takepos->use);
$permtomakecashfence = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("POS"), 0, $permtomakecashfence, '', $mainmenu, 'cashcontrol');
$newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create", $langs->trans("NewCashFence"), 1, $permtomakecashfence);
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.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
@ -118,7 +118,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
$form = new Form($this->db);
$texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="COMMANDE_ADDON_PDF_ODT_PATH">';
@ -177,6 +177,11 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
$texte .= '</div>';
}
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
$texte .= '<input type="hidden" value="COMMANDE_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
$texte .= '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
$texte .= '</div>';
$texte .= '</td>';

View File

@ -116,7 +116,7 @@ class pdf_einstein extends ModelePDFCommandes
/**
* Issuer
* @var Societe object that emits
* @var Societe Object that emits
*/
public $emetteur;
@ -160,8 +160,6 @@ class pdf_einstein extends ModelePDFCommandes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->franchise=!$mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined
@ -678,13 +676,13 @@ class pdf_einstein extends ModelePDFCommandes
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);

View File

@ -77,7 +77,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'development';
public $version = 'dolibarr';
/**
* @var int page_largeur
@ -116,7 +116,7 @@ class pdf_eratosthene extends ModelePDFCommandes
/**
* Issuer
* @var Societe
* @var Societe Object that emits
*/
public $emetteur;
@ -160,8 +160,6 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->franchise=!$mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined
@ -200,9 +198,16 @@ class pdf_eratosthene extends ModelePDFCommandes
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
// Translations
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
global $outputlangsbis;
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
}
$nblines = count($object->lines);
$hidetop=0;
@ -391,7 +396,7 @@ class pdf_eratosthene extends ModelePDFCommandes
}
}
// Affiche notes
// Displays notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
{
@ -866,17 +871,17 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param Object $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
* @return int Pos y
*/
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
@ -1073,11 +1078,19 @@ class pdf_eratosthene extends ModelePDFCommandes
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$useborder = 0;
$index = 0;
$outputlangsbis = null;
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
}
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
@ -1116,7 +1129,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1147,7 +1161,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1173,7 +1188,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat .= vatrate($tvakey, 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1204,7 +1220,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1236,7 +1253,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1253,7 +1271,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(224, 224, 224);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalTTC", $mysoc->country_code) : ''), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
@ -1276,7 +1294,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("AlreadyPaid") : ''), 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
@ -1284,7 +1302,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(224, 224, 224);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("AlreadyPaid") : ''), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
@ -1333,7 +1351,9 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
}
}
$pdf->SetDrawColor(128, 128, 128);
@ -1360,14 +1380,14 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param string $titlekey Translation key to show as title of document
* @return void
* @return int Return topshift value
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
{
// phpcs:enable
global $conf,$langs,$hookmanager;
// Translations
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies"));
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -1449,7 +1469,15 @@ class pdf_eratosthene extends ModelePDFCommandes
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && ! empty($object->thirdparty->code_client))
{
$posy+=4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
}
// Get contact
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))

View File

@ -28,7 +28,7 @@
* \brief File of Class to generate PDF orders with template Proforma
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/doc/pdf_einstein.modules.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/doc/pdf_eratosthene.modules.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
* Class to generate PDF orders with template Proforma
*/
class pdf_proforma extends pdf_einstein
class pdf_proforma extends pdf_eratosthene
{
/**

View File

@ -168,6 +168,13 @@ class pdf_espadon extends ModelePdfExpedition
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
global $outputlangsbis;
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
}
$nblines = count($object->lines);
// Loop on each lines to detect if there is at least one image to show
@ -781,7 +788,9 @@ class pdf_espadon extends ModelePdfExpedition
if (empty($hidetop))
{
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
}
}
$pdf->SetDrawColor(128, 128, 128);

View File

@ -155,8 +155,6 @@ class pdf_standard extends ModeleExpenseReport
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->franchise = !$mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;

View File

@ -117,7 +117,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Issuer
* @var Societe object that emits
* @var Societe Object that emits
*/
public $emetteur;
@ -171,8 +171,6 @@ class pdf_crabe extends ModelePDFFactures
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->franchise = !$mysoc->tva_assuj;
// Get source company
$this->emetteur = $mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
@ -965,14 +963,14 @@ class pdf_crabe extends ModelePDFFactures
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
@ -1040,13 +1038,28 @@ class pdf_crabe extends ModelePDFFactures
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
// Show online payment link
$useonlinepayment = ((! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
if ($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD' && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs;
$langs->loadLangs(array('payment', 'paybox'));
$servicename=$langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
}
$posy = $pdf->GetY() + 2;
}
// Show payment mode CHQ
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
{
// If unregulated or forced payment mode to CHQ
// If payment mode unregulated or payment mode forced to CHQ
if (!empty($conf->global->FACTURE_CHQ_NUMBER))
{
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);

View File

@ -78,7 +78,7 @@ class pdf_sponge extends ModelePDFFactures
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'development';
public $version = 'dolibarr';
/**
* @var int page_largeur
@ -117,7 +117,7 @@ class pdf_sponge extends ModelePDFFactures
/**
* Issuer
* @var Societe
* @var Societe Object that emits
*/
public $emetteur;
@ -171,8 +171,6 @@ class pdf_sponge extends ModelePDFFactures
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->franchise=!$mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined
@ -209,15 +207,24 @@ class pdf_sponge extends ModelePDFFactures
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblines;
global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
// Translations
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
global $outputlangsbis;
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
}
$nblines = count($object->lines);
$hidetop=0;
@ -340,7 +347,7 @@ class pdf_sponge extends ModelePDFFactures
$heightforinfotot = 50+(4*$nbpayments); // Height reserved to output the info and total part and payment part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)?12:22); // Height reserved to output the footer (value include bottom margin)
$heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
if (class_exists('TCPDF'))
{
@ -944,7 +951,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 4);
// Loop on each deposits and credit notes included
// Loop on each discount available (deposits and credit notes and excess of payment included)
$sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
$sql .= " re.description, re.fk_facture_source,";
$sql .= " f.type, f.datef";
@ -961,9 +968,10 @@ class pdf_sponge extends ModelePDFFactures
$y += 3;
$obj = $this->db->fetch_object($resql);
if ($obj->type == 2) $text = $outputlangs->trans("CreditNote");
elseif ($obj->type == 3) $text = $outputlangs->trans("Deposit");
else $text = $outputlangs->trans("UnknownType");
if ($obj->type == 2) $text = $outputlangs->transnoentities("CreditNote");
elseif ($obj->type == 3) $text = $outputlangs->transnoentities("Deposit");
elseif ($obj->type == 0) $text = $outputlangs->transnoentities("ExcessReceived");
else $text = $outputlangs->transnoentities("UnknownType");
$invoice->fetch($obj->fk_facture_source);
@ -1037,18 +1045,18 @@ class pdf_sponge extends ModelePDFFactures
* @param Object $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
* @return int Pos y
*/
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
{
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
@ -1116,13 +1124,27 @@ class pdf_sponge extends ModelePDFFactures
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
// Show online payment link
$useonlinepayment = ((! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT));
if ($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD' && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs;
$langs->loadLangs(array('payment', 'paybox'));
$servicename=$langs->transnoentities('Online');
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
$pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1);
}
$posy=$pdf->GetY()+2;
}
// Show payment mode CHQ
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
{
// If payment mode not forced or forced to CHQ
// If payment mode unregulated or payment mode forced to CHQ
if (! empty($conf->global->FACTURE_CHQ_NUMBER))
{
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
@ -1190,9 +1212,9 @@ class pdf_sponge extends ModelePDFFactures
/**
* Show total to pay
*
* @param PDF $pdf Object PDF
* @param PDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $deja_regle Montant deja regle
* @param int $deja_regle Amount already paid (in the currency of invoice)
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
@ -1221,7 +1243,12 @@ class pdf_sponge extends ModelePDFFactures
$useborder=0;
$index = 0;
$outputlangsbis = null;
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
}
// overall percentage of advancement
$percent = 0;
@ -1358,7 +1385,7 @@ class pdf_sponge extends ModelePDFFactures
if (! empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount"), 0, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
@ -1368,7 +1395,7 @@ class pdf_sponge extends ModelePDFFactures
if (! empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) {
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount"), 0, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
@ -1379,8 +1406,9 @@ class pdf_sponge extends ModelePDFFactures
// Total HT
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
$total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);
@ -1424,7 +1452,8 @@ class pdf_sponge extends ModelePDFFactures
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1456,7 +1485,8 @@ class pdf_sponge extends ModelePDFFactures
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1506,7 +1536,8 @@ class pdf_sponge extends ModelePDFFactures
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat .= vatrate($tvakey, 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1537,7 +1568,8 @@ class pdf_sponge extends ModelePDFFactures
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT1", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1570,7 +1602,8 @@ class pdf_sponge extends ModelePDFFactures
$tvakey=str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : '');
$totalvat.=' ';
$totalvat.=vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1587,7 +1620,7 @@ class pdf_sponge extends ModelePDFFactures
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RevenueStamp"), $useborder, 'L', 1);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RevenueStamp").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("RevenueStamp", $mysoc->country_code) : ''), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->revenuestamp), $useborder, 'R', 1);
@ -1598,7 +1631,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(224, 224, 224);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalTTC") : ''), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
@ -1648,7 +1681,7 @@ class pdf_sponge extends ModelePDFFactures
// Billed - retained warranty
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
@ -1658,7 +1691,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty") . ' ('.$object->retained_warranty.'%)';
$retainedWarrantyToPayOn.= !empty($object->retained_warranty_date_limit)?' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit)?' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
@ -1670,27 +1703,29 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetTextColor(0, 0, 0);
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$creditnoteamount = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
$depositsamount = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0;
if (!empty($object->paye)) $resteapayer = 0;
if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
{
// Already paid + Deposits
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Paid"), 0, 'L', 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Paid").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("Paid") : ''), 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0);
// Credit note
if ($creditnoteamount)
{
$labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes");
$labeltouse .= (is_object($outputlangsbis) ? ' / '.($outputlangsbis->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangsbis->transnoentities("CreditNotesOrExcessReceived") : $outputlangsbis->transnoentities("CreditNotes") : '');
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $labeltouse, 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
}
@ -1702,7 +1737,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("EscompteOfferedShort") : ''), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1);
@ -1713,7 +1748,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(224, 224, 224);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("RemainderToPay") : ''), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
@ -1775,7 +1810,9 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
}
}
$pdf->SetDrawColor(128, 128, 128);
@ -1806,7 +1843,7 @@ class pdf_sponge extends ModelePDFFactures
{
global $conf, $langs;
// Translations
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "bills", "propal", "companies"));
$default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -42,6 +42,10 @@ abstract class ModelePDFFactures extends CommonDocGenerator
*/
public $error='';
public $atleastonediscount = 0;
public $atleastoneratenotnull = 0;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules

View File

@ -142,8 +142,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Display product-service code
$this->franchise=!$mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default, if was not defined

View File

@ -85,10 +85,10 @@ class modCashDesk extends DolibarrModules
$r++;
$this->rights[$r][0] = 50101;
$this->rights[$r][1] = 'Use point of sale';
$this->rights[$r][1] = 'Use Point of sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'use';
$this->rights[$r][4] = 'run';
// Main menu entries
$this->menus = array(); // List of menus to add
@ -103,7 +103,7 @@ class modCashDesk extends DolibarrModules
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>900,
'enabled'=>'$conf->cashdesk->enabled',
'perms'=>'$user->rights->cashdesk->use', // Use 'perms'=>'1' if you want your menu with no permission rules
'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules
'target'=>'pointofsale',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -633,7 +633,7 @@ class modFournisseur extends DolibarrModules
*/
public function init($options = '')
{
global $conf;
global $conf, $langs;
$this->remove($options);

View File

@ -45,7 +45,7 @@ class modMrp extends DolibarrModules
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 660; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
$this->numero = 660;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'mrp';
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
@ -240,17 +240,17 @@ class modMrp extends DolibarrModules
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read objects of Mrp'; // Permission label
$this->rights[$r][1] = 'Read Manufacturing Order'; // Permission label
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/Update objects of Mrp'; // Permission label
$this->rights[$r][1] = 'Create/Update Manufacturing Order'; // Permission label
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete objects of Mrp'; // Permission label
$this->rights[$r][1] = 'Delete Manufacturing Order'; // Permission label
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
$r++;

View File

@ -199,10 +199,10 @@ class modTakePos extends DolibarrModules
$r++;
$this->rights[$r][0] = 50151;
$this->rights[$r][1] = 'Use point of sale';
$this->rights[$r][1] = 'Use Point Of Sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'use';
$this->rights[$r][4] = 'run';
// Main menu entries
@ -221,7 +221,7 @@ class modTakePos extends DolibarrModules
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r,
'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled.
'perms'=>'1', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
'perms'=>'$user->rights->takepos->run', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules
'target'=>'takepos',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both

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