Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop
This commit is contained in:
commit
93fd994435
@ -30,6 +30,7 @@ PHPPrintIPP 1.3 GPL-2+ Yes
|
||||
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
|
||||
TCPDF 6.2.12 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||
|
||||
JS libraries:
|
||||
jQuery 1.11.3 MIT License Yes JS library
|
||||
@ -61,6 +62,8 @@ http://www.gnu.org/licenses/licenses.en.html
|
||||
Copyright
|
||||
---------
|
||||
|
||||
Copyright (C) 2016
|
||||
|
||||
Copyright (C) 2015
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
- Marcos García <marcosgdf@gmail.com>
|
||||
|
||||
80
ChangeLog
80
ChangeLog
@ -34,6 +34,70 @@ So if you included it into your module, change your code like this to be compati
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
||||
FIX: #3815 Call to undefined function local_by_date()
|
||||
FIX: #4424 Missing email of user popup in supplier orders area
|
||||
FIX: #4442 Missing translation in Banks menu
|
||||
FIX: #4737 Bank transacion type selector translation is cropped
|
||||
FIX: #4742 Able to delete a supplier invoice with a registered payment
|
||||
FIX: #4743 UI glitch in project summary page
|
||||
FIX: #4747 Missing UI background when registering a supplier invoice payment
|
||||
FIX: #4748 Supplier invoice payment confirmation amount is not translated
|
||||
FIX: #4766 VAT not shown in supplier invoice popup
|
||||
FIX: #4784
|
||||
FIX: #4809 Duplicate functions with different content
|
||||
FIX: #4812
|
||||
FIX: #4839
|
||||
FIX: #4851 Project selector in supplier invoices shows the project label twice
|
||||
FIX: #4870
|
||||
FIX: #4874 SQL error when listing users
|
||||
FIX: #4880
|
||||
FIX: #4961
|
||||
FIX: #4989
|
||||
FIX: If oauth has never been activated two tables are missing and printing is not working
|
||||
FIX: A not enabled field for list must not into fields to add
|
||||
FIX: Bad color of message password changed
|
||||
FIX: Bad error and style message when changing its own login
|
||||
FIX: Bad function name call on delete
|
||||
FIX: Bad include and param for project numbering module call
|
||||
FIX: bad translation language loaded FIX: When changing thirdparty on event card, the showempty option of contact was lost. FIX: Bad placeholder shown on combo to select a thirdparty.
|
||||
FIX: Bad vat definition when using POS module
|
||||
FIX: Box disabled because bugged
|
||||
FIX: Can not select a commercial on the creation of a third
|
||||
FIX: Check of EAN13 barcode when mask was set to use 13 digits instead of 12
|
||||
FIX: correct display of minimum buying price
|
||||
FIX: Creation of thumb image for size "small" was not done.
|
||||
FIX: Damn, where was the project ref ?
|
||||
FIX: Default vat is not set correctly when an error occured and we use VAT identified by a code.
|
||||
FIX: dont retrieve new buying price on margin display
|
||||
FIX: Duplicate records into export
|
||||
FIX: Each time we edit a line, we loose the unit price.
|
||||
FIX: Email templates not compatible with Multicompany
|
||||
FIX: Export must use a left join to not loose lines
|
||||
FIX: fetchAllEMailTemplate
|
||||
FIX: Filter/search on extrafields on lists
|
||||
FIX: finished parameters not used
|
||||
FIX: Generated thumbs must always use the png format so using thumbs can work.
|
||||
FIX: Hook resprint be printed
|
||||
FIX: image extension must be in lower case
|
||||
FIX: Missing clean of criteria
|
||||
FIX: Missing database escaping on supplier price insert/update
|
||||
FIX: Missing function
|
||||
FIX: Multiprice generator didn't recalculate prices if only the price_base_type property changes
|
||||
FIX: Not removing code into vatrate.
|
||||
FIX: Not showing sellprice properly on product list
|
||||
FIX: Parsing of amount to pay vat
|
||||
FIX: PHPCS
|
||||
FIX: PMP is deprecated at warehouse level
|
||||
FIX: real min buying price
|
||||
FIX: Same term to create than other objects
|
||||
FIX: Some records were lost into margin per product report
|
||||
FIX: systematic rounding causes prices to be updated without reason
|
||||
FIX: Template email must take care of positino column
|
||||
FIX: VAT rate can be negative. Example spain selling to morroco.
|
||||
FIX: When cloning an order the order result from clone must be now
|
||||
FIX: When using option Price per level, when adding a predefined product, the vat for customer was not correctly set.
|
||||
|
||||
***** ChangeLog for 3.9.0 compared to 3.8.* *****
|
||||
For users:
|
||||
NEW: A new and more modern look for "eldy" theme.
|
||||
@ -1067,6 +1131,11 @@ Dolibarr better:
|
||||
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.6.7 compared to 3.6.6 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: CVE CVE-2015-8685
|
||||
|
||||
***** ChangeLog for 3.6.6 compared to 3.6.5 *****
|
||||
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
|
||||
FIX: #4081 Added missing translation
|
||||
@ -1319,6 +1388,17 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
- Remove add_photo_web() that is not used anymore by core code.
|
||||
|
||||
|
||||
***** ChangeLog for 3.5.8 compared to 3.5.7 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: bad calculation for stock value
|
||||
FIX: bad stock valo
|
||||
FIX: change order date on clone (as everywhere else)
|
||||
FIX: CVE CVE-2015-8685
|
||||
FIX: The hours of date filter aren't correct
|
||||
FIX: #3442 Remove useless syslog
|
||||
FIX: #3448 Pass expected date format
|
||||
FIX: #3471 3.5 Rounding issue when dispatching non-integer
|
||||
|
||||
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
|
||||
Fix: Paypal link were broken due to SSL v3 closed.
|
||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||
|
||||
@ -10,6 +10,16 @@ Replace "& new" by "new"
|
||||
|
||||
|
||||
|
||||
CKEDITOR:
|
||||
---------
|
||||
* In ckeditor/ckeditor/contents.css
|
||||
Replace:
|
||||
margin: 20px;
|
||||
With
|
||||
margin: 5px;
|
||||
|
||||
|
||||
|
||||
NUSOAP:
|
||||
-------
|
||||
* In file nusoap.php, to avoid a warning,
|
||||
@ -38,6 +48,7 @@ with:
|
||||
}
|
||||
|
||||
|
||||
|
||||
TCPDF:
|
||||
------
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace
|
||||
@ -45,13 +56,8 @@ define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
|
||||
* Removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
freemono* (russian),
|
||||
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
|
||||
helvetica* (all other languages),
|
||||
zapfdingbats.php (for special chars like form checkboxes)
|
||||
* Removed useless directories (examples, tools)
|
||||
|
||||
* Fix
|
||||
// initialize subsetchars
|
||||
$subsetchars = array();
|
||||
@ -59,13 +65,18 @@ into
|
||||
// initialize subsetchars
|
||||
$subsetchars = array_fill(0, 256, true);
|
||||
|
||||
* Made freemono the default monotype font because we removed courier
|
||||
* Optionnaly, removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
freemono* (russian),
|
||||
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
|
||||
helvetica* (all other languages),
|
||||
zapfdingbats.php (for special chars like form checkboxes)
|
||||
|
||||
* Optionnaly, made freemono the default monotype font because we removed courier
|
||||
In htdocs/includes/tcpdf/tcpdf.php
|
||||
- protected $default_monospaced_font = 'courier';
|
||||
+ protected $default_monospaced_font = 'freemono';
|
||||
|
||||
* Renamed getmypid into dol_getmypid().
|
||||
|
||||
|
||||
|
||||
TCPDI:
|
||||
@ -80,7 +91,6 @@ require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php')
|
||||
|
||||
|
||||
|
||||
|
||||
JSGANTT:
|
||||
--------
|
||||
* Replace in function JSGantt.taskLink
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -43,7 +43,9 @@ $search_pcgtype = GETPOST("search_pcgtype");
|
||||
$search_pcgsubtype = GETPOST("search_pcgsubtype");
|
||||
|
||||
// Security check
|
||||
if (! $user->admin)
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->chartofaccount)
|
||||
accessforbidden();
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@ -145,8 +147,8 @@ if ($result) {
|
||||
print '<br/>';
|
||||
|
||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
print '<br/><br/>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -50,12 +50,14 @@ $main_option = array (
|
||||
|
||||
$model_option = array (
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||
'ACCOUNTING_EXPORT_DATE',
|
||||
'ACCOUNTING_EXPORT_DATE'
|
||||
/*
|
||||
'ACCOUNTING_EXPORT_PIECE',
|
||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
||||
'ACCOUNTING_EXPORT_LABEL',
|
||||
'ACCOUNTING_EXPORT_AMOUNT',
|
||||
'ACCOUNTING_EXPORT_DEVISE'
|
||||
'ACCOUNTING_EXPORT_DEVISE'
|
||||
*/
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@ -263,9 +263,9 @@ if ($result) {
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div align="right"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
|
||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
if (! empty($msg)) {
|
||||
print $msg;
|
||||
|
||||
@ -385,7 +385,7 @@ else {
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -396,7 +396,7 @@ else {
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '<br>';
|
||||
print $langs->trans('To') . ': ';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||
@ -404,14 +404,14 @@ else {
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print '<br>';
|
||||
print $langs->trans('To');
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print '<br>';
|
||||
print $langs->trans('To');
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print '</td>';
|
||||
|
||||
@ -450,7 +450,7 @@ else {
|
||||
print '<td>' . $line->label_compte . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="right">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
|
||||
@ -128,7 +128,9 @@ if ($result)
|
||||
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
|
||||
$param='';
|
||||
$param.="&statut=$statut&date_select=$date_select";
|
||||
if ($statut != '') $param.="&statut=".$statut;
|
||||
if ($date_select) $param.="&date_select=".$date_select;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
if ($search_acount) $param.="&search_account=".$search_account;
|
||||
@ -214,7 +216,7 @@ if ($result)
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$total+=$objp->cotisation;
|
||||
|
||||
@ -153,6 +153,7 @@ if ($action == 'delete' && $user->rights->adherent->configurer)
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -236,7 +237,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
|
||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("cotisation",1,1);
|
||||
@ -247,7 +248,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" cols="60" rows="3"></textarea></td></tr>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -645,7 +646,7 @@ if ($rowid > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" cols="90" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
@ -207,7 +207,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
|
||||
$msgishtml,
|
||||
$errors_to,
|
||||
'',
|
||||
$trackid
|
||||
$trackid
|
||||
);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
@ -259,6 +259,7 @@ $listofmethods=array();
|
||||
$listofmethods['mail']='PHP mail function';
|
||||
//$listofmethods['simplemail']='Simplemail class';
|
||||
$listofmethods['smtps']='SMTP/SMTPS socket library';
|
||||
$listofmethods['swiftmailer']='Swift Mailer socket library';
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
@ -313,6 +314,20 @@ if ($action == 'edit')
|
||||
jQuery("#smtp_server_mess").hide();
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
}
|
||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
|
||||
{
|
||||
jQuery(".drag").show();
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").show();
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").show();
|
||||
jQuery("#smtp_server_mess").hide();
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
}
|
||||
}
|
||||
initfields();
|
||||
jQuery("#MAIN_MAIL_SENDMODE").change(function() {
|
||||
@ -436,7 +451,7 @@ if ($action == 'edit')
|
||||
print '</td></tr>';
|
||||
|
||||
// ID
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
$var=!$var;
|
||||
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:'');
|
||||
@ -456,7 +471,7 @@ if ($action == 'edit')
|
||||
}
|
||||
|
||||
// PW
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
$var=!$var;
|
||||
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
|
||||
@ -478,7 +493,7 @@ if ($action == 'edit')
|
||||
// TLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -492,7 +507,7 @@ if ($action == 'edit')
|
||||
// STARTTLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -581,14 +596,14 @@ else
|
||||
|
||||
// SMTPS ID
|
||||
$var=!$var;
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS PW
|
||||
$var=!$var;
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
|
||||
}
|
||||
@ -596,7 +611,7 @@ else
|
||||
// TLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -610,7 +625,7 @@ else
|
||||
// STARTTLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -705,9 +720,6 @@ else
|
||||
{
|
||||
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
|
||||
|
||||
// If we use SSL/TLS
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mail = new CMailFile('','','','');
|
||||
$result=$mail->check_server_port($server,$port);
|
||||
|
||||
@ -262,7 +262,7 @@ print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("TreeMenuPersonalized").'</td>';
|
||||
|
||||
@ -122,7 +122,10 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
|
||||
$userClass::setCacheIdentifier(static::$role);
|
||||
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
|
||||
return in_array(static::$role, (array) static::$requires) || static::$role == 'admin';
|
||||
|
||||
$requirefortest = static::$requires;
|
||||
if (! is_array($requirefortest)) $requirefortest=explode(',',$requirefortest);
|
||||
return in_array(static::$role, (array) static::$requirefortest) || static::$role == 'admin';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -62,7 +62,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||
{
|
||||
$producttmp->fetch(GETPOST('productid'));
|
||||
$forbarcode=$producttmp->barcode;
|
||||
$fk_barcode_type=$thirdpartytmp->barcode_type_code;
|
||||
$fk_barcode_type=$producttmp->barcode_type;
|
||||
|
||||
if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
|
||||
@ -384,7 +384,7 @@ print '</div>';
|
||||
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
||||
print '<br>';
|
||||
print '<div class="showforthirdpartyselector">';
|
||||
print $form->select_company(GETPOST('socid'), 'socid', '', 1, 0, 0, array(), 0, 'minwidth300');
|
||||
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
|
||||
print ' <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("Search").'</td>';
|
||||
print '</tr>';
|
||||
print '<tr '.$bc[0].'><td>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="20" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
/*
|
||||
// faire une rech dans une sous categorie uniquement
|
||||
print '<tr '.$bc[0].'><td>';
|
||||
|
||||
@ -937,7 +937,7 @@ if ($id > 0)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
|
||||
|
||||
// Type of event
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
@ -951,7 +951,7 @@ if ($id > 0)
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$object->label.'"></td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td colspan="3">';
|
||||
@ -1090,7 +1090,7 @@ if ($id > 0)
|
||||
// Thirdparty - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$events=array();
|
||||
@ -1115,7 +1115,7 @@ if ($id > 0)
|
||||
|
||||
$langs->load("projects");
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
$numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
@ -1125,7 +1125,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// Priority
|
||||
print '<tr><td class="titlefield nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -360,6 +360,7 @@ $showextcals=$listofextcals;
|
||||
|
||||
if (! empty($conf->use_javascript_ajax)) // If javascript on
|
||||
{
|
||||
$s.='<!-- Div to calendars selectors -->'."\n";
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
@ -373,7 +374,7 @@ if (! empty($conf->use_javascript_ajax)) // If javascript on
|
||||
$s.='</script>' . "\n";
|
||||
|
||||
// Local calendar
|
||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
$s.='<div class="nowrap clear float minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
|
||||
// External calendars
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
|
||||
@ -306,10 +306,11 @@ if ($resql)
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("");
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -329,9 +330,12 @@ if ($resql)
|
||||
print '<td class="liste_titre"></td>';
|
||||
//print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
@ -371,7 +375,7 @@ if ($resql)
|
||||
{
|
||||
$labeltype=$obj->type_code;
|
||||
if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype];
|
||||
print '<td>'.dol_trunc($labeltype,24).'</td>';
|
||||
print '<td>'.dol_trunc($labeltype,28).'</td>';
|
||||
}
|
||||
|
||||
// Start date
|
||||
@ -397,7 +401,7 @@ if ($resql)
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->client=$obj->client;
|
||||
$societestatic->name=$obj->societe;
|
||||
print $societestatic->getNomUrl(1,'',10);
|
||||
print $societestatic->getNomUrl(1,'',28);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
@ -409,7 +413,7 @@ if ($resql)
|
||||
$contactstatic->lastname=$obj->lastname;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print $contactstatic->getNomUrl(1,'',10);
|
||||
print $contactstatic->getNomUrl(1,'',28);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -430,6 +434,8 @@ if ($resql)
|
||||
// Status/Percent
|
||||
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ if ($filtert > 0 || $usergroup > 0)
|
||||
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("comm/action/index.php", LOG_DEBUG);
|
||||
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -564,7 +564,7 @@ echo '</form>';
|
||||
//print "begin_d=".$begin_d." end_d=".$end_d;
|
||||
|
||||
|
||||
echo '<table width="100%" class="nocellnopadd cal_month">';
|
||||
echo '<table width="100%" class="noborder nocellnopadd cal_month">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td></td>';
|
||||
@ -703,7 +703,9 @@ foreach ($usernames as $username)
|
||||
{
|
||||
$var = ! $var;
|
||||
echo "<tr>";
|
||||
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">' . $username->getNomUrl(1). '</td>';
|
||||
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">';
|
||||
print $username->getNomUrl(-1,'',0,0,24,1,'');
|
||||
print '</td>';
|
||||
$tmpday = $sav;
|
||||
|
||||
// Lopp on each day of week
|
||||
|
||||
@ -112,7 +112,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -970,7 +970,7 @@ if ($id > 0)
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status==1)
|
||||
|
||||
@ -27,11 +27,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/propal.php
|
||||
* \file htdocs/comm/propal/card.php
|
||||
* \ingroup propale
|
||||
* \brief Page of commercial proposals card and list
|
||||
*/
|
||||
require '../main.inc.php';
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formpropal.class.php';
|
||||
@ -2062,7 +2062,7 @@ if ($action == 'create')
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
@ -2816,10 +2816,10 @@ class Propal extends CommonObject
|
||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
if ($option == '') {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
if ($option == 'compta') { // deprecated
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
if ($option == 'expedition') {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
|
||||
@ -54,7 +54,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
if (! empty($conf->propal->enabled))
|
||||
{
|
||||
$var=false;
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/card.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>';
|
||||
@ -142,7 +142,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
|
||||
print '</td><td align="right">';
|
||||
print price($obj->price);
|
||||
print "</td></tr>";
|
||||
|
||||
@ -1380,7 +1380,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
|
||||
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
$soc = $objectsrc->thirdparty;
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
|
||||
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
|
||||
@ -2587,12 +2587,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
// print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
// print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
// Documents
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
@ -2611,14 +2607,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
// print '</td><td valign="top" width="50%">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'order', $socid);
|
||||
|
||||
// print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -1010,6 +1010,7 @@ class Commande extends CommonOrder
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->date = dol_now();
|
||||
$this->date_commande = dol_now();
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
@ -1281,6 +1282,7 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -1423,9 +1425,10 @@ class Commande extends CommonOrder
|
||||
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr);
|
||||
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level)
|
||||
$price = $prod->multiprices[$this->thirdparty->price_level];
|
||||
@ -2549,6 +2552,7 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -3002,7 +3006,7 @@ class Commande extends CommonOrder
|
||||
function LibStatut($statut,$billed,$mode,$donotshowbilled=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
|
||||
$billedtext = '';
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ else
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
||||
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||
$sql.= " b.fk_bordereau,";
|
||||
$sql.= " bc.number,";
|
||||
$sql.= " bc.ref,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
||||
@ -376,7 +376,7 @@ else
|
||||
$link='';
|
||||
if ($objp->fk_bordereau>0) {
|
||||
$remisestatic->id = $objp->fk_bordereau;
|
||||
$remisestatic->ref = $objp->number;
|
||||
$remisestatic->ref = $objp->ref;
|
||||
$link = ' '.$remisestatic->getNomUrl(1);
|
||||
}
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').$link.'</td>';
|
||||
|
||||
@ -200,7 +200,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right" class="liste_total">'.price($total)."</td>";
|
||||
print '<td align="right" class="liste_total"></td>'; // A total here has no sense
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
@ -278,7 +278,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
@ -463,7 +463,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'."</td>";
|
||||
print '<td align="right"></td>'; // A total here has no sense
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
|
||||
@ -1127,8 +1127,8 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// View third's localtaxes for now
|
||||
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client);
|
||||
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client);
|
||||
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->thirdparty);
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
|
||||
|
||||
@ -3108,13 +3108,13 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE)
|
||||
$sign = - 1;
|
||||
|
||||
$nbrows = 9;
|
||||
$nbcols = 2;
|
||||
$nbrows = 8;
|
||||
$nbcols = 3;
|
||||
if (! empty($conf->projet->enabled))
|
||||
$nbrows ++;
|
||||
if (! empty($conf->banque->enabled))
|
||||
$nbcols ++;
|
||||
// if (! empty($soc->outstandingbill)) $nbrows++;
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
$nbrows ++; $nbcols++;
|
||||
}
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
||||
$nbrows ++;
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0)
|
||||
|
||||
@ -2564,7 +2564,7 @@ class Facture extends CommonInvoice
|
||||
$this->line->date_start = $date_start;
|
||||
$this->line->date_end = $date_end;
|
||||
$this->line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva = $total_tva;
|
||||
$this->line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
|
||||
$this->line->total_localtax1 = $total_localtax1;
|
||||
$this->line->total_localtax2 = $total_localtax2;
|
||||
$this->line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 Rosana Romero <rromero@2byte.es>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -116,16 +116,11 @@ $product_static=new Product($db);
|
||||
$payment_static=new Paiement($db);
|
||||
$paymentfourn_static=new PaiementFourn($db);
|
||||
|
||||
//print load_fiche_titre($langs->trans("VAT"),"");
|
||||
|
||||
//$fsearch.='<br>';
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
||||
|
||||
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
|
||||
// Affiche en-tete du rapport
|
||||
|
||||
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
|
||||
{
|
||||
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode");
|
||||
@ -138,14 +133,11 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
@ -170,14 +162,10 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
@ -203,8 +191,6 @@ if($local==1){
|
||||
|
||||
// VAT Received and paid
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
$total = 0;
|
||||
$i=0;
|
||||
@ -229,10 +215,10 @@ if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
else
|
||||
{
|
||||
$x_both = array();
|
||||
|
||||
//now, from these two arrays, get another array with one rate per line
|
||||
foreach(array_keys($x_coll) as $my_coll_rate)
|
||||
{
|
||||
//foreach($x_coll[$my_coll_rate][localtax1_list]){
|
||||
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
|
||||
$x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local];
|
||||
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
|
||||
@ -302,9 +288,6 @@ else
|
||||
}
|
||||
//now we have an array (x_both) indexed by rates for coll and paye
|
||||
|
||||
|
||||
//print table headers for this quadri - incomes first
|
||||
|
||||
$x_coll_sum = 0;
|
||||
$x_coll_ht = 0;
|
||||
$x_paye_sum = 0;
|
||||
@ -313,8 +296,6 @@ else
|
||||
$span=3;
|
||||
if ($modetax == 0) $span+=2;
|
||||
|
||||
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
|
||||
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 2){
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
@ -344,8 +325,6 @@ else
|
||||
|
||||
if($rate!=0){
|
||||
print "<tr>";
|
||||
//print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
/**/
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
@ -399,9 +378,7 @@ else
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc']))
|
||||
{
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -412,7 +389,6 @@ else
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap" align="right">';
|
||||
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
@ -423,7 +399,7 @@ else
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else {
|
||||
print $fields['payment_amount'];
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
@ -490,7 +466,6 @@ else
|
||||
if($conf->global->$calc ==0 || $conf->global->$calc == 1){
|
||||
echo '<table class="noborder" width="100%">';
|
||||
//print table headers for this quadri - expenses now
|
||||
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
@ -584,7 +559,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print $fields['payment_amount'];
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -298,7 +298,7 @@ if ($id > 0)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$urladd = "&id=".$prev_id;
|
||||
$urladd = "&id=".$id;
|
||||
|
||||
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
|
||||
print"\n<!-- debut table -->\n";
|
||||
|
||||
@ -39,6 +39,7 @@ $socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||
|
||||
$object = new ChargeSociales($db);
|
||||
|
||||
|
||||
|
||||
@ -49,19 +50,32 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||
/* *************************************************************************** */
|
||||
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes')
|
||||
{
|
||||
$chargesociales = new ChargeSociales($db);
|
||||
$chargesociales->fetch($id);
|
||||
$result = $chargesociales->set_paid($user);
|
||||
$object->fetch($id);
|
||||
$result = $object->set_paid($user);
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
||||
$result = $object->fetch($id);
|
||||
if ($object->paye)
|
||||
{
|
||||
$result = $object->set_unpaid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete social contribution
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
$chargesociales=new ChargeSociales($db);
|
||||
$chargesociales->fetch($id);
|
||||
$result=$chargesociales->delete($user);
|
||||
$object->fetch($id);
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
@ -69,7 +83,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($chargesociales->error, $chargesociales->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,8 +91,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
// Add social contribution
|
||||
if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||
{
|
||||
$dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
|
||||
$dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
|
||||
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
|
||||
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
|
||||
$amount=price2num(GETPOST('amount'));
|
||||
$actioncode=GETPOST('actioncode');
|
||||
if (! $dateech)
|
||||
@ -108,18 +122,16 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
$chargesociales=new ChargeSociales($db);
|
||||
$object->type=$actioncode;
|
||||
$object->lib=GETPOST('label');
|
||||
$object->date_ech=$dateech;
|
||||
$object->periode=$dateperiod;
|
||||
$object->amount=$amount;
|
||||
|
||||
$chargesociales->type=$actioncode;
|
||||
$chargesociales->lib=GETPOST('label');
|
||||
$chargesociales->date_ech=$dateech;
|
||||
$chargesociales->periode=$dateperiod;
|
||||
$chargesociales->amount=$amount;
|
||||
|
||||
$id=$chargesociales->create($user);
|
||||
$id=$object->create($user);
|
||||
if ($id <= 0)
|
||||
{
|
||||
setEventMessages($chargesociales->error, $chargesociales->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
@ -153,18 +165,17 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
|
||||
}
|
||||
else
|
||||
{
|
||||
$chargesociales=new ChargeSociales($db);
|
||||
$result=$chargesociales->fetch($id);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$chargesociales->lib=GETPOST('label');
|
||||
$chargesociales->date_ech=$dateech;
|
||||
$chargesociales->periode=$dateperiod;
|
||||
$chargesociales->amount=price2num($amount);
|
||||
$object->lib=GETPOST('label');
|
||||
$object->date_ech=$dateech;
|
||||
$object->periode=$dateperiod;
|
||||
$object->amount=price2num($amount);
|
||||
|
||||
$result=$chargesociales->update($user);
|
||||
$result=$object->update($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($chargesociales->error, $chargesociales->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -178,7 +189,6 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
||||
|
||||
$originalId = $id;
|
||||
|
||||
$object = new ChargeSociales($db);
|
||||
$object->fetch($id);
|
||||
|
||||
if ($object->id > 0)
|
||||
@ -499,6 +509,12 @@ if ($id > 0)
|
||||
{
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
// Reopen
|
||||
if ($object->paye && $user->rights->tax->charges->creer)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/charges.php",1). "?id=$object->id&action=reopen\">".$langs->trans("ReOpen")."</a>";
|
||||
}
|
||||
|
||||
// Edit
|
||||
if ($object->paye == 0 && $user->rights->tax->charges->creer)
|
||||
{
|
||||
|
||||
@ -339,7 +339,22 @@ class ChargeSociales extends CommonObject
|
||||
if ($return) return 1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove tag payed on social contribution
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_unpaid($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
|
||||
$sql.= " paye = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
if ($return) return 1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'une charge (impaye, payee)
|
||||
*
|
||||
|
||||
@ -593,8 +593,15 @@ class Contact extends CommonObject
|
||||
$this->canvas = $obj->canvas;
|
||||
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
// Define gender according to civility
|
||||
if(in_array($this->civility_id, array('MR'))) {
|
||||
$this->gender = 'man';
|
||||
} else if(in_array($this->civility_id, array('MME','MLE'))) {
|
||||
$this->gender = 'woman';
|
||||
}
|
||||
|
||||
// Recherche le user Dolibarr lie a ce contact
|
||||
// Search Dolibarr user linked to this contact
|
||||
$sql = "SELECT u.rowid ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.fk_socpeople = ". $this->id;
|
||||
|
||||
@ -483,7 +483,7 @@ if ($result)
|
||||
print '<input class="flat" type="text" name="search_lastname" size="6" value="'.dol_escape_htmltag($search_lastname).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.lastname']['checked']))
|
||||
if (! empty($arrayfields['p.firstname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
|
||||
@ -64,7 +64,7 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->client->default_lang)) $newlang=$object->client->default_lang; // for proposal, order, invoice, ...
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ...
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty
|
||||
if (! empty($newlang))
|
||||
{
|
||||
|
||||
@ -236,8 +236,6 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
// Show box title
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']))
|
||||
{
|
||||
//$out.= '<div id="boxto_'.$this->box_id.'_title">'."\n";
|
||||
//$out.= '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
$out.= '<tr class="box_titre">';
|
||||
$out.= '<td';
|
||||
if ($nbcol > 0) { $out.= ' colspan="'.$nbcol.'"'; }
|
||||
@ -268,14 +266,11 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
}
|
||||
$out.= '</td>';
|
||||
$out.= "</tr>\n";
|
||||
//$out.= "</table>\n";
|
||||
//$out.= "</div>\n";
|
||||
}
|
||||
|
||||
// Show box lines
|
||||
if ($nblines)
|
||||
{
|
||||
//$out.= '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
// Loop on each record
|
||||
for ($i=0, $n=$nblines; $i < $n; $i++)
|
||||
{
|
||||
|
||||
@ -352,6 +352,86 @@ class CMailFile
|
||||
$this->phpmailer->setErrorsTo($errors_to);
|
||||
$this->phpmailer->setDeliveryReceipt($deliveryreceipt);
|
||||
}
|
||||
else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
|
||||
{
|
||||
// Use Swift Mailer library
|
||||
// ------------------------------------------
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||
// Create the message
|
||||
$this->message = Swift_Message::newInstance();
|
||||
|
||||
// Adding a trackid header to a message
|
||||
$headers = $this->message->getHeaders();
|
||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid);
|
||||
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $conf->global->MAIN_MAIL_SMTP_SERVER;
|
||||
$msgid = $headers->get('Message-ID');
|
||||
$msgid->setId($headerID);
|
||||
$headers->addIdHeader('References', $headerID);
|
||||
|
||||
// Give the message a subject
|
||||
$this->message->setSubject($this->encodetorfc2822($subject));
|
||||
|
||||
// Set the From address with an associative array
|
||||
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
|
||||
if (! empty($from)) $this->message->setFrom($this->getArrayAddress($from));
|
||||
|
||||
// Set the To addresses with an associative array
|
||||
if (! empty($to)) $this->message->setTo($this->getArrayAddress($to));
|
||||
|
||||
if (! empty($from)) $this->message->SetReplyTo($this->getArrayAddress($from));
|
||||
|
||||
$this->message->setCharSet($conf->file->character_set_client);
|
||||
|
||||
if (! empty($this->html))
|
||||
{
|
||||
if (!empty($css))
|
||||
{
|
||||
$this->css = $css;
|
||||
$this->buildCSS();
|
||||
}
|
||||
$msg = $this->html;
|
||||
$msg = $this->checkIfHTML($msg);
|
||||
}
|
||||
|
||||
if ($this->atleastoneimage)
|
||||
{
|
||||
foreach ($this->images_encoded as $img)
|
||||
{
|
||||
//$img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid']
|
||||
$attachment = Swift_Image::fromPath($img['fullpath'], $img['content_type']);
|
||||
// embed image
|
||||
$imgcid = $this->message->embed($attachment);
|
||||
// replace cid by the one created by swiftmail in html message
|
||||
$msg = str_replace("cid:".$img['cid'], $imgcid, $msg);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->msgishtml) {
|
||||
$this->message->setBody($msg,'text/html');
|
||||
// And optionally an alternative body
|
||||
//$this->message->addPart('Here is the message itself', 'text/plain');
|
||||
} else {
|
||||
$this->message->setBody($msg,'text/plain');
|
||||
// And optionally an alternative body
|
||||
//$this->message->addPart('<q>Here is the message itself</q>', 'text/html');
|
||||
}
|
||||
|
||||
if ($this->atleastonefile)
|
||||
{
|
||||
foreach ($filename_list as $i => $val)
|
||||
{
|
||||
//$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]));
|
||||
$attachment = Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]);
|
||||
$this->message->attach($attachment);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc));
|
||||
if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc));
|
||||
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
|
||||
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Send mail method not correctly defined
|
||||
@ -392,7 +472,7 @@ class CMailFile
|
||||
|
||||
return $reshook;
|
||||
}
|
||||
|
||||
|
||||
// Action according to choosed sending method
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
@ -427,7 +507,7 @@ class CMailFile
|
||||
if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F))
|
||||
{
|
||||
// le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA
|
||||
// Le forcage de la valeure grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
|
||||
// Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
|
||||
// La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse)
|
||||
$bounce .= ($bounce?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') );
|
||||
}
|
||||
@ -527,6 +607,56 @@ class CMailFile
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
|
||||
{
|
||||
|
||||
// Use Swift Mailer library
|
||||
// ------------------------------------------
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||
|
||||
// Forcage parametres
|
||||
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
|
||||
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
|
||||
|
||||
// If we use SSL/TLS
|
||||
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
|
||||
$secure='';
|
||||
//var_dump(stream_get_transports());
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl';
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls';
|
||||
|
||||
$this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->MAIN_MAIL_SMTP_PORT, $secure);
|
||||
|
||||
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->transport->setUsername($conf->global->MAIN_MAIL_SMTPS_ID);
|
||||
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW);
|
||||
//$smtps->_msgReplyTo = 'reply@web.com';
|
||||
|
||||
// Create the Mailer using your created Transport
|
||||
$this->mailer = Swift_Mailer::newInstance($this->transport);
|
||||
|
||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
// To use the ArrayLogger
|
||||
$this->logger = new Swift_Plugins_Loggers_ArrayLogger();
|
||||
// Or to use the Echo Logger
|
||||
//$this->logger = new Swift_Plugins_Loggers_EchoLogger();
|
||||
$this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger));
|
||||
}
|
||||
// send mail
|
||||
try {
|
||||
$result = $this->mailer->send($this->message);
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
}
|
||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
||||
|
||||
$res = true;
|
||||
if (! empty($this->error) && ! $result) {
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
$res=false;
|
||||
} else {
|
||||
$this->error = sprintf ("Sent %d messages\n", $result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -611,6 +741,10 @@ class CMailFile
|
||||
{
|
||||
fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on
|
||||
}
|
||||
elseif ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
|
||||
{
|
||||
fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@ -915,11 +1049,17 @@ class CMailFile
|
||||
*/
|
||||
function check_server_port($host,$port)
|
||||
{
|
||||
global $conf;
|
||||
$_retVal=0;
|
||||
$timeout=5; // Timeout in seconds
|
||||
|
||||
if (function_exists('fsockopen'))
|
||||
{
|
||||
// If we use SSL/TLS
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $host='ssl://'.$host;
|
||||
// tls smtp start with no encryption
|
||||
//if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host;
|
||||
|
||||
dol_syslog("Try socket connection to host=".$host." port=".$port);
|
||||
//See if we can connect to the SMTP server
|
||||
if ($socket = @fsockopen(
|
||||
@ -1047,6 +1187,7 @@ class CMailFile
|
||||
$imgName = $regs[1];
|
||||
|
||||
$this->images_encoded[$i]['name'] = $imgName;
|
||||
$this->images_encoded[$i]['fullpath'] = $fullpath;
|
||||
$this->images_encoded[$i]['content_type'] = $img["content_type"];
|
||||
$this->images_encoded[$i]['cid'] = $img["cid"];
|
||||
// Encodage de l'image
|
||||
@ -1127,5 +1268,39 @@ class CMailFile
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a formatted array of address string for SMTP protocol
|
||||
*
|
||||
* @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
|
||||
* @return array array of email => name
|
||||
*/
|
||||
function getArrayAddress($address)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$ret=array();
|
||||
|
||||
$arrayaddress=explode(',',$address);
|
||||
|
||||
// Boucle sur chaque composant de l'adresse
|
||||
foreach($arrayaddress as $val)
|
||||
{
|
||||
if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs))
|
||||
{
|
||||
$name = trim($regs[1]);
|
||||
$email = trim($regs[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = null;
|
||||
$email = trim($val);
|
||||
}
|
||||
|
||||
$ret[$email]=empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)?$name:null;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4230,12 +4230,14 @@ abstract class CommonObject
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an exta field value for the current object.
|
||||
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* This function delte record with all extrafields and insert them again from the array $this->array_options.
|
||||
* $key key of the extrafield
|
||||
* @return int -1=error, O=did nothing, 1=OK
|
||||
*
|
||||
* @param string $key Key of the extrafield
|
||||
* @return int -1=error, O=did nothing, 1=OK
|
||||
*/
|
||||
function updateExtraField($key)
|
||||
{
|
||||
@ -4295,7 +4297,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET $key=".$this->array_options["options_$key"];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET $key='".$this->db->escape($this->array_options["options_$key"])."'";
|
||||
$sql .= " WHERE fk_object = ".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
|
||||
@ -600,7 +600,7 @@ class DolGraph
|
||||
|
||||
|
||||
/**
|
||||
* Build a graph onto disk using Artichow library
|
||||
* Build a graph onto disk using Artichow library and return img string to it
|
||||
*
|
||||
* @param string $file Image file name to use if we save onto disk
|
||||
* @param string $fileurl Url path to show image if saved onto disk
|
||||
@ -779,7 +779,7 @@ class DolGraph
|
||||
|
||||
|
||||
/**
|
||||
* Build a graph onto disk using JFlot library. Input when calling this method should be:
|
||||
* Build a graph using JFlot library. Input when calling this method should be:
|
||||
* $this->data = array(array( 0=>'labelxA', 1=>yA), array('labelxB',yB)); or
|
||||
* $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // TODO Syntax not supported. Removed when dol_print_graph_removed
|
||||
* $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // when there is n series to show for each x
|
||||
@ -788,9 +788,10 @@ class DolGraph
|
||||
* $this->mode = 'depth' ???
|
||||
* $this->bgcolorgrid
|
||||
* $this->datacolor
|
||||
* $this->shownodatagraph
|
||||
*
|
||||
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
|
||||
* @param string $fileurl Url path to show image if saved onto disk
|
||||
* @param string $fileurl Url path to show image if saved onto disk. Never used here.
|
||||
* @return void
|
||||
*/
|
||||
private function draw_jflot($file,$fileurl)
|
||||
@ -849,7 +850,14 @@ class DolGraph
|
||||
|
||||
$this->stringtoshow ='<!-- Build using '.$this->_library.' -->'."\n";
|
||||
if (! empty($this->title)) $this->stringtoshow.='<div align="center" class="dolgraphtitle'.(empty($this->cssprefix)?'':' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
|
||||
if (! empty($this->shownographyet))
|
||||
{
|
||||
$this->stringtoshow.='<div style="width:'.$this->width.'px;height:'.$this->height.'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow.='<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
return;
|
||||
}
|
||||
$this->stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($this->cssprefix)?'':' dolgraph'.$this->cssprefix).'"></div>'."\n";
|
||||
|
||||
$this->stringtoshow.='<script id="'.$tag.'">'."\n";
|
||||
$this->stringtoshow.='$(function () {'."\n";
|
||||
$i=$firstlot;
|
||||
|
||||
@ -2060,14 +2060,23 @@ class Form
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||
{
|
||||
// mode=2 means suppliers products
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
}
|
||||
// mode=2 means suppliers products
|
||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished;
|
||||
print ajax_autocompleter('', $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
print ($hidelabel?'':$langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0);
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
|
||||
}
|
||||
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4196,7 +4205,7 @@ class Form
|
||||
$code_country="'".$societe_vendeuse->country_code."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$code_country="'".$mysoc->country_code."'"; // Pour compatibilite ascendente
|
||||
}
|
||||
if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on
|
||||
@ -4234,8 +4243,9 @@ class Form
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
$tmpthirdparty=new Societe($this->db);
|
||||
$defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
|
||||
$defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
|
||||
if (empty($defaulttx)) $defaultnpr=0;
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ class FormAccounting
|
||||
$sql = "SELECT c.rowid, c.label as type, c.range_account";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql.= " WHERE c.active = 1";
|
||||
$sql.= " AND c.account_type = 0";
|
||||
$sql.= " AND c.category_type = 0";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
||||
$sql.= " ORDER BY c.label ASC";
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ class FormFile
|
||||
$arraykeys=array_keys($modellist);
|
||||
$modelselected=$arraykeys[0];
|
||||
}
|
||||
$out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', '');
|
||||
$out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100');
|
||||
$out.= ajax_combobox('model');
|
||||
}
|
||||
else
|
||||
|
||||
@ -311,7 +311,7 @@ class Notify
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref);
|
||||
break;
|
||||
case 'PROPAL_VALIDATE':
|
||||
$link='/comm/propal.php?id='.$object->id;
|
||||
$link='/comm/propal/card.php?id='.$object->id;
|
||||
$dir_output = $conf->propal->dir_output;
|
||||
$object_type = 'propal';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
|
||||
@ -470,7 +470,7 @@ class Notify
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref);
|
||||
break;
|
||||
case 'PROPAL_VALIDATE':
|
||||
$link='/comm/propal.php?id='.$object->id;
|
||||
$link='/comm/propal/card.php?id='.$object->id;
|
||||
$dir_output = $conf->propal->dir_output;
|
||||
$object_type = 'propal';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
|
||||
|
||||
@ -1607,14 +1607,17 @@ class SMTPs
|
||||
$_retVal = true;
|
||||
|
||||
$server_response = '';
|
||||
// avoid infinite loop
|
||||
$limit=0;
|
||||
|
||||
while ( substr($server_response,3,1) != ' ' )
|
||||
while ( substr($server_response,3,1) != ' ' && $limit<100)
|
||||
{
|
||||
if( !( $server_response = fgets($socket, 256) ) )
|
||||
{
|
||||
$this->_setErr(121, "Couldn't get mail server response codes");
|
||||
$_retVal = false;
|
||||
}
|
||||
$limit++;
|
||||
}
|
||||
|
||||
if( !( substr($server_response, 0, 3) == $response ) )
|
||||
|
||||
@ -65,7 +65,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
if (! empty($conf->browser->phone)) print '<div class="fichehalfleft">';
|
||||
else print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap borderright">';
|
||||
else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
|
||||
|
||||
print '<table class="nobordernopadding">';
|
||||
|
||||
@ -74,9 +74,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<tr>';
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("ActionsToDoBy").' ';
|
||||
print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print '</td><td class="maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("Group").' ';
|
||||
if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' ';
|
||||
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -95,14 +95,6 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
}
|
||||
print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), 0, $multiselect);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr>';
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("Status");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
@ -128,6 +120,17 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($canedit)
|
||||
{
|
||||
// Status
|
||||
print '<tr>';
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("Status");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($canedit && $action == 'show_peruser')
|
||||
{
|
||||
// Filter on hours
|
||||
|
||||
@ -1874,17 +1874,25 @@ function dol_substr($string,$start,$length,$stringencoding='')
|
||||
* @param int $showpercent Show percent (with type='pie' only)
|
||||
* @param string $url Param to add an url to click values
|
||||
* @param int $combineother 0=No combine, 0.05=Combine if lower than 5%
|
||||
* @param int $shownographyet Show graph to say there is not enough data
|
||||
* @return void
|
||||
* @deprecated
|
||||
* @see DolGraph
|
||||
*/
|
||||
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='',$combineother=0.05)
|
||||
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='',$combineother=0.05,$shownographyet=0)
|
||||
{
|
||||
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
|
||||
|
||||
global $conf,$langs;
|
||||
global $theme_datacolor; // To have var kept when function is called several times
|
||||
|
||||
if ($shownographyet)
|
||||
{
|
||||
print '<div class="nographyet" style="width:'.$width.'px;height:'.$height.'px;"></div>';
|
||||
print '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) return;
|
||||
$jsgraphlib='flot';
|
||||
$datacolor=array();
|
||||
@ -2031,7 +2039,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else print 'BadValueForPArameterType';
|
||||
else print 'BadValueForParameterType';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4277,6 +4285,29 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return first line of text. Cut will depends if content is HTML or not.
|
||||
*
|
||||
* @param string $text Input text
|
||||
* @return string Output text
|
||||
* @see dol_nboflines_bis
|
||||
*/
|
||||
function dolGetFirstLineOfText($text)
|
||||
{
|
||||
if (dol_textishtml($text))
|
||||
{
|
||||
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
||||
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$firstline=preg_replace('/[\n\r].*/','',$text);
|
||||
}
|
||||
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replace CRLF in string with a HTML BR tag
|
||||
*
|
||||
@ -4284,6 +4315,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
* @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br
|
||||
* @param bool $forxml false=Use <br>, true=Use <br />
|
||||
* @return string String encoded
|
||||
* @see dol_nboflines, dolGetFirstLineOfText
|
||||
*/
|
||||
function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
|
||||
{
|
||||
@ -4421,7 +4453,7 @@ function dol_string_is_good_iso($s)
|
||||
* @param string $s String to check
|
||||
* @param int $maxchar Not yet used
|
||||
* @return int Number of lines
|
||||
* @see dol_nboflines_bis
|
||||
* @see dol_nboflines_bis, dolGetFirstLineOfText
|
||||
*/
|
||||
function dol_nboflines($s,$maxchar=0)
|
||||
{
|
||||
|
||||
@ -30,26 +30,6 @@
|
||||
// Enable this line to trace path when function is called.
|
||||
//print xdebug_print_function_stack('Functions2.lib was called');exit;
|
||||
|
||||
/**
|
||||
* Return first line of text. Cut will depends if content is HTML or not.
|
||||
*
|
||||
* @param string $text Input text
|
||||
* @return string Output text
|
||||
* @see dol_nboflines_bis
|
||||
*/
|
||||
function dolGetFirstLineOfText($text)
|
||||
{
|
||||
if (dol_textishtml($text))
|
||||
{
|
||||
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
||||
}
|
||||
else
|
||||
{
|
||||
$firstline=preg_replace('/[\n\r].*/','',$text);
|
||||
}
|
||||
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
||||
}
|
||||
|
||||
/**
|
||||
* Same function than javascript unescape() function but in PHP.
|
||||
*
|
||||
|
||||
@ -358,7 +358,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
||||
} elseif ($thirdparty instanceof Contact) {
|
||||
$socname = $thirdparty->socname;
|
||||
} else {
|
||||
throw new InvalidArgumentException();
|
||||
throw new InvalidArgumentException('Parameter 1=$thirdparty is not a Societe nor Contact');
|
||||
}
|
||||
|
||||
return $outputlangs->convToOutputCharset($socname);
|
||||
|
||||
@ -38,7 +38,7 @@ function propal_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ProposalCard');
|
||||
$head[$h][2] = 'comm';
|
||||
$h++;
|
||||
|
||||
@ -233,7 +233,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if (empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
@ -180,7 +180,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets VAT to collect for the given year (and given quarter or month)
|
||||
* The function gets the VAT in split results, as the VAT declaration asks
|
||||
|
||||
@ -479,7 +479,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
print ' ('.$langs->trans("Default").': <strong>7882aa</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
print ' ('.$langs->trans("Default").': <strong>515870</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -535,6 +535,50 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Text LinkColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
/*$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
|
||||
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
|
||||
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
|
||||
print '> '.$langs->trans("UsePersonalValue").'</td>';
|
||||
print '<td>';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print '';
|
||||
}
|
||||
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
print '</td>';*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("LinkColor").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
print ' ('.$langs->trans("Default").': <strong>000078</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Use Hover
|
||||
$var=!$var;
|
||||
if ($foruserprofile)
|
||||
@ -579,50 +623,6 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// TopMenuBackgroundColor
|
||||
if ($foruserprofile)
|
||||
{
|
||||
/*$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
|
||||
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
|
||||
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
|
||||
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
|
||||
print '> '.$langs->trans("UsePersonalValue").'</td>';
|
||||
print '<td>';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print '';
|
||||
}
|
||||
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
print '</td>';*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("LinkColor").'</td>';
|
||||
print '<td colspan="'.($colspan-1).'">';
|
||||
if ($edit)
|
||||
{
|
||||
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),''),'THEME_ELDY_TEXTLINK','formcolor',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
|
||||
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
print ' ('.$langs->trans("Default").': <strong>000078</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
|
||||
-- Commercial - Proposals
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1100__+MAX_llx_menu__, 'commercial', 'propals', 5__+MAX_llx_menu__, '/comm/propal/index.php?leftmenu=propals', 'Prop', 0, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal.php?action=create&leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/card.php?action=create&leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1102__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/list.php?leftmenu=propals', 'List', 1, 'propal', '$user->rights->propale->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?leftmenu=propals&viewstatut=0', 'PropalsDraft', 1, 'propal', '$user->rights->propale->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?leftmenu=propals&viewstatut=1', 'PropalsOpened', 1, 'propal', '$user->rights->propale->lire', '', 2, 3, __ENTITY__);
|
||||
|
||||
@ -692,7 +692,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
$langs->load("propal");
|
||||
$newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Prop"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100);
|
||||
$newmenu->add("/comm/propal.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
|
||||
$newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer);
|
||||
$newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="propals") $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire);
|
||||
@ -1324,6 +1324,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
// We update newmenu for special dynamic menus
|
||||
if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$sql = "SELECT rowid, label, courant, rappro";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
|
||||
@ -1261,7 +1261,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -1306,12 +1306,12 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target', $object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -542,20 +542,20 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 3);
|
||||
$pdf->SetXY($blSocX,$blSocY+4);
|
||||
$pdf->MultiCell(80, 2, $carac_emetteur, 0, 'L');
|
||||
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$Yoff+=3;
|
||||
$posy=$Yoff;
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
// Date Expedition
|
||||
@ -628,12 +628,12 @@ class pdf_merou extends ModelePdfExpedition
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
|
||||
$blDestX=$blExpX+55;
|
||||
$blW=54;
|
||||
|
||||
@ -827,12 +827,12 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
|
||||
}
|
||||
|
||||
if (! empty($object->client->code_client))
|
||||
if (! empty($object->thirdparty->code_client))
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
|
||||
@ -881,7 +881,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
@ -927,12 +927,12 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -1554,7 +1554,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
@ -1602,12 +1602,12 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -552,12 +552,12 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R');
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($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->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
if ($showaddress)
|
||||
@ -572,7 +572,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -615,12 +615,12 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
$carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -742,12 +742,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
}
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
@ -849,12 +849,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -225,14 +225,22 @@ class mailing_contacts3 extends MailingTargets
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
if ($num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
||||
$i++;
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$s.='<option value="-1" disabled="disabled">'.$langs->trans("NoContactLinkedToThirdpartieWithCategoryFound").'</option>';
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
$s.='</select>';
|
||||
|
||||
return $s;
|
||||
|
||||
@ -222,16 +222,21 @@ class mailing_contacts4 extends MailingTargets
|
||||
$s='';
|
||||
$s.='<select name="filter" class="flat">';
|
||||
$s.='<option value="all"></option>';
|
||||
if ($resql)
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
||||
$i++;
|
||||
}
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$s.='<option value="-1" disabled="disabled">'.$langs->trans("NoContactWithCategoryFound").'</option>';
|
||||
}
|
||||
$s.='</select>';
|
||||
return $s;
|
||||
|
||||
@ -26,8 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
||||
|
||||
|
||||
/**
|
||||
* \class mailing_pomme
|
||||
* \brief Class to offer a selector of emailing targets with Rule 'Peche'.
|
||||
* Class to offer a selector of emailing targets with Rule 'Peche'.
|
||||
*/
|
||||
class mailing_pomme extends MailingTargets
|
||||
{
|
||||
@ -112,11 +111,21 @@ class mailing_pomme extends MailingTargets
|
||||
$langs->load("users");
|
||||
|
||||
$s='';
|
||||
$s.=$langs->trans("Status").': ';
|
||||
$s.='<select name="filter" class="flat">';
|
||||
$s.='<option value="-1"></option>';
|
||||
$s.='<option value="-1"> </option>';
|
||||
$s.='<option value="1">'.$langs->trans("Enabled").'</option>';
|
||||
$s.='<option value="0">'.$langs->trans("Disabled").'</option>';
|
||||
$s.='</select>';
|
||||
|
||||
$s.=' ';
|
||||
$s.=$langs->trans("Employee").': ';
|
||||
$s.='<select name="filteremployee" class="flat">';
|
||||
$s.='<option value="-1"> </option>';
|
||||
$s.='<option value="1">'.$langs->trans("Yes").'</option>';
|
||||
$s.='<option value="0">'.$langs->trans("No").'</option>';
|
||||
$s.='</select>';
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
@ -142,7 +151,12 @@ class mailing_pomme extends MailingTargets
|
||||
*/
|
||||
function add_to_target($mailing_id,$filtersarray=array())
|
||||
{
|
||||
global $conf, $langs;
|
||||
// Deprecation warning
|
||||
if ($filtersarray) {
|
||||
dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING);
|
||||
}
|
||||
|
||||
global $conf, $langs;
|
||||
$langs->load("companies");
|
||||
|
||||
$cibles = array();
|
||||
@ -154,11 +168,10 @@ class mailing_pomme extends MailingTargets
|
||||
$sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test
|
||||
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||
foreach($filtersarray as $key)
|
||||
{
|
||||
if ($key == '1') $sql.= " AND u.statut=1";
|
||||
if ($key == '0') $sql.= " AND u.statut=0";
|
||||
}
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1') $sql.= " AND u.statut=1";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND u.statut=0";
|
||||
if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '1') $sql.= " AND u.employee=1";
|
||||
if (isset($_POST["filteremployee"]) && $_POST["filteremployee"] == '0') $sql.= " AND u.employee=0";
|
||||
$sql.= " ORDER BY u.email";
|
||||
|
||||
// Stocke destinataires dans cibles
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/modAccounting.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Module to activate Accounting Expert module
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
@ -157,16 +157,19 @@ class modAccounting extends DolibarrModules
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
/*
|
||||
$this->const[15] = array (
|
||||
"ACCOUNTING_GROUPBYACCOUNT",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
*/
|
||||
$this->const[16] = array (
|
||||
"ACCOUNTING_EXPORT_DATE",
|
||||
"chaine",
|
||||
"%d%m%Y"
|
||||
);
|
||||
/*
|
||||
$this->const[17] = array (
|
||||
"ACCOUNTING_EXPORT_PIECE",
|
||||
"yesno",
|
||||
@ -192,6 +195,7 @@ class modAccounting extends DolibarrModules
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
*/
|
||||
$this->const[22] = array(
|
||||
"ACCOUNTING_EXPENSEREPORT_JOURNAL",
|
||||
"chaine",
|
||||
|
||||
@ -63,53 +63,53 @@ class printing_printgcp extends PrintingDriver
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$this->db = $db;
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken('Google');
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
$token_ok=true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken('Google');
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken('Google', $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if (!$conf->oauth->enabled) {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'ModuleAuthNotActive', 'type'=>'info');
|
||||
} else {
|
||||
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken('Google');
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken('Google')?'HasAccessToken':'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, array());
|
||||
$token_ok=true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken('Google');
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken('Google', $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if ($this->google_id != '' && $this->google_secret != '') {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken('Google')?$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):''));
|
||||
|
||||
@ -321,14 +321,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->client;
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
|
||||
@ -1442,12 +1442,12 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : " . dol_print_date($object->fin_validite,"day",false,$outputlangs,true), '', 'R');
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($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->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
$posy+=2;
|
||||
@ -1467,7 +1467,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -1511,12 +1511,12 @@ class pdf_azur extends ModelePDFPropales
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -1271,12 +1271,12 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R');
|
||||
*/
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($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->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
$posy+=2;
|
||||
@ -1296,7 +1296,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -1340,15 +1340,15 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
|
||||
else $socname = $object->client->name;
|
||||
else $socname = $object->thirdparty->name;
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($socname);
|
||||
}
|
||||
else
|
||||
{
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name);
|
||||
}
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -54,7 +54,9 @@ $userstatic=new User($db);
|
||||
<!-- BEGIN PHP TEMPLATE CONTACTS -->
|
||||
<div class="tagtable centpercent noborder allwidth">
|
||||
|
||||
<?php if ($permission) { ?>
|
||||
<?php
|
||||
if ($permission) {
|
||||
?>
|
||||
<form class="tagtr liste_titre">
|
||||
<div class="tagtd"><?php echo $langs->trans("Nature"); ?></div>
|
||||
<div class="tagtd"><?php echo $langs->trans("ThirdParty"); ?></div>
|
||||
@ -132,10 +134,12 @@ $userstatic=new User($db);
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php }
|
||||
} ?>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form class="tagtr liste_titre">
|
||||
<form class="tagtr liste_titre formnoborder">
|
||||
<div class="tagtd"><?php echo $langs->trans("Nature"); ?></div>
|
||||
<div class="tagtd"><?php echo $langs->trans("ThirdParty"); ?></div>
|
||||
<div class="tagtd"><?php echo $langs->trans("Users").'/'.$langs->trans("Contacts"); ?></div>
|
||||
|
||||
@ -183,7 +183,7 @@ else {
|
||||
else
|
||||
{
|
||||
$ajaxoptions=array(
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount'), // html id tags that will be edited with which ajax json response key
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error'
|
||||
);
|
||||
|
||||
@ -882,8 +882,7 @@ if (empty($reshook))
|
||||
$parameters=array('id'=>$object->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
$result=$object->insertExtraFields();
|
||||
{ $result=$object->updateExtraField($_POST["attribute"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -1716,7 +1715,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$langs->load("propal");
|
||||
if ($object->statut < 2)
|
||||
{
|
||||
if ($user->rights->propal->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
|
||||
if ($user->rights->propal->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,10 +227,11 @@ if ($result)
|
||||
$companystatic->client=$objp->client;
|
||||
print $companystatic->getNomUrl(1,'',44);
|
||||
print '</td>';
|
||||
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).'</td>';
|
||||
print '<td>'.dol_trunc(dolGetFirstLineOfText($objp->description),48).'</td>';
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||
{
|
||||
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).'</td>';
|
||||
//print '<td>'.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($objp->descriptiondetail)),48).'</td>';
|
||||
print '<td>'.dolGetFirstLineOfText($objp->descriptiondetail).'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'dayhour')."</td>\n";
|
||||
print '<td align="right">'.convertSecondToTime($objp->duree).'</td>';
|
||||
}
|
||||
|
||||
@ -1155,9 +1155,6 @@ class CommandeFournisseur extends CommonOrder
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// Add entry into log
|
||||
$this->log($user, 0, $now);
|
||||
|
||||
// Add link with price request and supplier order
|
||||
if ($this->id)
|
||||
{
|
||||
@ -1353,7 +1350,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
if ($fk_product > 0)
|
||||
if ($fk_prod_fourn_price > 0)
|
||||
{
|
||||
$prod = new Product($this->db, $fk_product);
|
||||
if ($prod->fetch($fk_product) > 0)
|
||||
|
||||
@ -344,11 +344,14 @@ if (empty($reshook))
|
||||
// Ecrase $txtva par celui du produit
|
||||
if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
||||
{
|
||||
$idprod=0;
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
|
||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||
|
||||
if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
$idprod=0;
|
||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||
}
|
||||
|
||||
if (GETPOST('idprodfournprice') > 0)
|
||||
{
|
||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
|
||||
@ -1271,6 +1271,7 @@ if (empty($reshook))
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$bankaccountstatic=new Account($db);
|
||||
$paymentstatic=new PaiementFourn($db);
|
||||
|
||||
llxHeader('',$langs->trans('SupplierInvoice'),'');
|
||||
|
||||
@ -1871,7 +1872,7 @@ else
|
||||
/*
|
||||
* List of payments
|
||||
*/
|
||||
$nbrows=9; $nbcols=2;
|
||||
$nbrows=9; $nbcols=3;
|
||||
if (! empty($conf->projet->enabled)) $nbrows++;
|
||||
if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; }
|
||||
if (! empty($conf->incoterm->enabled)) $nbrows++;
|
||||
@ -1882,10 +1883,10 @@ else
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">';
|
||||
|
||||
$sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,';
|
||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,';
|
||||
$sql.= ' c.id as paiement_type,';
|
||||
$sql.= ' pf.amount,';
|
||||
$sql.= ' ba.rowid as baid, ba.ref, ba.label';
|
||||
$sql.= ' ba.rowid as baid, ba.ref as baref, ba.label';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn 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';
|
||||
@ -1902,6 +1903,7 @@ else
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Payments').'</td>';
|
||||
print '<td>'.$langs->trans('Date').'</td>';
|
||||
print '<td>'.$langs->trans('Type').'</td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td align="right">'.$langs->trans('BankAccount').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Amount').'</td>';
|
||||
@ -1915,16 +1917,23 @@ else
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans('ShowPayment'),'payment').' '.dol_print_date($db->jdate($objp->dp),'day')."</a></td>\n";
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$paymentstatic->id=$objp->rowid;
|
||||
$paymentstatic->datepaye=$db->jdate($objp->dp);
|
||||
$paymentstatic->ref=$objp->ref;
|
||||
$paymentstatic->num_paiement=$objp->num_paiement;
|
||||
$paymentstatic->payment_code=$objp->payment_code;
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'day') . '</td>';
|
||||
print '<td>';
|
||||
print $form->form_modes_reglement(null, $objp->paiement_type,'none').' '.$objp->num_paiement;
|
||||
print '</td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
$bankaccountstatic->id=$objp->baid;
|
||||
$bankaccountstatic->ref=$objp->ref;
|
||||
$bankaccountstatic->label=$objp->ref;
|
||||
$bankaccountstatic->ref=$objp->baref;
|
||||
$bankaccountstatic->label=$objp->baref;
|
||||
print '<td align="right">';
|
||||
if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions');
|
||||
print '</td>';
|
||||
|
||||
@ -885,7 +885,7 @@ else
|
||||
{
|
||||
print '<div class="tabBar">';
|
||||
print $error;
|
||||
print '<br /><br /><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
|
||||
print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
@ -994,10 +994,10 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
|
||||
$linkback='';
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>';
|
||||
print $form->showrefnav($cp, 'id', $linkback, 1, 'rowid', 'ref');
|
||||
print '</td>';
|
||||
|
||||
@ -1219,7 +1219,7 @@ class Holiday extends CommonObject
|
||||
// List for Dolibarr users
|
||||
if ($type)
|
||||
{
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname";
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
|
||||
@ -1250,11 +1250,15 @@ class Holiday extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$tab_result[$i]['rowid'] = $obj->rowid;
|
||||
$tab_result[$i]['name'] = $obj->lastname;
|
||||
$tab_result[$i]['name'] = $obj->lastname; // deprecated
|
||||
$tab_result[$i]['lastname'] = $obj->lastname;
|
||||
$tab_result[$i]['firstname'] = $obj->firstname;
|
||||
$tab_result[$i]['type'] = $obj->type;
|
||||
$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
|
||||
$tab_result[$i]['gender'] = $obj->gender;
|
||||
$tab_result[$i]['status'] = $obj->statut;
|
||||
$tab_result[$i]['employee'] = $obj->employee;
|
||||
$tab_result[$i]['photo'] = $obj->photo;
|
||||
//$tab_result[$i]['type'] = $obj->type;
|
||||
//$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -1264,7 +1268,7 @@ class Holiday extends CommonObject
|
||||
else
|
||||
{
|
||||
// Erreur SQL
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->errors[]="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +181,10 @@ if ($result < 0)
|
||||
}
|
||||
|
||||
$listUsers = $holiday->fetchUsers(false,true);
|
||||
if (is_numeric($listUsers) && $listUsers < 0)
|
||||
{
|
||||
setEventMessages($holiday->error, $holiday->errors, 'errors');
|
||||
}
|
||||
|
||||
$var=true;
|
||||
$i = 0;
|
||||
@ -260,9 +264,13 @@ else
|
||||
print '<tr '.$bc[$var].' style="height: 20px;">';
|
||||
print '<td>';
|
||||
$userstatic->id=$users['rowid'];
|
||||
$userstatic->lastname=$users['name'];
|
||||
$userstatic->lastname=$users['lastname'];
|
||||
$userstatic->firstname=$users['firstname'];
|
||||
print $userstatic->getNomUrl(1);
|
||||
$userstatic->gender=$users['gender'];
|
||||
$userstatic->photo=$users['photo'];
|
||||
$userstatic->statut=$users['status'];
|
||||
$userstatic->employee=$users['employee'];
|
||||
print $userstatic->getNomUrl(-1);
|
||||
print '</td>';
|
||||
|
||||
if (count($typeleaves))
|
||||
|
||||
@ -108,12 +108,12 @@ if ($object->id)
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$linkback='';
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref');
|
||||
print '</td>';
|
||||
|
||||
@ -15,7 +15,7 @@ body
|
||||
/* Remove the background color to make it transparent */
|
||||
background-color: #fff;
|
||||
|
||||
margin: 20px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.cke_editable
|
||||
|
||||
80
htdocs/includes/swiftmailer/lib/classes/Swift.php
Normal file
80
htdocs/includes/swiftmailer/lib/classes/Swift.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* General utility class in Swift Mailer, not to be instantiated.
|
||||
*
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
abstract class Swift
|
||||
{
|
||||
/** Swift Mailer Version number generated during dist release process */
|
||||
const VERSION = '@SWIFT_VERSION_NUMBER@';
|
||||
|
||||
public static $initialized = false;
|
||||
public static $inits = array();
|
||||
|
||||
/**
|
||||
* Registers an initializer callable that will be called the first time
|
||||
* a SwiftMailer class is autoloaded.
|
||||
*
|
||||
* This enables you to tweak the default configuration in a lazy way.
|
||||
*
|
||||
* @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class
|
||||
*/
|
||||
public static function init($callable)
|
||||
{
|
||||
self::$inits[] = $callable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal autoloader for spl_autoload_register().
|
||||
*
|
||||
* @param string $class
|
||||
*/
|
||||
public static function autoload($class)
|
||||
{
|
||||
// Don't interfere with other autoloaders
|
||||
if (0 !== strpos($class, 'Swift_')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';
|
||||
|
||||
if (!file_exists($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
require $path;
|
||||
|
||||
if (self::$inits && !self::$initialized) {
|
||||
self::$initialized = true;
|
||||
foreach (self::$inits as $init) {
|
||||
call_user_func($init);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure autoloading using Swift Mailer.
|
||||
*
|
||||
* This is designed to play nicely with other autoloaders.
|
||||
*
|
||||
* @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class
|
||||
*/
|
||||
public static function registerAutoload($callable = null)
|
||||
{
|
||||
if (null !== $callable) {
|
||||
self::$inits[] = $callable;
|
||||
}
|
||||
spl_autoload_register(array('Swift', 'autoload'));
|
||||
}
|
||||
}
|
||||
71
htdocs/includes/swiftmailer/lib/classes/Swift/Attachment.php
Normal file
71
htdocs/includes/swiftmailer/lib/classes/Swift/Attachment.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attachment class for attaching files to a {@link Swift_Mime_Message}.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_Attachment extends Swift_Mime_Attachment
|
||||
{
|
||||
/**
|
||||
* Create a new Attachment.
|
||||
*
|
||||
* Details may be optionally provided to the constructor.
|
||||
*
|
||||
* @param string|Swift_OutputByteStream $data
|
||||
* @param string $filename
|
||||
* @param string $contentType
|
||||
*/
|
||||
public function __construct($data = null, $filename = null, $contentType = null)
|
||||
{
|
||||
call_user_func_array(
|
||||
array($this, 'Swift_Mime_Attachment::__construct'),
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->createDependenciesFor('mime.attachment')
|
||||
);
|
||||
|
||||
$this->setBody($data);
|
||||
$this->setFilename($filename);
|
||||
if ($contentType) {
|
||||
$this->setContentType($contentType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Attachment.
|
||||
*
|
||||
* @param string|Swift_OutputByteStream $data
|
||||
* @param string $filename
|
||||
* @param string $contentType
|
||||
*
|
||||
* @return Swift_Mime_Attachment
|
||||
*/
|
||||
public static function newInstance($data = null, $filename = null, $contentType = null)
|
||||
{
|
||||
return new self($data, $filename, $contentType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Attachment from a filesystem path.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $contentType optional
|
||||
*
|
||||
* @return Swift_Mime_Attachment
|
||||
*/
|
||||
public static function fromPath($path, $contentType = null)
|
||||
{
|
||||
return self::newInstance()->setFile(
|
||||
new Swift_ByteStream_FileByteStream($path),
|
||||
$contentType
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides the base functionality for an InputStream supporting filters.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_InputByteStream, Swift_Filterable
|
||||
{
|
||||
/**
|
||||
* Write sequence.
|
||||
*/
|
||||
protected $_sequence = 0;
|
||||
|
||||
/**
|
||||
* StreamFilters.
|
||||
*
|
||||
* @var Swift_StreamFilter[]
|
||||
*/
|
||||
private $_filters = array();
|
||||
|
||||
/**
|
||||
* A buffer for writing.
|
||||
*/
|
||||
private $_writeBuffer = '';
|
||||
|
||||
/**
|
||||
* Bound streams.
|
||||
*
|
||||
* @var Swift_InputByteStream[]
|
||||
*/
|
||||
private $_mirrors = array();
|
||||
|
||||
/**
|
||||
* Commit the given bytes to the storage medium immediately.
|
||||
*
|
||||
* @param string $bytes
|
||||
*/
|
||||
abstract protected function _commit($bytes);
|
||||
|
||||
/**
|
||||
* Flush any buffers/content with immediate effect.
|
||||
*/
|
||||
abstract protected function _flush();
|
||||
|
||||
/**
|
||||
* Add a StreamFilter to this InputByteStream.
|
||||
*
|
||||
* @param Swift_StreamFilter $filter
|
||||
* @param string $key
|
||||
*/
|
||||
public function addFilter(Swift_StreamFilter $filter, $key)
|
||||
{
|
||||
$this->_filters[$key] = $filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an already present StreamFilter based on its $key.
|
||||
*
|
||||
* @param string $key
|
||||
*/
|
||||
public function removeFilter($key)
|
||||
{
|
||||
unset($this->_filters[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes $bytes to the end of the stream.
|
||||
*
|
||||
* @param string $bytes
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function write($bytes)
|
||||
{
|
||||
$this->_writeBuffer .= $bytes;
|
||||
foreach ($this->_filters as $filter) {
|
||||
if ($filter->shouldBuffer($this->_writeBuffer)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->_doWrite($this->_writeBuffer);
|
||||
|
||||
return ++$this->_sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* For any bytes that are currently buffered inside the stream, force them
|
||||
* off the buffer.
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
$this->_doWrite($this->_writeBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach $is to this stream.
|
||||
*
|
||||
* The stream acts as an observer, receiving all data that is written.
|
||||
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function bind(Swift_InputByteStream $is)
|
||||
{
|
||||
$this->_mirrors[] = $is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an already bound stream.
|
||||
*
|
||||
* If $is is not bound, no errors will be raised.
|
||||
* If the stream currently has any buffered data it will be written to $is
|
||||
* before unbinding occurs.
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function unbind(Swift_InputByteStream $is)
|
||||
{
|
||||
foreach ($this->_mirrors as $k => $stream) {
|
||||
if ($is === $stream) {
|
||||
if ($this->_writeBuffer !== '') {
|
||||
$stream->write($this->_writeBuffer);
|
||||
}
|
||||
unset($this->_mirrors[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the contents of the stream (empty it) and set the internal pointer
|
||||
* to the beginning.
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*/
|
||||
public function flushBuffers()
|
||||
{
|
||||
if ($this->_writeBuffer !== '') {
|
||||
$this->_doWrite($this->_writeBuffer);
|
||||
}
|
||||
$this->_flush();
|
||||
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->flushBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
/** Run $bytes through all filters */
|
||||
private function _filter($bytes)
|
||||
{
|
||||
foreach ($this->_filters as $filter) {
|
||||
$bytes = $filter->filter($bytes);
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
/** Just write the bytes to the stream */
|
||||
private function _doWrite($bytes)
|
||||
{
|
||||
$this->_commit($this->_filter($bytes));
|
||||
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->write($bytes);
|
||||
}
|
||||
|
||||
$this->_writeBuffer = '';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows reading and writing of bytes to and from an array.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_OutputByteStream
|
||||
{
|
||||
/**
|
||||
* The internal stack of bytes.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $_array = array();
|
||||
|
||||
/**
|
||||
* The size of the stack.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_arraySize = 0;
|
||||
|
||||
/**
|
||||
* The internal pointer offset.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_offset = 0;
|
||||
|
||||
/**
|
||||
* Bound streams.
|
||||
*
|
||||
* @var Swift_InputByteStream[]
|
||||
*/
|
||||
private $_mirrors = array();
|
||||
|
||||
/**
|
||||
* Create a new ArrayByteStream.
|
||||
*
|
||||
* If $stack is given the stream will be populated with the bytes it contains.
|
||||
*
|
||||
* @param mixed $stack of bytes in string or array form, optional
|
||||
*/
|
||||
public function __construct($stack = null)
|
||||
{
|
||||
if (is_array($stack)) {
|
||||
$this->_array = $stack;
|
||||
$this->_arraySize = count($stack);
|
||||
} elseif (is_string($stack)) {
|
||||
$this->write($stack);
|
||||
} else {
|
||||
$this->_array = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads $length bytes from the stream into a string and moves the pointer
|
||||
* through the stream by $length.
|
||||
*
|
||||
* If less bytes exist than are requested the
|
||||
* remaining bytes are given instead. If no bytes are remaining at all, boolean
|
||||
* false is returned.
|
||||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function read($length)
|
||||
{
|
||||
if ($this->_offset == $this->_arraySize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't use array slice
|
||||
$end = $length + $this->_offset;
|
||||
$end = $this->_arraySize < $end ? $this->_arraySize : $end;
|
||||
$ret = '';
|
||||
for (; $this->_offset < $end; ++$this->_offset) {
|
||||
$ret .= $this->_array[$this->_offset];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes $bytes to the end of the stream.
|
||||
*
|
||||
* @param string $bytes
|
||||
*/
|
||||
public function write($bytes)
|
||||
{
|
||||
$to_add = str_split($bytes);
|
||||
foreach ($to_add as $value) {
|
||||
$this->_array[] = $value;
|
||||
}
|
||||
$this->_arraySize = count($this->_array);
|
||||
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->write($bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach $is to this stream.
|
||||
*
|
||||
* The stream acts as an observer, receiving all data that is written.
|
||||
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function bind(Swift_InputByteStream $is)
|
||||
{
|
||||
$this->_mirrors[] = $is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an already bound stream.
|
||||
*
|
||||
* If $is is not bound, no errors will be raised.
|
||||
* If the stream currently has any buffered data it will be written to $is
|
||||
* before unbinding occurs.
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function unbind(Swift_InputByteStream $is)
|
||||
{
|
||||
foreach ($this->_mirrors as $k => $stream) {
|
||||
if ($is === $stream) {
|
||||
unset($this->_mirrors[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the internal read pointer to $byteOffset in the stream.
|
||||
*
|
||||
* @param int $byteOffset
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setReadPointer($byteOffset)
|
||||
{
|
||||
if ($byteOffset > $this->_arraySize) {
|
||||
$byteOffset = $this->_arraySize;
|
||||
} elseif ($byteOffset < 0) {
|
||||
$byteOffset = 0;
|
||||
}
|
||||
|
||||
$this->_offset = $byteOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the contents of the stream (empty it) and set the internal pointer
|
||||
* to the beginning.
|
||||
*/
|
||||
public function flushBuffers()
|
||||
{
|
||||
$this->_offset = 0;
|
||||
$this->_array = array();
|
||||
$this->_arraySize = 0;
|
||||
|
||||
foreach ($this->_mirrors as $stream) {
|
||||
$stream->flushBuffers();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allows reading and writing of bytes to and from a file.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterableInputStream implements Swift_FileStream
|
||||
{
|
||||
/** The internal pointer offset */
|
||||
private $_offset = 0;
|
||||
|
||||
/** The path to the file */
|
||||
private $_path;
|
||||
|
||||
/** The mode this file is opened in for writing */
|
||||
private $_mode;
|
||||
|
||||
/** A lazy-loaded resource handle for reading the file */
|
||||
private $_reader;
|
||||
|
||||
/** A lazy-loaded resource handle for writing the file */
|
||||
private $_writer;
|
||||
|
||||
/** If magic_quotes_runtime is on, this will be true */
|
||||
private $_quotes = false;
|
||||
|
||||
/** If stream is seekable true/false, or null if not known */
|
||||
private $_seekable = null;
|
||||
|
||||
/**
|
||||
* Create a new FileByteStream for $path.
|
||||
*
|
||||
* @param string $path
|
||||
* @param bool $writable if true
|
||||
*/
|
||||
public function __construct($path, $writable = false)
|
||||
{
|
||||
if (empty($path)) {
|
||||
throw new Swift_IoException('The path cannot be empty');
|
||||
}
|
||||
$this->_path = $path;
|
||||
$this->_mode = $writable ? 'w+b' : 'rb';
|
||||
|
||||
if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) {
|
||||
$this->_quotes = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the complete path to the file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads $length bytes from the stream into a string and moves the pointer
|
||||
* through the stream by $length.
|
||||
*
|
||||
* If less bytes exist than are requested the
|
||||
* remaining bytes are given instead. If no bytes are remaining at all, boolean
|
||||
* false is returned.
|
||||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public function read($length)
|
||||
{
|
||||
$fp = $this->_getReadHandle();
|
||||
if (!feof($fp)) {
|
||||
if ($this->_quotes) {
|
||||
ini_set('magic_quotes_runtime', 0);
|
||||
}
|
||||
$bytes = fread($fp, $length);
|
||||
if ($this->_quotes) {
|
||||
ini_set('magic_quotes_runtime', 1);
|
||||
}
|
||||
$this->_offset = ftell($fp);
|
||||
|
||||
// If we read one byte after reaching the end of the file
|
||||
// feof() will return false and an empty string is returned
|
||||
if ($bytes === '' && feof($fp)) {
|
||||
$this->_resetReadHandle();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
$this->_resetReadHandle();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the internal read pointer to $byteOffset in the stream.
|
||||
*
|
||||
* @param int $byteOffset
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setReadPointer($byteOffset)
|
||||
{
|
||||
if (isset($this->_reader)) {
|
||||
$this->_seekReadStreamToPosition($byteOffset);
|
||||
}
|
||||
$this->_offset = $byteOffset;
|
||||
}
|
||||
|
||||
/** Just write the bytes to the file */
|
||||
protected function _commit($bytes)
|
||||
{
|
||||
fwrite($this->_getWriteHandle(), $bytes);
|
||||
$this->_resetReadHandle();
|
||||
}
|
||||
|
||||
/** Not used */
|
||||
protected function _flush()
|
||||
{
|
||||
}
|
||||
|
||||
/** Get the resource for reading */
|
||||
private function _getReadHandle()
|
||||
{
|
||||
if (!isset($this->_reader)) {
|
||||
if (!$this->_reader = fopen($this->_path, 'rb')) {
|
||||
throw new Swift_IoException(
|
||||
'Unable to open file for reading ['.$this->_path.']'
|
||||
);
|
||||
}
|
||||
if ($this->_offset != 0) {
|
||||
$this->_getReadStreamSeekableStatus();
|
||||
$this->_seekReadStreamToPosition($this->_offset);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_reader;
|
||||
}
|
||||
|
||||
/** Get the resource for writing */
|
||||
private function _getWriteHandle()
|
||||
{
|
||||
if (!isset($this->_writer)) {
|
||||
if (!$this->_writer = fopen($this->_path, $this->_mode)) {
|
||||
throw new Swift_IoException(
|
||||
'Unable to open file for writing ['.$this->_path.']'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_writer;
|
||||
}
|
||||
|
||||
/** Force a reload of the resource for reading */
|
||||
private function _resetReadHandle()
|
||||
{
|
||||
if (isset($this->_reader)) {
|
||||
fclose($this->_reader);
|
||||
$this->_reader = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Check if ReadOnly Stream is seekable */
|
||||
private function _getReadStreamSeekableStatus()
|
||||
{
|
||||
$metas = stream_get_meta_data($this->_reader);
|
||||
$this->_seekable = $metas['seekable'];
|
||||
}
|
||||
|
||||
/** Streams in a readOnly stream ensuring copy if needed */
|
||||
private function _seekReadStreamToPosition($offset)
|
||||
{
|
||||
if ($this->_seekable === null) {
|
||||
$this->_getReadStreamSeekableStatus();
|
||||
}
|
||||
if ($this->_seekable === false) {
|
||||
$currentPos = ftell($this->_reader);
|
||||
if ($currentPos < $offset) {
|
||||
$toDiscard = $offset - $currentPos;
|
||||
fread($this->_reader, $toDiscard);
|
||||
|
||||
return;
|
||||
}
|
||||
$this->_copyReadStream();
|
||||
}
|
||||
fseek($this->_reader, $offset, SEEK_SET);
|
||||
}
|
||||
|
||||
/** Copy a readOnly Stream to ensure seekability */
|
||||
private function _copyReadStream()
|
||||
{
|
||||
if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) {
|
||||
/* We have opened a php:// Stream Should work without problem */
|
||||
} elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) {
|
||||
/* We have opened a tmpfile */
|
||||
} else {
|
||||
throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available');
|
||||
}
|
||||
$currentPos = ftell($this->_reader);
|
||||
fclose($this->_reader);
|
||||
$source = fopen($this->_path, 'rb');
|
||||
if (!$source) {
|
||||
throw new Swift_IoException('Unable to open file for copying ['.$this->_path.']');
|
||||
}
|
||||
fseek($tmpFile, 0, SEEK_SET);
|
||||
while (!feof($source)) {
|
||||
fwrite($tmpFile, fread($source, 4096));
|
||||
}
|
||||
fseek($tmpFile, $currentPos, SEEK_SET);
|
||||
fclose($source);
|
||||
$this->_reader = $tmpFile;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Romain-Geissler
|
||||
*/
|
||||
class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByteStream
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$filePath = tempnam(sys_get_temp_dir(), 'FileByteStream');
|
||||
|
||||
if ($filePath === false) {
|
||||
throw new Swift_IoException('Failed to retrieve temporary file name.');
|
||||
}
|
||||
|
||||
parent::__construct($filePath, true);
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
if (($content = file_get_contents($this->getPath())) === false) {
|
||||
throw new Swift_IoException('Failed to get temporary file content.');
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if (file_exists($this->getPath())) {
|
||||
@unlink($this->getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Analyzes characters for a specific character set.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
* @author Xavier De Cock <xdecock@gmail.com>
|
||||
*/
|
||||
interface Swift_CharacterReader
|
||||
{
|
||||
const MAP_TYPE_INVALID = 0x01;
|
||||
const MAP_TYPE_FIXED_LEN = 0x02;
|
||||
const MAP_TYPE_POSITIONS = 0x03;
|
||||
|
||||
/**
|
||||
* Returns the complete character map.
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $startOffset
|
||||
* @param array $currentMap
|
||||
* @param mixed $ignoredChars
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars);
|
||||
|
||||
/**
|
||||
* Returns the mapType, see constants.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMapType();
|
||||
|
||||
/**
|
||||
* Returns an integer which specifies how many more bytes to read.
|
||||
*
|
||||
* A positive integer indicates the number of more bytes to fetch before invoking
|
||||
* this method again.
|
||||
*
|
||||
* A value of zero means this is already a valid character.
|
||||
* A value of -1 means this cannot possibly be a valid character.
|
||||
*
|
||||
* @param integer[] $bytes
|
||||
* @param int $size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function validateByteSequence($bytes, $size);
|
||||
|
||||
/**
|
||||
* Returns the number of bytes which should be read to start each character.
|
||||
*
|
||||
* For fixed width character sets this should be the number of octets-per-character.
|
||||
* For multibyte character sets this will probably be 1.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInitialByteSize();
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides fixed-width byte sizes for reading fixed-width character sets.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
* @author Xavier De Cock <xdecock@gmail.com>
|
||||
*/
|
||||
class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterReader
|
||||
{
|
||||
/**
|
||||
* The number of bytes in a single character.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_width;
|
||||
|
||||
/**
|
||||
* Creates a new GenericFixedWidthReader using $width bytes per character.
|
||||
*
|
||||
* @param int $width
|
||||
*/
|
||||
public function __construct($width)
|
||||
{
|
||||
$this->_width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the complete character map.
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $startOffset
|
||||
* @param array $currentMap
|
||||
* @param mixed $ignoredChars
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
|
||||
{
|
||||
$strlen = strlen($string);
|
||||
// % and / are CPU intensive, so, maybe find a better way
|
||||
$ignored = $strlen % $this->_width;
|
||||
$ignoredChars = substr($string, -$ignored);
|
||||
$currentMap = $this->_width;
|
||||
|
||||
return ($strlen - $ignored) / $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the mapType.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMapType()
|
||||
{
|
||||
return self::MAP_TYPE_FIXED_LEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an integer which specifies how many more bytes to read.
|
||||
*
|
||||
* A positive integer indicates the number of more bytes to fetch before invoking
|
||||
* this method again.
|
||||
*
|
||||
* A value of zero means this is already a valid character.
|
||||
* A value of -1 means this cannot possibly be a valid character.
|
||||
*
|
||||
* @param string $bytes
|
||||
* @param int $size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function validateByteSequence($bytes, $size)
|
||||
{
|
||||
$needed = $this->_width - $size;
|
||||
|
||||
return $needed > -1 ? $needed : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes which should be read to start each character.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInitialByteSize()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Analyzes US-ASCII characters.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*/
|
||||
class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
|
||||
{
|
||||
/**
|
||||
* Returns the complete character map.
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $startOffset
|
||||
* @param array $currentMap
|
||||
* @param string $ignoredChars
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
|
||||
{
|
||||
$strlen = strlen($string);
|
||||
$ignoredChars = '';
|
||||
for ($i = 0; $i < $strlen; ++$i) {
|
||||
if ($string[$i] > "\x07F") {
|
||||
// Invalid char
|
||||
$currentMap[$i + $startOffset] = $string[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return $strlen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns mapType.
|
||||
*
|
||||
* @return int mapType
|
||||
*/
|
||||
public function getMapType()
|
||||
{
|
||||
return self::MAP_TYPE_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an integer which specifies how many more bytes to read.
|
||||
*
|
||||
* A positive integer indicates the number of more bytes to fetch before invoking
|
||||
* this method again.
|
||||
* A value of zero means this is already a valid character.
|
||||
* A value of -1 means this cannot possibly be a valid character.
|
||||
*
|
||||
* @param string $bytes
|
||||
* @param int $size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function validateByteSequence($bytes, $size)
|
||||
{
|
||||
$byte = reset($bytes);
|
||||
if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes which should be read to start each character.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInitialByteSize()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of SwiftMailer.
|
||||
* (c) 2004-2009 Chris Corbyn
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Analyzes UTF-8 characters.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
* @author Xavier De Cock <xdecock@gmail.com>
|
||||
*/
|
||||
class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
|
||||
{
|
||||
/** Pre-computed for optimization */
|
||||
private static $length_map = array(
|
||||
// N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x0N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN
|
||||
4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0, // 0xFN
|
||||
);
|
||||
|
||||
private static $s_length_map = array(
|
||||
"\x00" => 1, "\x01" => 1, "\x02" => 1, "\x03" => 1, "\x04" => 1, "\x05" => 1, "\x06" => 1, "\x07" => 1,
|
||||
"\x08" => 1, "\x09" => 1, "\x0a" => 1, "\x0b" => 1, "\x0c" => 1, "\x0d" => 1, "\x0e" => 1, "\x0f" => 1,
|
||||
"\x10" => 1, "\x11" => 1, "\x12" => 1, "\x13" => 1, "\x14" => 1, "\x15" => 1, "\x16" => 1, "\x17" => 1,
|
||||
"\x18" => 1, "\x19" => 1, "\x1a" => 1, "\x1b" => 1, "\x1c" => 1, "\x1d" => 1, "\x1e" => 1, "\x1f" => 1,
|
||||
"\x20" => 1, "\x21" => 1, "\x22" => 1, "\x23" => 1, "\x24" => 1, "\x25" => 1, "\x26" => 1, "\x27" => 1,
|
||||
"\x28" => 1, "\x29" => 1, "\x2a" => 1, "\x2b" => 1, "\x2c" => 1, "\x2d" => 1, "\x2e" => 1, "\x2f" => 1,
|
||||
"\x30" => 1, "\x31" => 1, "\x32" => 1, "\x33" => 1, "\x34" => 1, "\x35" => 1, "\x36" => 1, "\x37" => 1,
|
||||
"\x38" => 1, "\x39" => 1, "\x3a" => 1, "\x3b" => 1, "\x3c" => 1, "\x3d" => 1, "\x3e" => 1, "\x3f" => 1,
|
||||
"\x40" => 1, "\x41" => 1, "\x42" => 1, "\x43" => 1, "\x44" => 1, "\x45" => 1, "\x46" => 1, "\x47" => 1,
|
||||
"\x48" => 1, "\x49" => 1, "\x4a" => 1, "\x4b" => 1, "\x4c" => 1, "\x4d" => 1, "\x4e" => 1, "\x4f" => 1,
|
||||
"\x50" => 1, "\x51" => 1, "\x52" => 1, "\x53" => 1, "\x54" => 1, "\x55" => 1, "\x56" => 1, "\x57" => 1,
|
||||
"\x58" => 1, "\x59" => 1, "\x5a" => 1, "\x5b" => 1, "\x5c" => 1, "\x5d" => 1, "\x5e" => 1, "\x5f" => 1,
|
||||
"\x60" => 1, "\x61" => 1, "\x62" => 1, "\x63" => 1, "\x64" => 1, "\x65" => 1, "\x66" => 1, "\x67" => 1,
|
||||
"\x68" => 1, "\x69" => 1, "\x6a" => 1, "\x6b" => 1, "\x6c" => 1, "\x6d" => 1, "\x6e" => 1, "\x6f" => 1,
|
||||
"\x70" => 1, "\x71" => 1, "\x72" => 1, "\x73" => 1, "\x74" => 1, "\x75" => 1, "\x76" => 1, "\x77" => 1,
|
||||
"\x78" => 1, "\x79" => 1, "\x7a" => 1, "\x7b" => 1, "\x7c" => 1, "\x7d" => 1, "\x7e" => 1, "\x7f" => 1,
|
||||
"\x80" => 0, "\x81" => 0, "\x82" => 0, "\x83" => 0, "\x84" => 0, "\x85" => 0, "\x86" => 0, "\x87" => 0,
|
||||
"\x88" => 0, "\x89" => 0, "\x8a" => 0, "\x8b" => 0, "\x8c" => 0, "\x8d" => 0, "\x8e" => 0, "\x8f" => 0,
|
||||
"\x90" => 0, "\x91" => 0, "\x92" => 0, "\x93" => 0, "\x94" => 0, "\x95" => 0, "\x96" => 0, "\x97" => 0,
|
||||
"\x98" => 0, "\x99" => 0, "\x9a" => 0, "\x9b" => 0, "\x9c" => 0, "\x9d" => 0, "\x9e" => 0, "\x9f" => 0,
|
||||
"\xa0" => 0, "\xa1" => 0, "\xa2" => 0, "\xa3" => 0, "\xa4" => 0, "\xa5" => 0, "\xa6" => 0, "\xa7" => 0,
|
||||
"\xa8" => 0, "\xa9" => 0, "\xaa" => 0, "\xab" => 0, "\xac" => 0, "\xad" => 0, "\xae" => 0, "\xaf" => 0,
|
||||
"\xb0" => 0, "\xb1" => 0, "\xb2" => 0, "\xb3" => 0, "\xb4" => 0, "\xb5" => 0, "\xb6" => 0, "\xb7" => 0,
|
||||
"\xb8" => 0, "\xb9" => 0, "\xba" => 0, "\xbb" => 0, "\xbc" => 0, "\xbd" => 0, "\xbe" => 0, "\xbf" => 0,
|
||||
"\xc0" => 2, "\xc1" => 2, "\xc2" => 2, "\xc3" => 2, "\xc4" => 2, "\xc5" => 2, "\xc6" => 2, "\xc7" => 2,
|
||||
"\xc8" => 2, "\xc9" => 2, "\xca" => 2, "\xcb" => 2, "\xcc" => 2, "\xcd" => 2, "\xce" => 2, "\xcf" => 2,
|
||||
"\xd0" => 2, "\xd1" => 2, "\xd2" => 2, "\xd3" => 2, "\xd4" => 2, "\xd5" => 2, "\xd6" => 2, "\xd7" => 2,
|
||||
"\xd8" => 2, "\xd9" => 2, "\xda" => 2, "\xdb" => 2, "\xdc" => 2, "\xdd" => 2, "\xde" => 2, "\xdf" => 2,
|
||||
"\xe0" => 3, "\xe1" => 3, "\xe2" => 3, "\xe3" => 3, "\xe4" => 3, "\xe5" => 3, "\xe6" => 3, "\xe7" => 3,
|
||||
"\xe8" => 3, "\xe9" => 3, "\xea" => 3, "\xeb" => 3, "\xec" => 3, "\xed" => 3, "\xee" => 3, "\xef" => 3,
|
||||
"\xf0" => 4, "\xf1" => 4, "\xf2" => 4, "\xf3" => 4, "\xf4" => 4, "\xf5" => 4, "\xf6" => 4, "\xf7" => 4,
|
||||
"\xf8" => 5, "\xf9" => 5, "\xfa" => 5, "\xfb" => 5, "\xfc" => 6, "\xfd" => 6, "\xfe" => 0, "\xff" => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the complete character map.
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $startOffset
|
||||
* @param array $currentMap
|
||||
* @param mixed $ignoredChars
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
|
||||
{
|
||||
if (!isset($currentMap['i']) || !isset($currentMap['p'])) {
|
||||
$currentMap['p'] = $currentMap['i'] = array();
|
||||
}
|
||||
|
||||
$strlen = strlen($string);
|
||||
$charPos = count($currentMap['p']);
|
||||
$foundChars = 0;
|
||||
$invalid = false;
|
||||
for ($i = 0; $i < $strlen; ++$i) {
|
||||
$char = $string[$i];
|
||||
$size = self::$s_length_map[$char];
|
||||
if ($size == 0) {
|
||||
/* char is invalid, we must wait for a resync */
|
||||
$invalid = true;
|
||||
continue;
|
||||
} else {
|
||||
if ($invalid == true) {
|
||||
/* We mark the chars as invalid and start a new char */
|
||||
$currentMap['p'][$charPos + $foundChars] = $startOffset + $i;
|
||||
$currentMap['i'][$charPos + $foundChars] = true;
|
||||
++$foundChars;
|
||||
$invalid = false;
|
||||
}
|
||||
if (($i + $size) > $strlen) {
|
||||
$ignoredChars = substr($string, $i);
|
||||
break;
|
||||
}
|
||||
for ($j = 1; $j < $size; ++$j) {
|
||||
$char = $string[$i + $j];
|
||||
if ($char > "\x7F" && $char < "\xC0") {
|
||||
// Valid - continue parsing
|
||||
} else {
|
||||
/* char is invalid, we must wait for a resync */
|
||||
$invalid = true;
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
/* Ok we got a complete char here */
|
||||
$currentMap['p'][$charPos + $foundChars] = $startOffset + $i + $size;
|
||||
$i += $j - 1;
|
||||
++$foundChars;
|
||||
}
|
||||
}
|
||||
|
||||
return $foundChars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns mapType.
|
||||
*
|
||||
* @return int mapType
|
||||
*/
|
||||
public function getMapType()
|
||||
{
|
||||
return self::MAP_TYPE_POSITIONS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an integer which specifies how many more bytes to read.
|
||||
*
|
||||
* A positive integer indicates the number of more bytes to fetch before invoking
|
||||
* this method again.
|
||||
* A value of zero means this is already a valid character.
|
||||
* A value of -1 means this cannot possibly be a valid character.
|
||||
*
|
||||
* @param string $bytes
|
||||
* @param int $size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function validateByteSequence($bytes, $size)
|
||||
{
|
||||
if ($size < 1) {
|
||||
return -1;
|
||||
}
|
||||
$needed = self::$length_map[$bytes[0]] - $size;
|
||||
|
||||
return $needed > -1 ? $needed : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes which should be read to start each character.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInitialByteSize()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user