Merge branch 'develop' into 12.0_a8

This commit is contained in:
Alexandre SPANGARO 2020-02-02 14:44:50 +01:00
commit 91b4f7c663
181 changed files with 4304 additions and 3311 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

@ -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

@ -29,18 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load("admin");
$action=GETPOST('action', 'alpha');
$action = GETPOST('action', 'alpha');
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="date";
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "date";
if (empty($page) || $page == -1) { $page = 0; }
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;
if (! $user->admin)
if (!$user->admin)
accessforbidden();
@ -52,33 +52,33 @@ if ($action == 'delete')
{
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
{
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
$ret=dol_delete_file($file, 1);
$file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
$ret = dol_delete_file($file, 1);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
else
{
$file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
$ret=dol_delete_file($file, 1);
$file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
$ret = dol_delete_file($file, 1);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
$action='';
$action = '';
}
/*
* View
*/
$form=new Form($db);
$form = new Form($db);
$formfile = new FormFile($db);
$label=$db::LABEL;
$type=$db->type;
$label = $db::LABEL;
$type = $db->type;
//var_dump($db);
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
$help_url = 'EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
llxHeader('', '', $help_url);
print '<script type="text/javascript">
@ -141,9 +141,9 @@ print '<br>';
print '<div id="backupdatabaseleft" class="fichehalfleft" >';
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
print load_fiche_titre($title ? $title : $langs->trans("BackupDumpWizard"));
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').' nohover">';
print '<table width="100%" class="'.($useinecm ? 'nobordernopadding' : 'liste').' nohover">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
@ -186,11 +186,11 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
{
$fullpathofmysqldump=$db->getPathOfDump();
$fullpathofmysqldump = $db->getPathOfDump();
}
else
{
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
}
print '<br>';
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
@ -203,7 +203,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '</div>';
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
print '<div class="formelementrow">';
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
@ -242,7 +242,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
print '</legend>';
print '<input type="checkbox" name="drop"'.(((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':'').' id="checkbox_dump_drop" />';
print '<input type="checkbox" name="drop"'.(((!isset($_GET["drop"]) && !isset($_POST["drop"])) || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
print '<br>';
print '</fieldset>';
@ -293,7 +293,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
print '</div>';
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
print '<div class="formelementrow">';
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
@ -303,7 +303,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<br>';
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />';
print '<input type="checkbox" name="nobin_drop"'.((!isset($_GET["nobin_drop"]) && !isset($_POST["nobin_drop"])) || GETPOST('nobin_drop')) ? ' checked' : ''.' id="checkbox_dump_drop" />';
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
print '<br>';
print '</fieldset>';
@ -338,11 +338,11 @@ if (in_array($type, array('pgsql'))) {
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
$fullpathofpgdump=$db->getPathOfDump();
$fullpathofpgdump = $db->getPathOfDump();
}
else
{
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
}
print '<br>';
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
@ -391,33 +391,28 @@ print '<legend>'.$langs->trans("Destination").'</legend> -->';
print '<br>';
print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
print '<br>';
$prefix='dump';
$ext='.sql';
$prefix = 'dump';
$ext = '.sql';
if (in_array($type, array('mysql', 'mysqli'))) {
$prefix='mysqldump';
$ext='sql';
$prefix = 'mysqldump';
$ext = 'sql';
}
//if ($label == 'PostgreSQL') {
// $prefix='pg_dump';
// $ext='dump';
//}
if (in_array($type, array('pgsql'))) {
$prefix='pg_dump';
$ext='sql';
$prefix = 'pg_dump';
$ext = 'sql';
}
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
print '<br>';
print '<br>';
// Define compressions array
$compression=array();
$compression = array();
if (in_array($type, array('mysql', 'mysqli'))) {
$compression['none'] = array(
'function' => '',
'id' => 'radio_compression_none',
'label' => $langs->trans("None")
);
$compression['gz'] = array(
'function' => 'gzopen',
'id' => 'radio_compression_gzip',
@ -434,13 +429,18 @@ if (in_array($type, array('mysql', 'mysqli'))) {
'id' => 'radio_compression_bzip',
'label' => $langs->trans("Bzip2")
);
$compression['none'] = array(
'function' => '',
'id' => 'radio_compression_none',
'label' => $langs->trans("None")
);
}
else
{
$compression['none'] = array(
'function' => '',
'id' => 'radio_compression_none',
'label' => $langs->trans("Default")
'label' => $langs->trans("None")
);
$compression['gz'] = array(
'function' => 'gzopen',
@ -455,11 +455,14 @@ print "\n";
print $langs->trans("Compression").': &nbsp; ';
$i = 0;
foreach($compression as $key => $val)
{
if (! $val['function'] || function_exists($val['function'])) {
// Enabled export format
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
$checked = '';
if ($key == 'gz') $checked = ' checked';
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
}
else
@ -467,9 +470,10 @@ foreach($compression as $key => $val)
// Disabled export format
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
print ' ('.$langs->trans("NotAvailable").')';
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
}
print ' &nbsp; &nbsp; ';
$i++;
}
print '</div>';
@ -484,7 +488,7 @@ print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">'
print '<br>';
print '<br>';
if (! empty($_SESSION["commandbackuplastdone"]))
if (!empty($_SESSION["commandbackuplastdone"]))
{
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
@ -496,11 +500,11 @@ if (! empty($_SESSION["commandbackuplastdone"]))
print '<b>'.$langs->trans("BackupResult").':</b> ';
print $_SESSION["commandbackupresult"];
$_SESSION["commandbackuplastdone"]='';
$_SESSION["commandbackuptorun"]='';
$_SESSION["commandbackupresult"]='';
$_SESSION["commandbackuplastdone"] = '';
$_SESSION["commandbackuptorun"] = '';
$_SESSION["commandbackupresult"] = '';
}
if (! empty($_SESSION["commandbackuptorun"]))
if (!empty($_SESSION["commandbackuptorun"]))
{
print '<br><font class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':</font><br>'."\n";
print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
@ -509,9 +513,9 @@ if (! empty($_SESSION["commandbackuptorun"]))
//print $paramclear;
$_SESSION["commandbackuplastdone"]='';
$_SESSION["commandbackuptorun"]='';
$_SESSION["commandbackupresult"]='';
$_SESSION["commandbackuplastdone"] = '';
$_SESSION["commandbackuptorun"] = '';
$_SESSION["commandbackupresult"] = '';
}
print "</div> <!-- end div center button -->\n";
@ -525,8 +529,8 @@ print "</div> <!-- end div fichehalfleft -->\n";
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
print '<div class="ficheaddleft">';
$filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
print '<br>';
print '</div>';
@ -542,6 +546,7 @@ print "<!-- Dump of a server -->\n";
print '<form method="post" action="export_files.php" name="dump">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="export_type" value="server" />';
print '<input type="hidden" name="page_y" value="" />';
print '<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>';
@ -555,34 +560,39 @@ print load_fiche_titre($title?$title:$langs->trans("BackupZipWizard"));
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
$prefix='documents';
$ext='zip';
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
print '<br>';
// Show compression choices
// Example: With gz choice, you can compress in 5mn, a file of 2GB directory (after compression) with 10 Mb memory.
print '<div class="formelementrow">';
print "\n";
print $langs->trans("Compression").': &nbsp; ';
$filecompression = $compression;
array_shift($filecompression);
unset($filecompression['none']);
$filecompression['zip']= array('function' => 'dol_compress_dir', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip"));
$i = 0;
foreach($filecompression as $key => $val)
{
if (! $val['function'] || function_exists($val['function'])) // Enabled export format
{
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
$checked = '';
if ($key == 'gz') $checked = ' checked';
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
}
else // Disabled export format
{
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
print ' ('.$langs->trans("NotAvailable").')';
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
}
print ' &nbsp; &nbsp; ';
$i++;
}
print '</div>';
@ -600,7 +610,7 @@ print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px;
print '<div class="ficheaddleft">';
$filearray=dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
print '<br>';
print '</div>';

View File

@ -18,8 +18,8 @@
*/
/**
* \file htdocs/admin/tools/export.php
* \brief Page to export a database into a dump file
* \file htdocs/admin/tools/export_files.php
* \brief Page to export documents into a compressed file
*/
require '../../main.inc.php';
@ -33,10 +33,11 @@ $langs->load("admin");
$action=GETPOST('action', 'alpha');
$what=GETPOST('what', 'alpha');
$export_type=GETPOST('export_type', 'alpha');
$file=GETPOST('zipfilename_template', 'alpha');
$file=trim(GETPOST('zipfilename_template', 'alpha'));
$compression = GETPOST('compression');
$file = dol_sanitizeFileName($file);
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
@ -73,7 +74,7 @@ if ($action == 'delete')
*/
// Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit=600;
$ExecTimeLimit=1800; // 30mn
if (!empty($ExecTimeLimit))
{
$err=error_reporting();
@ -88,7 +89,7 @@ if (!empty($MemoryLimit))
@ini_set('memory_limit', $MemoryLimit);
}
$form=new Form($db);
$form = new Form($db);
$formfile = new FormFile($db);
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
@ -112,10 +113,18 @@ $utils = new Utils($db);
if ($compression == 'zip')
{
$file .= '.zip';
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/');
if ($ret < 0)
{
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
if ($ret == -2) {
$langs->load("errors");
$errormsg = $langs->trans("ErrNoZipEngine");
}
else {
$langs->load("errors");
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
}
}
}
elseif (in_array($compression, array('gz', 'bz')))
@ -124,7 +133,6 @@ elseif (in_array($compression, array('gz', 'bz')))
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
$file = substr($file, 0, strrpos($file, '.'));
$file .= '.tar';
// We also exclude '/temp/' dir and 'documents/admin/documents'
$cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude='documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT);

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

@ -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

@ -20,7 +20,7 @@
/**
* \file htdocs/comm/multiprix.php
* \ingroup societe
* \brief Onglet choix du niveau de prix
* \brief Tab to set the price level of a thirdparty
*/
require '../main.inc.php';
@ -64,20 +64,11 @@ $userstatic = new User($db);
if ($_socid > 0)
{
// On recupere les donnees societes par l'objet
// We load data of thirdparty
$objsoc = new Societe($db);
$objsoc->id = $_socid;
$objsoc->fetch($_socid, $to);
if ($errmesg)
{
print '<div class="error">'.$errmesg.'</div><br>';
}
/*
* Affichage onglets
*/
$head = societe_prepare_head($objsoc);
@ -91,7 +82,7 @@ if ($_socid > 0)
dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company');
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefieldcreate">';
print $langs->trans("PriceLevel").'</td><td>'.$objsoc->price_level."</td></tr>";

View File

@ -3346,7 +3346,7 @@ class Propal extends CommonObject
*/
public function initAsSpecimen()
{
global $langs;
global $conf, $langs;
// Load array of products prodids
$num_prods = 0;
@ -3385,6 +3385,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

@ -217,12 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_type = '';
$search_country = '';
$search_type_thirdparty = '';
$search_date_start='';
$search_date_end='';
$search_dateend_start='';
$search_dateend_end='';
$search_datedelivery_start='';
$search_datedelivery_end='';
$search_date_start = '';
$search_date_end = '';
$search_dateend_start = '';
$search_dateend_end = '';
$search_datedelivery_start = '';
$search_datedelivery_end = '';
$search_availability = '';
$viewstatut = '';
$object_statut = '';
@ -338,13 +338,13 @@ if ($viewstatut != '' && $viewstatut != '-1')
{
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
}
if ($search_date_start) $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
if ($search_date_end) $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '" . $db->idate($search_dateend_start) . "'";
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '" . $db->idate($search_dateend_end) . "'";
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
if ($search_date_start) $sql .= " AND p.datep >= '".$db->idate($search_date_start)."'";
if ($search_date_end) $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
if ($search_user > 0)
{
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user);
@ -599,12 +599,12 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
print '</div>';
print '</td>';
}
@ -613,12 +613,12 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1);
print '</div>';
print '</td>';
}
@ -627,12 +627,12 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
print '</div>';
print '</td>';
}

View File

@ -2542,6 +2542,11 @@ if ($action == 'create' && $usercancreate)
// Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
if (empty($reshook)) {
// Reopen a closed order
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>';
}
// Send
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($usercansend) {
@ -2619,11 +2624,6 @@ if ($action == 'create' && $usercancreate)
}
}
// Reopen a closed order
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>';
}
// Set to shipped
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';

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;
@ -3083,6 +3085,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;
@ -3715,7 +3718,7 @@ class Commande extends CommonOrder
*/
public function initAsSpecimen()
{
global $langs;
global $conf, $langs;
dol_syslog(get_class($this)."::initAsSpecimen");
@ -3749,8 +3752,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,10 +197,11 @@ if (empty($reshook))
$search_total_ht = '';
$search_total_vat = '';
$search_total_ttc = '';
$search_dateorder_start ='';
$search_dateorder_end ='';
$search_datedelivery_start ='';
$search_datedelivery_end ='';
$search_login='';
$search_dateorder_start = '';
$search_dateorder_end = '';
$search_datedelivery_start = '';
$search_datedelivery_end = '';
$search_project_ref = '';
$search_project = '';
$viewstatut = '';
@ -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.= " 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)
@ -308,10 +314,10 @@ if ($viewstatut <> '')
}
}
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'";
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '" . $db->idate($search_dateorder_end) . "'";
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'";
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'";
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
if ($search_state) $sql .= natural_search("state.nom", $search_state);
@ -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);
@ -646,12 +654,12 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1, 'search_dateorder_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1, 'search_dateorder_end', 0, 0, 1);
print '</div>';
print '</td>';
}
@ -659,12 +667,12 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
print '</div>';
print '</td>';
}
@ -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))
@ -826,7 +843,7 @@ if ($resql)
{
print '<td class="nowrap">';
$generic_commande->getLinesArray(); // This set ->lines
$generic_commande->getLinesArray(); // This set ->lines
print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
@ -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

@ -31,16 +31,16 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","banks","bills","accountancy"));
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
// Security check
$socid = GETPOST("socid", "int");
if ($user->socid) $socid=$user->socid;
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'banque', '', '', '');
$optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$search_ref = GETPOST('search_ref', 'int');
$search_user = GETPOST('search_user', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
@ -61,38 +61,38 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="v.datep,v.rowid";
if (! $sortorder) $sortorder="DESC";
if (!$sortfield) $sortfield = "v.datep,v.rowid";
if (!$sortorder) $sortorder = "DESC";
$filtre=GETPOST("filtre", 'alpha');
$filtre = GETPOST("filtre", 'alpha');
if (! GETPOST('typeid'))
if (!GETPOST('typeid'))
{
$newfiltre=str_replace('filtre=', '', $filtre);
$filterarray=explode('-', $newfiltre);
foreach($filterarray as $val)
$newfiltre = str_replace('filtre=', '', $filtre);
$filterarray = explode('-', $newfiltre);
foreach ($filterarray as $val)
{
$part=explode(':', $val);
if ($part[0] == 'v.fk_typepayment') $typeid=$part[1];
$part = explode(':', $val);
if ($part[0] == 'v.fk_typepayment') $typeid = $part[1];
}
}
else
{
$typeid=GETPOST('typeid');
$typeid = GETPOST('typeid');
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{
$search_ref="";
$search_label="";
$search_date_start='';
$search_date_end='';
$search_amount_deb="";
$search_amount_cred="";
$search_account='';
$search_ref = "";
$search_label = "";
$search_date_start = '';
$search_date_end = '';
$search_amount_deb = "";
$search_amount_cred = "";
$search_account = '';
$search_accountancy_account = '';
$search_accountancy_subledger = '';
$typeid="";
$typeid = "";
}
/*
@ -107,62 +107,62 @@ $variousstatic = new PaymentVarious($db);
$accountstatic = new Account($db);
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
$sql .= " pst.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " WHERE v.entity IN (".getEntity('payment_various').")";
// Search criteria
if ($search_ref) $sql.= " AND v.rowid=".$db->escape($search_ref);
if ($search_label) $sql.= natural_search(array('v.label'), $search_label);
if ($search_date_start) $sql.= " AND v.datep >= '" . $db->idate($search_date_start) . "'";
if ($search_date_end) $sql.= " AND v.datep <= '" . $db->idate($search_date_end) . "'";
if ($search_amount_deb) $sql.= natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql.= natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql.= " AND b.fk_account=".$db->escape($search_account);
if ($search_accountancy_account > 0) $sql.= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
if ($search_accountancy_subledger > 0) $sql.= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
if ($typeid > 0) $sql.= " AND v.fk_typepayment=".$typeid;
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'";
if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'";
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account);
if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
if ($filtre) {
$filtre=str_replace(":", "=", $filtre);
$filtre = str_replace(":", "=", $filtre);
$sql .= " AND ".$filtre;
}
$sql.= $db->order($sortfield, $sortorder);
$sql .= $db->order($sortfield, $sortorder);
$totalnboflines=0;
$result=$db->query($sql);
$totalnboflines = 0;
$result = $db->query($sql);
if ($result)
{
$totalnboflines = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0 ;
$total = 0;
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_label) $param.='&search_label='.urlencode($search_label);
if ($search_date_start) $param.='&search_date_start='.urlencode($search_date_start);
if ($search_date_end) $param.='&search_date_end='.urlencode($search_date_end);
if ($typeid > 0) $param.='&typeid='.urlencode($typeid);
if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb);
if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred);
if ($search_account > 0) $param.='&search_amount='.urlencode($search_account);
if ($search_accountancy_account > 0) $param.='&search_accountancy_account='.urlencode($search_accountancy_account);
if ($search_accountancy_subledger > 0) $param.='&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account);
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
if ($optioncss != '') $param .= '&amp;optioncss='.urlencode($optioncss);
$newcardbutton = '';
if ($user->rights->banque->modifier)
@ -198,12 +198,12 @@ if ($result)
// Date
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
print '</div>';
print '</td>';
@ -227,14 +227,14 @@ if ($result)
// Accounting account
print '<td class="liste_titre">';
print '<div class="nowrap">';
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array (), 1, 1, 'maxwidth200');
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200');
print '</div>';
print '</td>';
// Subledger account
print '<td class="liste_titre">';
print '<div class="nowrap">';
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, array (), 1, 1, 'maxwidth200');
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200');
print '</div>';
print '</td>';
}
@ -246,7 +246,7 @@ if ($result)
print '<td class="liste_titre right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
@ -258,9 +258,9 @@ if ($result)
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
if (! empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
@ -279,19 +279,19 @@ if ($result)
// Ref
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
// Label payment
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
// Date payment
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
// Account
if (!empty($conf->banque->enabled))
@ -316,7 +316,7 @@ if ($result)
}
else print '&nbsp;';
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
}
// Accounting account
@ -325,14 +325,14 @@ if ($result)
$accountingaccount->fetch('', $obj->accountancy_code, 1);
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
}
// Accounting subledger account
if (! empty($conf->accounting->enabled))
if (!empty($conf->accounting->enabled))
{
print '<td>' . length_accounta($obj->subledger_account) . '</td>';
if (! $i) $totalarray['nbfield']++;
print '<td>'.length_accounta($obj->subledger_account).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Debit
@ -342,8 +342,8 @@ if ($result)
print price($obj->amount);
$totalarray['val']['total_deb'] += $obj->amount;
}
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
print '</td>';
// Credit
@ -353,12 +353,12 @@ if ($result)
print price($obj->amount);
$totalarray['val']['total_cred'] += $obj->amount;
}
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
print '</td>' ;
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
print '</td>';
print '<td></td>';
if (! $i) $totalarray['nbfield']++;
if (!$i) $totalarray['nbfield']++;
print "</tr>\n";

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

@ -103,7 +103,9 @@ $extrafields = new ExtraFields($db);
// Load object
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
if ($action != 'add') {
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
}
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -134,6 +136,8 @@ if ($user->socid) $socid = $user->socid;
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
/*
* Actions
*/
@ -286,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 = '';
}
}
}
}
@ -941,11 +978,13 @@ if (empty($reshook))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
}
if (!($_POST['fac_replacement'] > 0)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
@ -992,6 +1031,7 @@ if (empty($reshook))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
$action = 'create';
}
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
@ -999,6 +1039,7 @@ if (empty($reshook))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
@ -1181,6 +1222,7 @@ if (empty($reshook))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
@ -1223,6 +1265,7 @@ if (empty($reshook))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
$action = 'create';
}
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
@ -1230,6 +1273,7 @@ if (empty($reshook))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
@ -1642,6 +1686,7 @@ if (empty($reshook))
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
setEventMessages($mesg, null, 'errors');
$action = 'create';
}
if (!$error) {
@ -1811,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
@ -2123,7 +2173,7 @@ if (empty($reshook))
if (!GETPOST('qty')) $special_code = 3;
$line = new FactureLigne($db);
$line->fetch(GETPOST('lineid'));
$line->fetch(GETPOST('lineid', 'int'));
$percent = $line->get_prev_progress($object->id);
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0)
@ -2192,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
@ -2283,17 +2338,17 @@ if (empty($reshook))
}
}
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier'))
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice
{
if (!$object->fetch($id) > 0) dol_print_error($db);
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "")
if (GETPOST('all_progress') != "")
{
$all_progress = GETPOST('all_progress', 'int');
foreach ($object->lines as $line)
{
$percent = $line->get_prev_progress($object->id);
if (floatval($all_progress) < floatval($percent)) {
$mesg = $langs->trans("Line").' '.$i.' '.$line->ref.' : '.$langs->trans("CantBeLessThanMinPercent");
$mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent");
setEventMessages($mesg, null, 'warnings');
$result = -1;
} else
@ -2303,7 +2358,7 @@ if (empty($reshook))
}
elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) {
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // Pour reaffichage de la fiche en cours d'edition
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
exit();
}
@ -2939,7 +2994,7 @@ if ($action == 'create')
if (($origin == 'propal') || ($origin == 'commande'))
{
print '<td class="nowrap" style="padding-left: 5px">';
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount'), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
print '</td>';
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit', 'int').'"/>';
@ -2992,14 +3047,16 @@ if ($action == 'create')
exit();
}
$options = "";
foreach ($facids as $facparam)
{
$options .= '<option value="'.$facparam ['id'].'"';
if ($facparam ['id'] == $_POST['fac_replacement'])
$options .= ' selected';
$options .= '>'.$facparam ['ref'];
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
$options .= '</option>';
if (is_array($facids)) {
foreach ($facids as $facparam)
{
$options .= '<option value="'.$facparam ['id'].'"';
if ($facparam ['id'] == $_POST['fac_replacement'])
$options .= ' selected';
$options .= '>'.$facparam ['ref'];
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
$options .= '</option>';
}
}
print '<!-- replacement line -->';
@ -3955,7 +4012,7 @@ elseif ($id > 0 || !empty($ref))
if ($result > 0) {
print '. <span class="opacitymediumbycolor">'.$langs->trans(
"GeneratedFromTemplate",
'<a href="'.DOL_MAIN_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$tmptemplate->id.'">'.$tmptemplate->ref.'</a>'
'<a href="'.DOL_MAIN_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.$tmptemplate->ref.'</a>'
).'</span>';
}
}
@ -4240,7 +4297,7 @@ elseif ($id > 0 || !empty($ref))
}
else
{
print $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
if (!$displayWarranty) {
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
}
@ -4557,7 +4614,7 @@ elseif ($id > 0 || !empty($ref))
print '</tr>';
// Payments already done (from payment on this invoice)
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,';
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
$sql .= ' pf.amount,';
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
@ -4583,7 +4640,7 @@ elseif ($id > 0 || !empty($ref))
$paymentstatic->id = $objp->rowid;
$paymentstatic->datepaye = $db->jdate($objp->dp);
$paymentstatic->ref = $objp->ref;
$paymentstatic->num_paiement = $objp->num_paiement;
$paymentstatic->num_payment = $objp->num_payment;
$paymentstatic->payment_code = $objp->payment_code;
print '<tr class="oddeven"><td>';
@ -4591,7 +4648,7 @@ elseif ($id > 0 || !empty($ref))
print '</td>';
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>';
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
print '<td>'.$label.' '.$objp->num_paiement.'</td>';
print '<td>'.$label.' '.$objp->num_payment.'</td>';
if (!empty($conf->banque->enabled))
{
$bankaccountstatic->id = $objp->baid;
@ -5082,21 +5139,6 @@ elseif ($id > 0 || !empty($ref))
}
}
// Clone
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
{
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=clone&amp;object=invoice">'.$langs->trans("ToClone").'</a>';
}
// Clone as predefined / Create template
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
{
if (!$objectidnext && count($object->lines) > 0)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&amp;action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
}
}
// Create a credit note
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate)
{
@ -5108,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
@ -5123,6 +5166,21 @@ elseif ($id > 0 || !empty($ref))
}
}
// Clone
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate)
{
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=clone&amp;object=invoice">'.$langs->trans("ToClone").'</a>';
}
// Clone as predefined / Create template
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate)
{
if (!$objectidnext && count($object->lines) > 0)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&amp;action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
}
}
// Remove situation from cycle
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION

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;
@ -4046,7 +4048,7 @@ class Facture extends CommonInvoice
*/
public function initAsSpecimen($option = '')
{
global $langs;
global $conf, $langs;
$now = dol_now();
$arraynow = dol_getdate($now);
@ -4088,9 +4090,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

@ -480,10 +480,10 @@ if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape(
if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source);
if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source);
if ($search_date_start) $sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'";
if ($search_date_end) $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
if ($search_datelimit_start) $sql .= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'";
if ($search_datelimit_end) $sql .= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'";
if ($search_date_start) $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
if ($search_date_end) $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
if ($search_datelimit_start) $sql .= " AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start)."'";
if ($search_datelimit_end) $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'";
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale;
if ($search_user > 0)
@ -752,12 +752,12 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
print '</div>';
print '</td>';
}
@ -766,12 +766,12 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1);
print $langs->trans('From').' ';
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1);
print $langs->trans('to').' ';
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
print '</div>';
print '</td>';
}

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

@ -637,7 +637,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
print '<tr class="oddeven">';
print '<tr class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
print '<td class="nowraponall">';
print $invoice->getNomUrl(1, '');
@ -715,7 +715,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
// Price
print '<td class="right" '.(($invoice->id == $facid) ? ' style="font-weight: bold" ' : '').'>'.price($sign * $objp->total_ttc).'</td>';
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
// Received or paid back
print '<td class="right">'.price($sign * $paiement);

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')
{
@ -604,7 +605,7 @@ if ($id > 0)
*/
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
$sql .= " c.code as type_code,c.libelle as paiement_type,";
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal';
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
@ -653,6 +654,7 @@ if ($id > 0)
$bankaccountstatic->ref = $objp->baref;
$bankaccountstatic->label = $objp->baref;
$bankaccountstatic->number = $objp->banumber;
$bankaccountstatic->currency_code = $objp->bacurrency_code;
if (!empty($conf->accounting->enabled)) {
$bankaccountstatic->account_number = $objp->account_number;

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

@ -612,7 +612,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 +626,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']);
@ -1114,6 +1114,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 +1545,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 +1578,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
@ -675,18 +675,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 +696,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 +708,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 +1381,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
@ -3004,6 +3004,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

@ -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

@ -33,7 +33,7 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
$result_update=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES), '_public');
$result_update = $object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES, 'UTF-8', 1), '_public');
if ($result_update < 0) setEventMessages($object->error, $object->errors, 'errors');
elseif (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture')))

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
@ -6124,7 +6125,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
{
@ -7523,7 +7524,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

@ -309,7 +309,7 @@ class Conf
{
if (!empty($this->$module->enabled))
{
foreach ($dirs as $type => $name)
foreach ($dirs as $type => $name) // $type is 'output' or 'temp'
{
$subdir = ($type == 'temp' ? '/temp' : '');
// For multicompany sharings

View File

@ -1135,7 +1135,7 @@ class DolGraph
public function total()
{
$value = 0;
foreach($this->data as $valarray) // Loop on each x
foreach ($this->data as $valarray) // Loop on each x
{
$value += $valarray[1];
}

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

@ -213,7 +213,7 @@ class Form
$valuetoshow = price2num($editvalue ? $editvalue : $value);
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ?price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>';
}
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata))
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor'
{
$tmp = explode(':', $typeofdata);
$cols = $tmp[2];
@ -225,8 +225,10 @@ class Form
}
$valuetoshow = ($editvalue ? $editvalue : $value);
$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1] ? $tmp[1] : '20').'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'">';
// textarea convert automatically entities chars into simple chars.
// So we convert & into &amp; so a string like 'a &lt; <b>b</b><br>é<br>&lt;script&gt;alert('X');&lt;script&gt;' stay a correct html and is not converted by textarea component when wysiwig is off.
$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
$ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea'));
$ret .= '</textarea>';
}
@ -688,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;
@ -731,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;
@ -763,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)
@ -2359,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
@ -2509,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)
{
@ -2637,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;
@ -5167,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;
}
@ -5910,7 +5916,7 @@ class Form
//var_dump($objecttmp->filter);
$prefixforautocompletemode = $objecttmp->element;
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company';
if ($prefixforautocompletemode == 'product') $prefixforautocompletemode='produit';
if ($prefixforautocompletemode == 'product') $prefixforautocompletemode = 'produit';
$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
@ -6233,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))
{
@ -7864,7 +7875,7 @@ class Form
*/
public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
{
global $user,$conf,$langs;
global $user, $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -7873,16 +7884,16 @@ class Form
$usertofilter = $user;
}
$out='';
$out = '';
$hideunselectables = false;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
if (empty($projectsListId))
{
if (empty($usertofilter->rights->projet->all->lire))
{
$projectstatic=new Project($this->db);
$projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
}
}
@ -7890,37 +7901,37 @@ class Form
// Search all projects
$sql = 'SELECT f.rowid, f.ref as fref, "nolabel" as flabel, p.rowid as pid, f.ref,
p.title, p.fk_soc, p.fk_statut, p.public,';
$sql.= ' s.nom as name';
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
$sql.= ' '.MAIN_DB_PREFIX.'facture as f';
$sql.= " WHERE p.entity IN (".getEntity('project').")";
$sql.= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
$sql .= ' s.nom as name';
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
$sql .= ' '.MAIN_DB_PREFIX.'facture as f';
$sql .= " WHERE p.entity IN (".getEntity('project').")";
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
//if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
//if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
$sql.= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC";
$sql .= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC";
$resql=$this->db->query($sql);
$resql = $this->db->query($sql);
if ($resql)
{
// Use select2 selector
if (! empty($conf->use_javascript_ajax))
if (!empty($conf->use_javascript_ajax))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
$out.=$comboenhancement;
$morecss='minwidth200imp maxwidth500';
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
if (empty($option_only)) {
$out.= '<select class="valignmiddle flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'">';
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
}
if (! empty($show_empty)) {
$out.= '<option value="0" class="optiongrey">';
if (! is_numeric($show_empty)) $out.=$show_empty;
else $out.='&nbsp;';
$out.= '</option>';
if (!empty($show_empty)) {
$out .= '<option value="0" class="optiongrey">';
if (!is_numeric($show_empty)) $out .= $show_empty;
else $out .= '&nbsp;';
$out .= '</option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
@ -7946,57 +7957,57 @@ class Form
if ($showproject == 'all')
{
$labeltoshow.=dol_trunc($obj->ref, 18); // Invoice ref
if ($obj->name) $labeltoshow.=' - '.$obj->name; // Soc name
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
if ($obj->name) $labeltoshow .= ' - '.$obj->name; // Soc name
$disabled=0;
$disabled = 0;
if ($obj->fk_statut == Project::STATUS_DRAFT)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Draft");
$disabled = 1;
$labeltoshow .= ' - '.$langs->trans("Draft");
}
elseif ($obj->fk_statut == Project::STATUS_CLOSED)
{
if ($discard_closed == 2) $disabled=1;
$labeltoshow.=' - '.$langs->trans("Closed");
if ($discard_closed == 2) $disabled = 1;
$labeltoshow .= ' - '.$langs->trans("Closed");
}
elseif ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
$disabled = 1;
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
}
}
if (!empty($selected) && $selected == $obj->rowid)
{
$out.= '<option value="'.$obj->rowid.'" selected';
$out .= '<option value="'.$obj->rowid.'" selected';
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out.= '>'.$labeltoshow.'</option>';
$out .= '>'.$labeltoshow.'</option>';
}
else
{
if ($hideunselectables && $disabled && ($selected != $obj->rowid))
{
$resultat='';
$resultat = '';
}
else
{
$resultat='<option value="'.$obj->rowid.'"';
if ($disabled) $resultat.=' disabled';
$resultat = '<option value="'.$obj->rowid.'"';
if ($disabled) $resultat .= ' disabled';
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat.='>';
$resultat.=$labeltoshow;
$resultat.='</option>';
$resultat .= '>';
$resultat .= $labeltoshow;
$resultat .= '</option>';
}
$out.= $resultat;
$out .= $resultat;
}
}
$i++;
}
}
if (empty($option_only)) {
$out.= '</select>';
$out .= '</select>';
}
print $out;

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

@ -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

@ -493,7 +493,7 @@ class Utils
}
// Clean old files
if (! $errormsg && $keeplastnfiles > 0)
if (!$errormsg && $keeplastnfiles > 0)
{
$tmpfiles = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '(\.err|\.old|\.sav)$', 'date', SORT_DESC);
$i = 0;

View File

@ -158,7 +158,7 @@ print '
}
else
{
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field page_y with value "+page_y);
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field with name=page_y with value "+page_y);
jQuery("input[type=hidden][name=page_y]").val(page_y);
}
}

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

@ -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',
@ -4515,7 +4515,8 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
/**
* Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user.
* Function to use on each input amount before any numeric test or database insert
* Function to use on each input amount before any numeric test or database insert. A better name for this function
* should be text2num().
*
* @param float $amount Amount to convert/clean
* @param string $rounding ''=No rounding
@ -4604,7 +4605,6 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
return $amount;
}
/**
* Output a dimension with best unit
*
@ -5700,14 +5700,19 @@ function dol_htmlcleanlastbr($stringtodecode)
/**
* Replace html_entity_decode functions to manage errors
*
* @param string $a Operand a
* @param string $b Operand b (ENT_QUOTES=convert simple and double quotes)
* @param string $c Operand c
* @return string String decoded
* @param string $a Operand a
* @param string $b Operand b (ENT_QUOTES=convert simple and double quotes)
* @param string $c Operand c
* @param string $keepsomeentities Entities but &amp;, <, >, " are not converted.
* @return string String decoded
*/
function dol_html_entity_decode($a, $b, $c = 'UTF-8')
function dol_html_entity_decode($a, $b, $c = 'UTF-8', $keepsomeentities = 0)
{
return html_entity_decode($a, $b, $c);
$newstring = $a;
if ($keepsomeentities) $newstring = strtr($newstring, array('&amp;'=>'__andamp__', '&lt;'=>'__andlt__', '&gt;'=>'__andgt__', '"'=>'__dquot__'));
$newstring = html_entity_decode($newstring, $b, $c);
if ($keepsomeentities) $newstring = strtr($newstring, array('__andamp__'=>'&amp;', '__andlt__'=>'&lt;', '__andgt__'=>'&gt;', '__dquot__'=>'"'));
return $newstring;
}
/**
@ -6039,7 +6044,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : '');
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = $outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset(isset($object->availability)?$object->availability:'');
$birthday = dol_print_date($object->birth, 'day');
@ -6084,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 : '');
@ -6107,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 : '');
@ -8493,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);
}
}
else if ($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"));

File diff suppressed because it is too large Load Diff

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);
@ -1039,6 +1037,21 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($posxval, $posy);
$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;
}
@ -1046,7 +1059,7 @@ class pdf_crabe extends ModelePDFFactures
// 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

@ -219,7 +219,7 @@ class modAgenda extends DolibarrModules
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=0',
'type'=>'left',
'titre'=>'Actions',
@ -233,7 +233,7 @@ class modAgenda extends DolibarrModules
'user'=>2,
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=1',
'type'=>'left',
'titre'=>'NewAction',
@ -248,7 +248,7 @@ class modAgenda extends DolibarrModules
);
$r++;
// Calendar
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=1',
'type'=>'left',
'titre'=>'Calendar',
@ -262,7 +262,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=3',
'type'=>'left',
'titre'=>'MenuToDoMyActions',
@ -276,7 +276,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=3',
'type'=>'left',
'titre'=>'MenuDoneMyActions',
@ -290,7 +290,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=3',
'type'=>'left',
'titre'=>'MenuToDoActions',
@ -304,7 +304,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=3',
'type'=>'left',
'titre'=>'MenuDoneActions',
@ -320,7 +320,7 @@ class modAgenda extends DolibarrModules
// List
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=1',
'type'=>'left',
'titre'=>'List',
@ -334,7 +334,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=8',
'type'=>'left',
'titre'=>'MenuToDoMyActions',
@ -348,7 +348,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=8',
'type'=>'left',
'titre'=>'MenuDoneMyActions',
@ -362,7 +362,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=8',
'type'=>'left',
'titre'=>'MenuToDoActions',
@ -376,7 +376,7 @@ class modAgenda extends DolibarrModules
'user'=>2
);
$r++;
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=8',
'type'=>'left',
'titre'=>'MenuDoneActions',
@ -391,7 +391,7 @@ class modAgenda extends DolibarrModules
);
$r++;
// Reports
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu'=>'r=1',
'type'=>'left',
'titre'=>'Reportings',
@ -406,7 +406,7 @@ class modAgenda extends DolibarrModules
);
$r++;
// Categories
$this->menu[$r]=array(
$this->menu[$r] = array(
'fk_menu' => 'r=1',
'type' => 'left',
'titre' => 'Categories',

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

@ -25,7 +25,7 @@
* \brief Fichier de description et activation du module Utilisateur
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
/**
* Class to describe and enable module User
@ -45,7 +45,7 @@ class modUser extends DolibarrModules
$this->db = $db;
$this->numero = 0;
$this->family = "hr"; // Family for module (or "base" if core module)
$this->family = "hr"; // Family for module (or "base" if core module)
$this->module_position = '05';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
@ -55,7 +55,7 @@ class modUser extends DolibarrModules
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto='group';
$this->picto = 'group';
// Data directories to create when module is enabled
$this->dirs = array("/users/temp");
@ -64,28 +64,28 @@ class modUser extends DolibarrModules
$this->config_page_url = array("user.php");
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
$this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->phpmin = array(5,4); // Minimum version of PHP required by module
$this->langfiles = array("main","users","companies","members","salaries","hrm");
$this->always_enabled = true; // Can't be disabled
$this->hidden = false; // A condition to hide module
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
$this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
$this->langfiles = array("main", "users", "companies", "members", "salaries", "hrm");
$this->always_enabled = true; // Can't be disabled
// Constants
$this->const = array();
// Boxes
$this->boxes = array(
0=>array('file'=>'box_lastlogin.php','enabledbydefaulton'=>'Home'),
1=>array('file'=>'box_birthdays.php','enabledbydefaulton'=>'Home')
0=>array('file'=>'box_lastlogin.php', 'enabledbydefaulton'=>'Home'),
1=>array('file'=>'box_birthdays.php', 'enabledbydefaulton'=>'Home')
);
// Permissions
$this->rights = array();
$this->rights_class = 'user';
$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
$r=0;
$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
$r = 0;
$r++;
$this->rights[$r][0] = 251;
@ -140,7 +140,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Consulter ses propres permissions';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'readperms';
$r++;
@ -164,7 +164,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Modifier ses propres permissions';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'writeperms';
$r++;
@ -172,7 +172,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Consulter les groupes';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'read';
$r++;
@ -180,7 +180,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Consulter les permissions des groupes';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'readperms';
$r++;
@ -188,7 +188,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'write';
$r++;
@ -196,7 +196,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Supprimer ou desactiver les groupes';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'delete';
$r++;
@ -209,118 +209,118 @@ class modUser extends DolibarrModules
// Menus
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports
$r=0;
$r = 0;
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='List of users and attributes';
$this->export_permission[$r]=array(array("user","user","export"));
$this->export_fields_array[$r]=array(
'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.employee'=>"Employee",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'List of users and attributes';
$this->export_permission[$r] = array(array("user", "user", "export"));
$this->export_fields_array[$r] = array(
'u.rowid'=>"Id", 'u.login'=>"Login", 'u.lastname'=>"Lastname", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee", 'u.job'=>"PostOrFunction", 'u.gender'=>"Gender",
'u.accountancy_code'=>"UserAccountancyCode",
'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
'u.office_phone'=>'Phone','u.user_mobile'=>"Mobile",'u.office_fax'=>'Fax',
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
'u.fk_user'=>'HierarchicalResponsible','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
'u.office_phone'=>'Phone', 'u.user_mobile'=>"Mobile", 'u.office_fax'=>'Fax',
'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature',
'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours',
'u.dateemployment'=>'DateEmployment', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
'u.birth'=>'BirthdayDate',
'u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
'u.admin'=>"Administrator",'u.statut'=>'Status','u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
'u.datec'=>"DateCreation", 'u.tms'=>"DateLastModification",
'u.admin'=>"Administrator", 'u.statut'=>'Status', 'u.datelastlogin'=>'LastConnexion', 'u.datepreviouslogin'=>'PreviousConnexion',
'u.fk_socpeople'=>"IdContact", 'u.fk_soc'=>"IdCompany", 'u.fk_member'=>"MemberId"
);
$this->export_TypeFields_array[$r]=array(
'u.rowid'=>'Numeric', 'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.employee'=>'Boolean','u.job'=>'Text',
$this->export_TypeFields_array[$r] = array(
'u.rowid'=>'Numeric', 'u.login'=>"Text", 'u.lastname'=>"Text", 'u.firstname'=>"Text", 'u.employee'=>'Boolean', 'u.job'=>'Text',
'u.accountancy_code'=>'Text',
'u.address'=>"Text",'u.zip'=>"Text",'u.town'=>"Text",
'u.office_phone'=>'Text','u.user_mobile'=>'Text','u.office_fax'=>'Text',
'u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date',
'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text',
'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date',
'u.fk_user'=>"List:user:login",
'u.birth'=>'Date',
'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname"
);
$this->export_entities_array[$r]=array(
'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.employee'=>'user','u.job'=>'user','u.gender'=>'user',
$this->export_entities_array[$r] = array(
'u.rowid'=>"user", 'u.login'=>"user", 'u.lastname'=>"user", 'u.firstname'=>"user", 'u.employee'=>'user', 'u.job'=>'user', 'u.gender'=>'user',
'u.accountancy_code'=>'user',
'u.address'=>"user",'u.zip'=>"user",'u.town'=>"user",
'u.office_phone'=>'user','u.user_mobile'=>'user','u.office_fax'=>'user',
'u.email'=>'user','u.note'=>"user",'u.signature'=>'user',
'u.fk_user'=>'user','u.thm'=>'user','u.tjm'=>'user','u.weeklyhours'=>'user',
'u.dateemployment'=>'user','u.salary'=>'user','u.color'=>'user','u.api_key'=>'user',
'u.address'=>"user", 'u.zip'=>"user", 'u.town'=>"user",
'u.office_phone'=>'user', 'u.user_mobile'=>'user', 'u.office_fax'=>'user',
'u.email'=>'user', 'u.note'=>"user", 'u.signature'=>'user',
'u.fk_user'=>'user', 'u.thm'=>'user', 'u.tjm'=>'user', 'u.weeklyhours'=>'user',
'u.dateemployment'=>'user', 'u.salary'=>'user', 'u.color'=>'user', 'u.api_key'=>'user',
'u.birth'=>'user',
'u.datec'=>"user",'u.tms'=>"user",
'u.admin'=>"user",'u.statut'=>'user','u.datelastlogin'=>'user','u.datepreviouslogin'=>'user',
'u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
'u.datec'=>"user", 'u.tms'=>"user",
'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
);
if (empty($conf->adherent->enabled))
{
unset($this->export_fields_array[$r]['u.fk_member']);
unset($this->export_entities_array[$r]['u.fk_member']);
}
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user').')';
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
// Imports
$r=0;
$r = 0;
// Import list of users attributes
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]='ImportDataset_user_1';
$this->import_icon[$r]='user';
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array(
'u.login'=>"Login*",'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = 'ImportDataset_user_1';
$this->import_icon[$r] = 'user';
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('u'=>MAIN_DB_PREFIX.'user', 'extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r] = array(
'u.login'=>"Login*", 'u.lastname'=>"Name*", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee*", 'u.job'=>"PostOrFunction", 'u.gender'=>"Gender",
'u.accountancy_code'=>"UserAccountancyCode",
'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",
'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
'u.fk_user'=>'HierarchicalResponsible','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
'u.pass_crypted'=>"Password", 'u.admin'=>"Administrator", 'u.fk_soc'=>"Company*", 'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
'u.fk_state'=>"StateId", 'u.fk_country'=>"CountryCode",
'u.office_phone'=>"Phone", 'u.user_mobile'=>"Mobile", 'u.office_fax'=>"Fax",
'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature',
'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours',
'u.dateemployment'=>'DateEmployment', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
'u.birth'=>'BirthdayDate',
'u.datec'=>"DateCreation",
'u.statut'=>'Status'
);
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
$resql=$this->db->query($sql);
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
while ($obj = $this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('u.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r]=array(
'u.fk_state'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
'u.fk_country'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
$this->import_fieldshidden_array[$r] = array('u.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r] = array(
'u.fk_state'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/cstate.class.php', 'class'=>'Cstate', 'method'=>'fetch', 'dict'=>'DictionaryState'),
'u.fk_country'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'),
'u.salary'=>array('rule'=>'numeric')
);
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array(
$this->import_regex_array[$r] = array(
'u.employee'=>'^[0|1]',
'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
'u.dateemployment'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'u.birth'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
);
$this->import_examplevalues_array[$r]=array(
$this->import_examplevalues_array[$r] = array(
'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1',
'u.fk_soc'=>'0 (internal user) or company name (external user)', 'u.datec'=>dol_print_date(dol_now(), '%Y-%m-%d'), 'u.address'=>"61 jump street",
'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",
'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
'u.zip'=>"123456", 'u.town'=>"Big town", 'u.fk_country'=>'US, FR, DE...', 'u.office_phone'=>"0101010101", 'u.office_fax'=>"0101010102",
'u.email'=>"test@mycompany.com", 'u.salary'=>"10000", 'u.note'=>"This is an example of note for record", 'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
'u.statut'=>"0 (closed) or 1 (active)",
);
$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
$this->import_updatekeys_array[$r] = array('u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>'Login');
}

View File

@ -58,7 +58,7 @@ class pdf_azur extends ModelePDFPropales
public $description;
/**
* @var string Save the name of generated file as the main doc when generating a doc with this template
* @var string Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
@ -116,7 +116,7 @@ class pdf_azur extends ModelePDFPropales
/**
* Issuer
* @var Societe object that emits
* @var Societe Object that emits
*/
public $emetteur;
@ -160,8 +160,6 @@ class pdf_azur extends ModelePDFPropales
$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
@ -866,13 +864,13 @@ class pdf_azur extends ModelePDFPropales
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

@ -57,7 +57,7 @@ class pdf_cyan extends ModelePDFPropales
public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
* @var string Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
@ -76,7 +76,7 @@ class pdf_cyan extends ModelePDFPropales
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'development';
public $version = 'dolibarr';
/**
* @var int page_largeur
@ -115,7 +115,7 @@ class pdf_cyan extends ModelePDFPropales
/**
* Issuer
* @var Societe
* @var Societe Object that emits
*/
public $emetteur;
@ -159,8 +159,6 @@ class pdf_cyan extends ModelePDFPropales
$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
@ -199,9 +197,16 @@ class pdf_cyan extends ModelePDFPropales
// 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 traductions files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
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", "propal"));
}
$nblines = count($object->lines);
$hidetop=0;
@ -238,7 +243,11 @@ class pdf_cyan extends ModelePDFPropales
{
if (! $arephoto)
{
$dir = $conf->product->dir_output.'/'.$midir;
if ($conf->product->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
}
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
{
@ -413,11 +422,13 @@ class pdf_cyan extends ModelePDFPropales
{
$tmpuser=new User($this->db);
$tmpuser->fetch($object->user_author_id);
$notetoshow.='Affaire suivi par '.$tmpuser->getFullName($langs);
$notetoshow .= $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs);
if ($tmpuser->email) $notetoshow.=', Mail: '.$tmpuser->email;
if ($tmpuser->office_phone) $notetoshow.=', Tel: '.$tmpuser->office_phone;
}
$tab_height = $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter;
$pagenb = $pdf->getPage();
if ($notetoshow)
{
@ -529,7 +540,6 @@ class pdf_cyan extends ModelePDFPropales
$posyafter = $tab_top_newpage;
}
}
$tab_height = $tab_height - $height_note;
$tab_top = $posyafter + 6;
}
@ -962,17 +972,17 @@ class pdf_cyan extends ModelePDFPropales
* @param Object $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
* @return int Pos y
*/
public 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);
@ -1147,6 +1157,7 @@ class pdf_cyan extends ModelePDFPropales
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$tab2_top = $posy;
@ -1164,12 +1175,19 @@ class pdf_cyan extends ModelePDFPropales
$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);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1);
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
$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);
@ -1210,7 +1228,8 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1244,7 +1263,8 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1270,7 +1290,8 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1301,7 +1322,8 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1334,7 +1356,8 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1351,7 +1374,7 @@ class pdf_cyan extends ModelePDFPropales
$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($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
@ -1360,6 +1383,7 @@ class pdf_cyan extends ModelePDFPropales
$pdf->SetTextColor(0, 0, 0);
$resteapayer = 0;
/*
$resteapayer = $object->total_ttc - $deja_regle;
if (! empty($object->paye)) $resteapayer=0;
@ -1370,7 +1394,7 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1395,7 +1419,7 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1444,7 +1468,9 @@ class pdf_cyan extends ModelePDFPropales
$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);
@ -1453,7 +1479,6 @@ class pdf_cyan extends ModelePDFPropales
// Output Rect
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
if (empty($hidetop)){
@ -1475,10 +1500,8 @@ class pdf_cyan extends ModelePDFPropales
{
global $conf, $langs;
$outputlangs->load("main");
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("companies");
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "propal", "companies", "bills"));
$default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -20,7 +20,7 @@
*/
/**
* \file htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
* \file htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
* \ingroup fournisseur
* \brief Class file to generate the supplier invoices with the canelle model
*/
@ -152,8 +152,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->franchise = !$mysoc->tva_assuj;
// Define column position
$this->posxdesc = $this->marge_gauche + 1;
$this->posxtva = 112;

View File

@ -23,7 +23,7 @@
*/
/**
* \file htdocs/core/modules/supplier_order/pdf/doc_generic_supplier_order_odt.modules.php
* \file htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
* \ingroup commande
* \brief File of class to build ODT documents for supplier orders
*/

View File

@ -23,7 +23,7 @@
*/
/**
* \file htdocs/core/modules/supplier_order/pdf/pdf_cornas.modules.php
* \file htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
* \ingroup fournisseur
* \brief File of class to generate suppliers orders from cornas model
*/
@ -71,7 +71,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'development';
public $version = 'dolibarr';
/**
* @var int page_largeur
@ -153,8 +153,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$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
@ -194,6 +192,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "orders", "companies", "bills", "dict", "products"));
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", "orders", "companies", "bills", "dict", "products"));
}
$nblines = count($object->lines);
$hidetop=0;
@ -328,8 +333,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
}
}
// New page
$pdf->AddPage();
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
@ -830,11 +833,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// 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);
@ -1134,7 +1137,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$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);
@ -1364,9 +1369,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// If BILLING contact defined on order, we use it
// If CUSTOMER contact defined on order, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER'
$usecontact = false;
$arrayidcontact = $object->getIdContact('external', 'BILLING');
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
if (count($arrayidcontact) > 0)
{
$usecontact = true;

View File

@ -23,7 +23,7 @@
*/
/**
* \file htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
* \file htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
* \ingroup fournisseur
* \brief File of class to generate suppliers orders from muscadet model
*/
@ -129,7 +129,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->db = $db;
$this->name = "muscadet";
$this->description = $langs->trans('SuppliersCommandModel');
$this->description = $langs->trans('SuppliersCommandModelMuscadet');
// Page size for A4 format
$this->type = 'pdf';
@ -153,8 +153,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$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
@ -732,11 +730,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// 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);
@ -1302,7 +1300,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// If CUSTOMER contact defined on order, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER'
$usecontact=false;
$arrayidcontact=$object->getIdContact('external', 'CUSTOMER');
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
if (count($arrayidcontact) > 0)
{
$usecontact=true;

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