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

FIX avoid pgsql error #31360

Closed
wants to merge 3 commits into from
Closed

Conversation

hregis
Copy link
Contributor

@hregis hregis commented Oct 11, 2024

No description provided.

$contact = new Contact($db);

$result = $contact->fetch($id);
$contact->oldcopy = clone $contact;
Copy link
Contributor

@mdeweerd mdeweerd Oct 11, 2024

Choose a reason for hiding this comment

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

You'll have to ignore this one.

// @phan-suppress-current-line PhanTypeMismatchProperty

I opened a phan issue for this yesterday: phan/phan#4883 .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mdeweerd thank you


$sql = "DELETE t, et FROM ".MAIN_DB_PREFIX."socpeople AS t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields AS et ON t.rowid = et.fk_object";
$sql .= " WHERE t.fk_soc = ".((int) $socid);
Copy link
Member

@eldy eldy Oct 11, 2024

Choose a reason for hiding this comment

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

Using the fetch then delete will break the control on owner of contact.
Why not just removing the left join on the delete ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eldy i use the "delete" function of contact class, same code inside the contact card for delete action. Maybe add this verification in "delete" function of contact class no ?

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Oct 11, 2024
$db->commit();
$contact = new Contact($db);

$result = $contact->fetch($id);
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no more error checking on the fetch() operation. Should it be checked also?

@eldy eldy closed this in 21c1c02 Oct 13, 2024
@hregis
Copy link
Contributor Author

hregis commented Oct 13, 2024

@eldy et quid des autres tables qu'on nettoie lorsqu'on utilise la fonction delete de la classe contact lorsqu'on supprime un contact à partir de sa fiche ? Et du coup le trigger n'est pas appelé non plus !!

@eldy
Copy link
Member

eldy commented Oct 14, 2024

@eldy et quid des autres tables qu'on nettoie lorsqu'on utilise la fonction delete de la classe contact lorsqu'on supprime un contact à partir de sa fiche ? Et du coup le trigger n'est pas appelé non plus !!

You are right. I was confused by the label of PR: fix pgsql sql error.
So i pushed a fix for pgsql sql error only.
But the need to clean also other tables and run triggers must be fixed too.

@hregis
Copy link
Contributor Author

hregis commented Oct 14, 2024

@eldy i send a new PR #31384

@hregis
Copy link
Contributor Author

hregis commented Oct 14, 2024

J'aime voir des bugs se régler au fur et à mesure de les voir et de les comprendre... Ne pas comprendre les bugs c'est ne pas comprendre Dolibarr...
@Dolibarr @eldy quand tu vois un code qui ne rentre pas dans ta matrice il faut faire en sorte de le comprendre avant de le juger et de l'exclure... Je vous aime ! ❤️😘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants