5,676

(38 replies, posted in Accounts Receivable)

Only 2 files use the  $_SESSION["wa_current_user"]->loginname variable:

Line 82 in includes/errors.inc:

        $user = @$_SESSION["wa_current_user"]->loginname;

and Line 55 in reporting/includes/printer_class.inc:

        $ctrl = "H".$server."\nP". substr($_SESSION["wa_current_user"]->loginname,0,31) 

It is always the same as $_SESSION["wa_current_user"]->username - would the devs want to standardize?.

5,677

(38 replies, posted in Accounts Receivable)

@ed10: While I was documenting the code trace back to where the variables were set, you beat me to it!

You can actually dump the specific session variable:

echo print_r($_SESSION["wa_current_user"], true);

at the location of the send() and see what is the output!

Line 95 in admin/db/users_db.inc in function get_users_by_login():

$sql = "SELECT * FROM ".TB_PREF."users WHERE user_id=".db_escape($user_id);

Hence all fields must be available and in your instance, the real_name field may not have been set, though in the email instance, the username may be okay.

5,678

(38 replies, posted in Accounts Receivable)

In includes/session.inc, outside of the class definition, in the function login_timeout() line 402 is:

$_SESSION["wa_current_user"] = new current_user();

Class current_user is defined in includes/current_user.inc, having class variables $loginname, $name and $username all set to empty strings in the constructor at line 42.

current_user::login() method on successful authorisation at line 81:

$myrow = get_user_by_login($loginname);

and sets the current_user class variables

                $this->name = $myrow["real_name"];
                $this->pos = $myrow["pos"];
                $this->loginname = $loginname;
                $this->username = $this->loginname;
                $this->prefs = new user_prefs($myrow);
                $this->user = @$myrow["id"];

If the session variable user is available, ordinarily from the above code, the session variable name should also be available.

When a login timeout occurs, this may not get executed fully and some session variables may get unset (needs to be checked).

Somewhere the session variablenameis getting set to an empty string after having been logged in, if it is empty.

Hence check by replacing the line 269 in reporting/includes/pdf_report.inc with any of the following:

$this->user = $_SESSION["wa_current_user"]->loginname;

// or

$this->user = $_SESSION["wa_current_user"]->username;

and see what happens!

5,679

(38 replies, posted in Accounts Receivable)

The said variable:
$_SESSION["wa_current_user"]->name
appears in:

reporting/includes/pdf_report.inc
reporting/includes/excel_report.inc
admin/db/maintenance_db.inc
themes/aqua/renderer.php
themes/cool/renderer.php
themes/default/renderer.php

A few months ago, some repeating code in all the renderer.php files were siphoned out elsewhere to a single function and at that time the variable may have vanished from being set or when changes to includes/session.inc were made over time.

Therefore while retaining the variable $_SESSION["wa_current_user"]->name in the said files, it may be required to set the field real_name from the users table if the user is logged in - in the includes/session.inc file.

Come to think of it, thereal_namein theuserstable does not seem to be used anywhere! Optional field that may not have any value at all!

5,680

(38 replies, posted in Accounts Receivable)

Line 269 in reporting/includes/pdf_report.inc, the function Info() sets:

$this->user = $_SESSION["wa_current_user"]->name;

Since it is taken from session variable, and the function Info() is not called anywhere within the FrontReport class at all, it is called by it's instance in each report.

Each report file repXXX.php has some function(s) that make an instance like $rep = new FrontReport(.... followed by $rep->Info($params, $cols, $headers, $aligns); This will set the $user FrontReport class variable

The FrontReport class method End() in lines 993-995 includes:

require_once($path_to_root . "/reporting/includes/class.mail.inc");
mail = new email(str_replace(",", "", $this->company['coy_name']),
    $this->company['email']);

This method End() is called at the very end of each repXXX.php file.

All seems fine and hence the syntax to set the $this->user is wrong.

includes/session.inc provides the correct syntax:

$user = $_SESSION["wa_current_user"]->user;

Therefore Line 269 in reporting/includes/pdf_report.inc should be::

$this->user = $_SESSION["wa_current_user"]->user;

5,681

(38 replies, posted in Accounts Receivable)

Line 47 of reporting/includes/class.mail.inc:

$this->header = "From: $name <$mail>\n";

may be replaced with:

$this->header = "From: $name <$mail>\nReply-to: $name <$mail>\n";

The $add_params variable in the class.mail.inc file remains unused. Quote from the PHP manual for mail():

additional_parameters (optional) : The additional_parameters parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.
The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

The $this-user in the other files may have an issue of scope of being an included file's variable.

5,682

(38 replies, posted in Accounts Receivable)

From the PHP mail() manual:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

If the $this->user correctly enters the from header variable, it can be made to enter the same value into a $reply-to variable and used as above.

There is a $sender variable that gets populated as well?
Or just use the from header directly for the 'Reply-to' header.

Exchange Rate is 1 for home currency. Recalculate all the others (done by getting the current exchanges rates and adjusting as required) and create currencies you use but are currently absent ad acquire / fix their exchange rates.

5,684

(38 replies, posted in Accounts Receivable)

How did you fix the return path? Was it the addition of a reply-to header in the script or in the class.mail.inc ?

$this->user is the currently logged in user whose email should be in the users table.

5,685

(38 replies, posted in Accounts Receivable)

It is possible that the comma may be a delimiter somewhere and may need to be stripped out of the Name. Also was checking for consistency and alternatives to the existing mailer like the integration in similar context.

For your specific requirement, you may want to dump the variables just before the send() occurs in both the caller instance and in the class method as well.

5,686

(38 replies, posted in Accounts Receivable)

Anyone integrated PHPMailer in the place of the existing class.mail.inc ? This will enable sending using a relay SMTP server like gmail.

class.mail.inc is called and instantiated only in sales/includes/db/sales_order_db.inc and reporting/includes/pdf_report.inc. Hence such integration with PHPMailer would be easy.

Lines 994-996 in reporting/includes/pdf_report.inc:


                        $mail = new email(str_replace(",", "", $this->company['coy_name']),
                            $this->company['email']);
                        $mail->charset = $this->encoding;

Line 104 in sales/includes/db/sales_order_db.inc:


        $mail = new email($company['coy_name'], $company['email']);

The charset is missing and the coy_name is not stripped of commas in the latter case.

The latter should be:

$mail = new email(str_replace(",", "", $this->company['coy_name']),    $this->company['email']);

Better still would be to move the stripping of the commas to the class method constructor itself by inserting the following in line 47 of reporting/includes/class.mail.inc:

$name = str_replace(",", "", $name);

and removing the str_replace from both files that use the class.

It is possible that your folder permissions failed to allow the webserver process to create the said file. Just create a an empty faillog.php file in the webroot with permissions and ownerships that allow the webserver to write to it.

5,688

(3 replies, posted in Installation)

Just zip it up and archive it. Remove the install folder as there is no install needed.

If you used the file diffs then there would be no install folder.

5,689

(11 replies, posted in Items and Inventory)

Possibly yes - just like the domains you sell to others.

5,690

(3 replies, posted in Installation)

Please see Post 6 of the Release Announcement and take the diff files set from there. Just overwrite your existing ones. No DB Changes.

Incorporate new variables and new options for existing variables from the config.default.php into your existing config.php with appropriate values.

Check for any new entries in the #_sys_prefs table in the en_US-new.sql file compared with your existing db being used and add them in.

5,691

(11 replies, posted in Items and Inventory)

"Sell" internal domains to yourself for possibly $0/-.

Placed content in Wiki

Do not, in general, use php $ variables inside the translation text directly.

Check the 3166/3167 Mercurial for sprintf for example workarounds. Otherwise the litteral varable name will be parsed instead. Make sure every possible variable value has a translation in the .po/.mo files.

The lines (they seem okay in hindsight):

    label_cell(_($myrow["name"]));//   here the _() is put
    label_cell(_($parent_text));//   here the _() is put
    label_cell(_($bs_text));//   here the _() is put

should possibly be (%d for numbers and %s for strings) where every possible value of :

    label_cell(sprintf(_("%s"), $myrow["name"]));//   here the _() is put
    label_cell(sprintf(_("%s"), $parent_text));//   here the _() is put
    label_cell(sprintf(_("%s"), $bs_text));//   here the _() is put

Even this may not work as intended since %s will be parsed as is and there is no preceeding or succeeding text to be translated. An eval() may have to be done on a cocatenated string containing the variable.

Try the following as well:

    label_cell(_(sprintf("%s", $myrow["name"])));//   here the _() is put
    label_cell(_(sprintf("%s", $parent_text)));//   here the _() is put
    label_cell(_(sprintf("%s", $bs_text)));//   here the _() is put

Maybe a check to see if $parent_text is empty before translation would be all that is needed:

    label_cell($empty(trim($parent_text)) ? "" : _($parent_text));//   here the _() is put

5,694

(32 replies, posted in FA Modifications)

Did you mean:

    if ($editkey) {
        set_editor('customer', $name, $editkey);
        set_editor('item', $name, $editkey);
    }

5,695

(7 replies, posted in Translations)

Thanks Joe - HG 3166/3167 fixes it.

5,696

(10 replies, posted in Announcements)

A matching empty.po for both FA and FA install is attached for hg 3165.

5,697

(7 replies, posted in Translations)

In the same file gl/gl_bank.php line 73 with the same variable $trans_no is coded as:

       display_notification_centered(sprintf(_("Payment %d has been entered"), $trans_no));

whereas line 122 is coded as:

       display_notification_centered(_("Deposit $trans_no has been modified"));

Line 122 should hence be coded as

       display_notification_centered(sprintf(_("Deposit %d has been modified"), $trans_no));

Line 1000-1001 in file reporting/includes/pdf_report.inc has the necessary code you want to modify.

                        $msg = _("Dear") . " " . $contact['name2'] . ",\n\n" 
                            . _("Attached you will find ") . " " . $subject ."\n\n";

It is possible that the js in the company cache needs to be refreshed. For company 0 it would be:

cd /var/www/webroot
rm company/0/js_cache/*.js

5,700

(32 replies, posted in FA Modifications)

@chrison Post 12 here:
While midway entering line items, when you find that you do not have the item in the item master, try entering the new item in another window/tab of the browser instead of the standard popup that occurs. Then save midway and choose to edit / append to the line items of the same main record. If you did not understand the above, then make some numbered steps and screenshots for reference and I'll match the steps to any new workaround ones.