Skip to content
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 Default customer, category and product when enable TakePOS #25031

Merged
merged 8 commits into from
Oct 26, 2023
Merged

NEW Default customer, category and product when enable TakePOS #25031

merged 8 commits into from
Oct 26, 2023

Conversation

andreubisquerra
Copy link
Contributor

Easy setup for TakePOS. Create a customer when TakePOS is enabled. It checks if TakePOS has already been configured to avoid recreating the customer if it has already been created.

@andreubisquerra andreubisquerra changed the title Default customer, category and product when enable TakePOS Default customer when enable TakePOS Jun 9, 2023
Easy setup for TakePOS. Create a category and product when TakePOS is enabled. It checks if TakePOS has already been configured to avoid recreating the category and productif it has already been created.
Default category and product when enable TakePOS
@andreubisquerra andreubisquerra changed the title Default customer when enable TakePOS Default customer, category and product when enable TakePOS Jun 9, 2023
@andreubisquerra andreubisquerra changed the title Default customer, category and product when enable TakePOS NEW Default customer, category and product when enable TakePOS Jun 9, 2023
//Default customer for Point of sale
if (empty(getDolGlobalInt('CASHDESK_ID_THIRDPARTY1'))) {
$societe = new Societe($db);
$societe->nom = $langs->trans("DefaultPOSThirdLabel");
Copy link
Member

@eldy eldy Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you disable and reenable the module. You must check the object does not exist yet by doing a fetch to avoid to try to create it a second time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When reactivated the second time, as the variable CASHDESK_ID_THIRDPARTY1 is already assigned, it will not be created again. It is only created the first time when the CASHDESK_ID_THIRDPARTY1 variable has never been initialized.

$category->label = $langs->trans("DefaultPOSCatLabel");
$category->type = Categorie::TYPE_PRODUCT;
$result = $category->create($user);
if ($result > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand addition of a Default Category and Thirdparty, but what is the goald of this product ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For TakePOS to work you must have created at least one product. If there are no products created, TakePOS says it needs at least one product to work. A generic product may be interesting to be able to use TakePOS without configuration. Then if the user wants to change the name or create more products, they are welcome.

@@ -145,3 +145,6 @@ ShowProductReference=Show reference of products
UsePriceHT=Use price excl. taxes and not price incl. taxes
TerminalName=Terminal %s
TerminalNameDesc=Terminal name
DefaultPOSThirdLabel=TakePOS sales
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to name it "Default customer for POS"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for me

if (empty(getDolGlobalInt('CASHDESK_ID_THIRDPARTY1'))) {
$societe = new Societe($db);
$societe->nom = $langs->trans("DefaultPOSThirdLabel");
$societe->client = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also set property note_private = 'Default customer automaticaly created by Point Of Sale module activation. Can be used as the default customer in the Point Of Sale setup. Can also be edited or removed.'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for me

@@ -145,3 +145,6 @@ ShowProductReference=Show reference of products
UsePriceHT=Use price excl. taxes and not price incl. taxes
TerminalName=Terminal %s
TerminalNameDesc=Terminal name
DefaultPOSThirdLabel=TakePOS sales
DefaultPOSCatLabel=Point of sale
Copy link
Member

@eldy eldy Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to name this category like this
"Category for all Point Of Sale products"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for me

@eldy eldy added the PR to fix - OK to merge if suggested fix are done PR was analyzed by PR merger and seems ok to be merged as soon as a fix has been published label Oct 11, 2023
@eldy eldy merged commit 4761d70 into Dolibarr:develop Oct 26, 2023
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Event: DevCamp 2023 Bordeaux PR to fix - OK to merge if suggested fix are done PR was analyzed by PR merger and seems ok to be merged as soon as a fix has been published
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants