-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEW Adds payment terms and procentual discount to the creation of an invoice from time entries in projects #29694
Conversation
htdocs/projet/tasks/time.php
Outdated
@@ -418,7 +418,8 @@ | |||
$tmptimespent = new Task($db); | |||
$tmpproduct = new Product($db); | |||
$fuser = new User($db); | |||
|
|||
$remiseproject = GETPOST('remiseproject', 'int'); | |||
$condidproject = GETPOST('condidproject', 'int'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GETPOSTINT here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thank you
htdocs/projet/tasks/time.php
Outdated
@@ -418,7 +418,8 @@ | |||
$tmptimespent = new Task($db); | |||
$tmpproduct = new Product($db); | |||
$fuser = new User($db); | |||
|
|||
$remiseproject = GETPOST('remiseproject', 'int'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data is a string used by user to enter a numeric value;
So you must use here
$remiseproject = price2num(GETPOST('remiseproject', 'int'));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Is it possible to combine both of your comments and change this to:
$remiseproject = price2num(GETPOSTINT('remiseproject'));?
Or
price2num(GETPOST('remiseproject'));
because it is not only INT
Thanks for your answers. It is my first Request. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question !
GETPOSTINT will always return an int, so no need to use price2num.
But an amount or rate is not an int, it is a float with a possible thousand or decimal separator (depending on user language). So you must use GETPOST( , 'alphanohtml') that return a string must some special chars (that is the decimal separator that is different for each country) and then convert it into a float according to the currency format of the user with price2num(). Price2num convert a text entered by a user into a PHP float variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Done. Thanks a lot
htdocs/projet/tasks/time.php
Outdated
@@ -418,7 +418,8 @@ | |||
$tmptimespent = new Task($db); | |||
$tmpproduct = new Product($db); | |||
$fuser = new User($db); | |||
|
|||
$remiseproject = price2num(GETPOST('remiseproject', 'int')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must use GETPOST('remiseprojet', 'alphanohtml') (see my answer to your question)
NEW Adds payment terms and procentual discount to the creation of an invoice from time entries in projects
when an invoice is created from time entries in projects, a payment term is only transferred if the customer has a customer-specific payment term. If the customer does not have this, the invoice is created without a payment term.
This code inserts two additional lines in the pre-diagram for invoice creation. These lines show the payment terms and the percentage discount - pre-filled with the customer's values if available otherwise the first payment term and 0% discount.
It is possible to customize the values here. The invoice is then created with the specified payment terms and each invoice line with the specified percentage discount.
If an existing invoice is selected instead of a new one, the line for the payment term is hidden.